3 # Copyright (C) Dean Camera, 2012.
5 # dean [at] fourwalledcubicle [dot] com
9 # Maintenance scripts not required by general LUFA users, used for project development purposes.
12 # Path to the root of the LUFA tree
17 # Update all Doxygen configuration files to the latest Doxygen version - force Markdown support to be disabled
19 @echo Upgrading Doxygen.conf files...
20 @for doxygen_conf in `find $(LUFA_ROOT) -name Doxygen.conf`; do \
21 doxygen -u $$doxygen_conf; \
22 sed "s/MARKDOWN_SUPPORT *= *YES/MARKDOWN_SUPPORT = NO/1" $$doxygen_conf > $$doxygen_conf.new; \
23 sed "s/DISABLE_INDEX *= *NO/DISABLE_INDEX = YES/1" $$doxygen_conf.new > $$doxygen_conf.new2; \
24 mv -u $$doxygen_conf.new2 $$doxygen_conf; \
25 rm $$doxygen_conf.new; \
27 @echo Doxygen configuration update complete.
29 # Generate AVR Studio 4 project files for each project from a template
31 @echo Creating AVR Studio 4 project files for Demos...
32 @for project_makefile in `find $(LUFA_ROOT)/Demos $(LUFA_ROOT)/Projects $(LUFA_ROOT)/Bootloaders -name makefile*`; do \
33 target_name=`grep "TARGET *=" $$project_makefile | cut -d'=' -f2 | sed 's/ //g'`; \
34 target_folder=`dirname $$project_makefile`; \
35 as4_date=`date "+%-e-%b-%Y %-H:%-M:%-S"`; \
37 if ( test -n "$$target_name" ); then \
38 echo Creating AS4 project for project $$target_name; \
40 source_files="<OTHERFILE>`basename $$project_makefile`<\/OTHERFILE>"; \
41 gcc_source_files=""; \
42 for c_source_file in `find $$target_folder -name *.c`; do \
43 source_filename=`basename $$c_source_file`; \
45 source_files="$$source_files<SOURCEFILE>$$source_filename<\/SOURCEFILE>"; \
46 gcc_source_files="$$gcc_source_files<Name>$$source_filename<\/Name>"; \
48 for c_header_file in `find $$target_folder -name *.h`; do \
49 source_filename=`basename $$c_header_file`; \
51 source_files="$$source_files<HEADERFILE>$$source_filename<\/HEADERFILE>"; \
52 gcc_source_files="$$gcc_source_files<Name>$$source_filename<\/Name>"; \
54 for assembly_file in `find $$target_folder -name *.S`; do \
55 source_filename=`basename $$assembly_file`; \
57 source_files="$$source_files<OTHERFILE>$$source_filename<\/OTHERFILE>"; \
58 gcc_source_files="$$gcc_source_files<Name>$$source_filename<\/Name>"; \
61 sed "s/%TARGET%/$$target_name/g" AS4Template.aps > $$target_folder/$$target_name.aps.new; \
62 sed "s/%CREATED%/$$as4_date/g" $$target_folder/$$target_name.aps.new > $$target_folder/$$target_name.aps.new2; \
63 sed "s/%FILE_LIST%/$$source_files/g" $$target_folder/$$target_name.aps.new2 > $$target_folder/$$target_name.aps.new3; \
64 sed "s/%GCC_FILE_LIST%/$$gcc_source_files/g" $$target_folder/$$target_name.aps.new3 > $$target_folder/$$target_name.aps.new4; \
65 mv $$target_folder/$$target_name.aps.new4 $$target_folder/$$target_name.aps; \
66 rm $$target_folder/$$target_name.aps.new $$target_folder/$$target_name.aps.new2 $$target_folder/$$target_name.aps.new3; \
69 @echo AVR Studio 4 project generation complete.
71 # Make all possible bootloaders for all targets and configurations as set by the BootloaderTest build test
72 # and store them in a seperate directory called "Bootloaders"
74 # FIXME: Currently ignores the architecture when deciding on F_USB choices; when more architectures are
75 # avaliable as bootloaders, add some additional entries to the bootloader map for F_USB.
77 @echo "build_bootloaders:" > BuildMakefile
78 @printf "\t-mkdir Bootloaders 2>/dev/null\n\n" >> BuildMakefile
82 build_cfg=`echo $$line | grep -v "#" | sed 's/ //g'`; \
84 if ( test -n "$$build_cfg" ); then \
85 build_bootloader=`echo $$build_cfg | cut -d'=' -f1`; \
86 build_cfg=`echo $$build_cfg | cut -d'=' -f2-`; \
88 build_arch=`echo $$build_cfg | cut -d':' -f1`; \
89 build_mcu=`echo $$build_cfg | cut -d':' -f2`; \
90 build_board=`echo $$build_cfg | cut -d':' -f3`; \
91 build_flashsize=`echo $$build_cfg | cut -d':' -f4`; \
92 build_bootsize=`echo $$build_cfg | cut -d':' -f5`; \
94 printf "Found '%s' with FLASH: %3s KB, BOOT: %3s KB, MCU: %12s / %4s, BOARD: %s\n" $$build_bootloader $$build_flashsize $$build_bootsize $$build_mcu $$build_arch $$build_board; \
96 printf "\t@echo Building '%s' with FLASH: %3s KB, BOOT: %3s KB, MCU: %12s, F_USB: 8MHz, BOARD: %s\n" $$build_bootloader $$build_flashsize $$build_bootsize $$build_mcu $$build_board >> BuildMakefile; \
97 printf "\t$(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT))/Bootloaders/%s/ clean hex F_USB=8000000 ARCH=%s MCU=%s BOARD=%s FLASH_SIZE_KB=%s BOOT_SECTION_SIZE_KB=%s DEBUG_LEVEL=0\n" $$build_bootloader $$build_arch $$build_mcu $$build_board $$build_flashsize $$build_bootsize >> BuildMakefile; \
98 printf "\tmv $(patsubst %/,%,$(LUFA_ROOT))/Bootloaders/%s/Bootloader%s.hex Bootloaders/%s-%s-%s-BOARD_%s-BOOT_%sKB_8MHz.hex\n\n" $$build_bootloader $$build_bootloader $$build_bootloader $$build_arch $$build_mcu $$build_board $$build_bootsize >> BuildMakefile; \
100 printf "\t@echo Building '%s' with FLASH: %3s KB, BOOT: %3s KB, MCU: %12s, F_USB: 16MHz, BOARD: %s\n" $$build_bootloader $$build_flashsize $$build_bootsize $$build_mcu $$build_board >> BuildMakefile; \
101 printf "\t$(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT))/Bootloaders/%s/ clean hex F_USB=16000000 ARCH=%s MCU=%s BOARD=%s FLASH_SIZE_KB=%s BOOT_SECTION_SIZE_KB=%s DEBUG_LEVEL=0\n" $$build_bootloader $$build_arch $$build_mcu $$build_board $$build_flashsize $$build_bootsize >> BuildMakefile; \
102 printf "\tmv $(patsubst %/,%,$(LUFA_ROOT))/Bootloaders/%s/Bootloader%s.hex Bootloaders/%s-%s-%s-BOARD_%s-BOOT_%sKB_16MHz.hex\n\n" $$build_bootloader $$build_bootloader $$build_bootloader $$build_arch $$build_mcu $$build_board $$build_bootsize >> BuildMakefile; \
104 done < $(patsubst %/,%,$(LUFA_ROOT))/BuildTests/BootloaderTest/BootloaderDeviceMap.cfg
106 $(MAKE) -f BuildMakefile build_bootloaders
107 cp $(patsubst %/,%,$(LUFA_ROOT))/LUFA/License.txt Bootloaders
110 # Check the working branch documentation, ensure no placeholder values
111 check-documentation-placeholders:
112 @echo Checking for release suitability...
113 @if ( grep "XXXXXX" $(patsubst %/,%,$(LUFA_ROOT))/LUFA/DoxygenPages/*.txt > /dev/null ;); then \
114 echo " ERROR: Doxygen documentation has not been updated for release!"; \
117 @if ( grep "000000" $(patsubst %/,%,$(LUFA_ROOT))/LUFA/Version.h > /dev/null ;); then \
118 echo " ERROR: Version header has not been updated for release!"; \
123 # Validate the working branch - compile all documentation, demos/projects/examples and run build tests
125 $(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT)) doxygen
126 $(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT)) all DEBUG_LEVEL=0
127 $(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT))/BuildTests all
129 # Validate the working branch for general release, check for placeholder documentation then build and test everything
130 validate-release: check-documentation-placeholders validate-branch
133 .PHONY: all upgrade-doxygen make-as4-projects make_bootloaders check-documentation-placeholders validate-branch