Refactored Host mode Class Driver *_Host_ConfigurePipes() routines to be more space...
[pub/USBasp.git] / Projects / Incomplete / MIDIToneGenerator / makefile
index ff512a3..71507f5 100644 (file)
@@ -47,7 +47,7 @@
 # make doxygen = Generate DoxyGen documentation for the project (must have\r
 #                DoxyGen installed)\r
 #\r
-# make debug = Start either simulavr or avarice as specified for debugging, \r
+# make debug = Start either simulavr or avarice as specified for debugging,\r
 #              with avr-gdb or avr-insight as the front end for debugging.\r
 #\r
 # make filename.s = Just compile filename.c into the assembler code only.\r
@@ -64,14 +64,14 @@ MCU = at90usb1287
 \r
 \r
 # Target board (see library "Board Types" documentation, NONE for projects not requiring\r
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called \r
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called\r
 # "Board" inside the application directory.\r
-BOARD  = USBKEY\r
+BOARD = USBKEY\r
 \r
 \r
 # Processor frequency.\r
-#     This will define a symbol, F_CPU, in all source code files equal to the \r
-#     processor frequency in Hz. You can then use this symbol in your source code to \r
+#     This will define a symbol, F_CPU, in all source code files equal to the\r
+#     processor frequency in Hz. You can then use this symbol in your source code to\r
 #     calculate timings. Do NOT tack on a 'UL' at the end, this will be done\r
 #     automatically to create a 32-bit value in your source code.\r
 #\r
@@ -84,7 +84,7 @@ F_CPU = 8000000
 \r
 \r
 # Input clock frequency.\r
-#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the\r
 #     input clock frequency (before any prescaling is performed) in Hz. This value may\r
 #     differ from F_CPU if prescaling is used on the latter, and is required as the\r
 #     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
@@ -112,35 +112,34 @@ OBJDIR = .
 \r
 \r
 # Path to the LUFA library\r
-LUFA_PATH = ../../..\r
+LUFA_PATH = ../../../\r
 \r
 \r
-# LUFA library compile-time options\r
+# LUFA library compile-time options and predefined tokens\r
 LUFA_OPTS  = -D USB_DEVICE_ONLY\r
 LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8\r
 LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1\r
 LUFA_OPTS += -D USE_FLASH_DESCRIPTORS\r
 LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
+LUFA_OPTS += -D AUDIO_OUT_STEREO\r
+#LUFA_OPTS += -D AUDIO_OUT_MONO\r
+#LUFA_OPTS += -D AUDIO_OUT_PORTC\r
+\r
+\r
+# Create the LUFA source path variables by including the LUFA root makefile\r
+include $(LUFA_PATH)/LUFA/makefile\r
+\r
 \r
 # List C source files here. (C dependencies are automatically generated.)\r
 SRC = $(TARGET).c                                                 \\r
          Descriptors.c                                               \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c        \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c           \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c               \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c       \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c           \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c               \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c       \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c  \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c            \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c           \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MIDI.c           \\r
+         $(LUFA_SRC_USB)                                             \\r
+         $(LUFA_SRC_USBCLASS)\r
 \r
 \r
 # List C++ source files here. (C dependencies are automatically generated.)\r
-CPPSRC = \r
+CPPSRC =\r
 \r
 \r
 # List Assembler source files here.\r
@@ -153,7 +152,7 @@ CPPSRC =
 ASRC =\r
 \r
 \r
-# Optimization level, can be [0, 1, 2, 3, s]. \r
+# Optimization level, can be [0, 1, 2, 3, s].\r
 #     0 = turn off optimization. s = optimize for size.\r
 #     (Note: 3 is not always the best optimization level. See avr-libc FAQ.)\r
 OPT = s\r
@@ -178,19 +177,27 @@ EXTRAINCDIRS = $(LUFA_PATH)/
 #     gnu89 = c89 plus GCC extensions\r
 #     c99   = ISO C99 standard (not yet fully implemented)\r
 #     gnu99 = c99 plus GCC extensions\r
-CSTANDARD = -std=gnu99\r
+CSTANDARD = -std=c99\r
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)\r
+CDEFS  = -DF_CPU=$(F_CPU)UL\r
+CDEFS += -DF_CLOCK=$(F_CLOCK)UL\r
+CDEFS += -DBOARD=BOARD_$(BOARD)\r
+CDEFS += $(LUFA_OPTS)\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
-ADEFS = -DF_CPU=$(F_CPU)\r
-\r
+ADEFS  = -DF_CPU=$(F_CPU)\r
+ADEFS += -DF_CLOCK=$(F_CLOCK)UL\r
+ADEFS += -DBOARD=BOARD_$(BOARD)\r
+ADEFS += $(LUFA_OPTS)\r
 \r
 # Place -D or -U options here for C++ sources\r
-CPPDEFS = -DF_CPU=$(F_CPU)UL\r
+CPPDEFS  = -DF_CPU=$(F_CPU)UL\r
+CPPDEFS += -DF_CLOCK=$(F_CLOCK)UL\r
+CPPDEFS += -DBOARD=BOARD_$(BOARD)\r
+CPPDEFS += $(LUFA_OPTS)\r
 #CPPDEFS += -D__STDC_LIMIT_MACROS\r
 #CPPDEFS += -D__STDC_CONSTANT_MACROS\r
 \r
@@ -212,10 +219,12 @@ CFLAGS += -ffunction-sections
 CFLAGS += -fno-inline-small-functions\r
 CFLAGS += -fpack-struct\r
 CFLAGS += -fshort-enums\r
+CFLAGS += -fno-strict-aliasing\r
 CFLAGS += -Wall\r
 CFLAGS += -Wstrict-prototypes\r
-CFLAGS += -Wundef\r
+#CFLAGS += -mshort-calls\r
 #CFLAGS += -fno-unit-at-a-time\r
+#CFLAGS += -Wundef\r
 #CFLAGS += -Wunreachable-code\r
 #CFLAGS += -Wsign-compare\r
 CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)\r
@@ -239,7 +248,7 @@ CPPFLAGS += -fpack-struct
 CPPFLAGS += -fshort-enums\r
 CPPFLAGS += -fno-exceptions\r
 CPPFLAGS += -Wall\r
-CFLAGS += -Wundef\r
+CPPFLAGS += -Wundef\r
 #CPPFLAGS += -mshort-calls\r
 #CPPFLAGS += -fno-unit-at-a-time\r
 #CPPFLAGS += -Wstrict-prototypes\r
@@ -257,7 +266,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
 #             for use in COFF files, additional information about filenames\r
 #             and function names needs to be present in the assembler source\r
 #             files -- see avr-libc docs [FIXME: not yet described there]\r
-#  -listing-cont-lines: Sets the maximum number of continuation lines of hex \r
+#  -listing-cont-lines: Sets the maximum number of continuation lines of hex\r
 #       dump that will be displayed for a given single line of source input.\r
 ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100\r
 \r
@@ -270,7 +279,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
 PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt\r
 \r
 # If this is left blank, then it will use the Standard printf version.\r
-PRINTF_LIB = \r
+PRINTF_LIB =\r
 #PRINTF_LIB = $(PRINTF_LIB_MIN)\r
 #PRINTF_LIB = $(PRINTF_LIB_FLOAT)\r
 \r
@@ -282,7 +291,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
 SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt\r
 \r
 # If this is left blank, then it will use the Standard scanf version.\r
-SCANF_LIB = \r
+SCANF_LIB =\r
 #SCANF_LIB = $(SCANF_LIB_MIN)\r
 #SCANF_LIB = $(SCANF_LIB_FLOAT)\r
 \r
@@ -294,7 +303,7 @@ MATH_LIB = -lm
 #     Each directory must be seperated by a space.\r
 #     Use forward slashes for directory separators.\r
 #     For a directory that has spaces, enclose it in quotes.\r
-EXTRALIBDIRS = \r
+EXTRALIBDIRS =\r
 \r
 \r
 \r
@@ -316,8 +325,8 @@ EXTMEMOPTS =
 #  -Wl,...:     tell GCC to pass this to linker.\r
 #    -Map:      create map file\r
 #    --cref:    add cross reference to  map file\r
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref\r
-LDFLAGS += -Wl,--relax \r
+LDFLAGS  = -Wl,-Map=$(TARGET).map,--cref\r
+LDFLAGS += -Wl,--relax\r
 LDFLAGS += -Wl,--gc-sections\r
 LDFLAGS += $(EXTMEMOPTS)\r
 LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))\r
@@ -328,9 +337,7 @@ LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
 \r
 #---------------- Programming Options (avrdude) ----------------\r
 \r
-# Programming hardware: alf avr910 avrisp bascom bsd \r
-# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500\r
-#\r
+# Programming hardware\r
 # Type: avrdude -c ?\r
 # to get a full listing.\r
 #\r
@@ -353,7 +360,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
 #AVRDUDE_NO_VERIFY = -V\r
 \r
 # Increase verbosity level.  Please use this when submitting bug\r
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> \r
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>\r
 # to submit bug reports.\r
 #AVRDUDE_VERBOSE = -v -v\r
 \r
@@ -387,7 +394,7 @@ JTAG_DEV = /dev/com1
 DEBUG_PORT = 4242\r
 \r
 # Debugging host used to communicate between GDB / avarice / simulavr, normally\r
-#     just set to localhost unless doing some sort of crazy debugging when \r
+#     just set to localhost unless doing some sort of crazy debugging when\r
 #     avarice is running on a different computer.\r
 DEBUG_HOST = localhost\r
 \r
@@ -410,12 +417,13 @@ REMOVEDIR = rm -rf
 COPY = cp\r
 WINSHELL = cmd\r
 \r
+\r
 # Define Messages\r
 # English\r
 MSG_ERRORS_NONE = Errors: none\r
 MSG_BEGIN = -------- begin --------\r
 MSG_END = --------  end  --------\r
-MSG_SIZE_BEFORE = Size before: \r
+MSG_SIZE_BEFORE = Size before:\r
 MSG_SIZE_AFTER = Size after:\r
 MSG_COFF = Converting to AVR COFF:\r
 MSG_EXTENDED_COFF = Converting to AVR Extended COFF:\r
@@ -434,10 +442,10 @@ MSG_CREATING_LIBRARY = Creating library:
 \r
 \r
 # Define all object files.\r
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) \r
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)\r
 \r
 # Define all listing files.\r
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) \r
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)\r
 \r
 \r
 # Compiler flags to generate dependency files.\r
@@ -455,7 +463,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
 \r
 \r
 # Default target.\r
-all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end\r
+all: begin gccversion sizebefore build sizeafter end\r
 \r
 # Change the build target to build a HEX file or a library.\r
 build: elf hex eep lss sym\r
@@ -490,6 +498,7 @@ ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
 MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )\r
 FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )\r
 \r
+\r
 sizebefore:\r
        @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \\r
        2>/dev/null; echo; fi\r
@@ -498,40 +507,14 @@ sizeafter:
        @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \\r
        2>/dev/null; echo; fi\r
 \r
-$(LUFA_PATH)/LUFA/LUFA_Events.lst:\r
-       @make -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst\r
-\r
-checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst\r
-       @echo\r
-       @echo Checking for invalid events...\r
-       @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \\r
-                        grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true\r
-       @sed -n -e 's/^/  WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp\r
-       @if test -s InvalidEvents.tmp; then exit 1; fi\r
-\r
-showliboptions:\r
-       @echo\r
-       @echo ---- Compile Time Library Options ----\r
-       @for i in $(LUFA_OPTS:-D%=%); do \\r
-               echo $$i; \\r
-       done\r
-       @echo --------------------------------------\r
 \r
-showtarget:\r
-       @echo\r
-       @echo --------- Target Information ---------\r
-       @echo AVR Model: $(MCU)\r
-       @echo Board:     $(BOARD)\r
-       @echo Clock:     $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master\r
-       @echo --------------------------------------\r
-       \r
 \r
 # Display compiler version information.\r
-gccversion : \r
+gccversion :\r
        @$(CC) --version\r
 \r
 \r
-# Program the device.  \r
+# Program the device.\r
 program: $(TARGET).hex $(TARGET).eep\r
        $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)\r
 \r
@@ -542,7 +525,7 @@ flip: $(TARGET).hex
 \r
 dfu: $(TARGET).hex\r
        dfu-programmer $(MCU) erase\r
-       dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex\r
+       dfu-programmer $(MCU) flash $(TARGET).hex\r
        dfu-programmer $(MCU) reset\r
 \r
 flip-ee: $(TARGET).hex $(TARGET).eep\r
@@ -553,14 +536,14 @@ flip-ee: $(TARGET).hex $(TARGET).eep
        $(REMOVE) $(TARGET)eep.hex\r
 \r
 dfu-ee: $(TARGET).hex $(TARGET).eep\r
-       dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep\r
+       dfu-programmer $(MCU) eeprom-flash $(TARGET).eep\r
        dfu-programmer $(MCU) reset\r
 \r
 \r
 # Generate avr-gdb config/init file which does the following:\r
-#     define the reset signal, load the target file, connect to target, and set \r
+#     define the reset signal, load the target file, connect to target, and set\r
 #     a breakpoint at main().\r
-gdb-config: \r
+gdb-config:\r
        @$(REMOVE) $(GDBINIT_FILE)\r
        @echo define reset >> $(GDBINIT_FILE)\r
        @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)\r
@@ -614,7 +597,7 @@ extcoff: $(TARGET).elf
 %.hex: %.elf\r
        @echo\r
        @echo $(MSG_FLASH) $@\r
-       $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@\r
+       $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@\r
 \r
 %.eep: %.elf\r
        @echo\r
@@ -626,7 +609,7 @@ extcoff: $(TARGET).elf
 %.lss: %.elf\r
        @echo\r
        @echo $(MSG_EXTENDED_LISTING) $@\r
-       $(OBJDUMP) -h -z -S $< > $@\r
+       $(OBJDUMP) -h -S -z $< > $@\r
 \r
 # Create a symbol table from ELF output file.\r
 %.sym: %.elf\r
@@ -658,14 +641,14 @@ extcoff: $(TARGET).elf
 $(OBJDIR)/%.o : %.c\r
        @echo\r
        @echo $(MSG_COMPILING) $<\r
-       $(CC) -c $(ALL_CFLAGS) $< -o $@ \r
+       $(CC) -c $(ALL_CFLAGS) $< -o $@\r
 \r
 \r
 # Compile: create object files from C++ source files.\r
 $(OBJDIR)/%.o : %.cpp\r
        @echo\r
        @echo $(MSG_COMPILING_CPP) $<\r
-       $(CC) -c $(ALL_CPPFLAGS) $< -o $@ \r
+       $(CC) -c $(ALL_CPPFLAGS) $< -o $@\r
 \r
 \r
 # Compile: create assembler files from C source files.\r
@@ -687,30 +670,27 @@ $(OBJDIR)/%.o : %.S
 \r
 # Create preprocessed source for use in sending a bug report.\r
 %.i : %.c\r
-       $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ \r
-       \r
+       $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@\r
+\r
 \r
 # Target: clean project.\r
-clean: begin clean_list clean_binary end\r
+clean: begin clean_list end\r
 \r
-clean_binary:\r
-       $(REMOVE) $(TARGET).hex\r
-       \r
-clean_list:\r
+clean_list :\r
+       @echo\r
        @echo $(MSG_CLEANING)\r
+       $(REMOVE) $(TARGET).hex\r
        $(REMOVE) $(TARGET).eep\r
-       $(REMOVE) $(TARGET)eep.hex\r
        $(REMOVE) $(TARGET).cof\r
        $(REMOVE) $(TARGET).elf\r
        $(REMOVE) $(TARGET).map\r
        $(REMOVE) $(TARGET).sym\r
        $(REMOVE) $(TARGET).lss\r
-       $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)\r
-       $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)\r
+       $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)\r
+       $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)\r
        $(REMOVE) $(SRC:.c=.s)\r
        $(REMOVE) $(SRC:.c=.d)\r
        $(REMOVE) $(SRC:.c=.i)\r
-       $(REMOVE) InvalidEvents.tmp\r
        $(REMOVEDIR) .dep\r
 \r
 doxygen:\r
@@ -730,8 +710,8 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
 \r
 \r
 # Listing of phony targets.\r
-.PHONY : all checkinvalidevents showliboptions    \\r
-showtarget begin finish end sizebefore sizeafter  \\r
-gccversion build elf hex eep lss sym coff extcoff \\r
-program dfu flip flip-ee dfu-ee clean debug       \\r
-clean_list clean_binary gdb-config doxygen
\ No newline at end of file
+.PHONY : all begin finish end sizebefore sizeafter gccversion \\r
+build elf hex eep lss sym coff extcoff doxygen clean          \\r
+clean_list clean_doxygen program dfu flip flip-ee dfu-ee      \\r
+debug gdb-config\r
+\r