]> git.donarmstrong.com Git - qmk_firmware.git/blob - lib/lufa/Maintenance/makefile
ergodox qwerty_code_friendly: add macro keys (#1918)
[qmk_firmware.git] / lib / lufa / Maintenance / makefile
1 #
2 #             LUFA Library
3 #     Copyright (C) Dean Camera, 2017.
4 #
5 #  dean [at] fourwalledcubicle [dot] com
6 #           www.lufa-lib.org
7 #
8
9 # Maintenance scripts not required by general LUFA users, used for project development purposes.
10
11
12 # Path to the root of the LUFA tree
13 LUFA_ROOT := ../
14
15 all:
16
17 # Print a list of all filenames and line numbers that exceed an allowed threshold
18 line-lengths:
19         awk '{ if (length > 120) { print FILENAME, ":", FNR, "[", length, "]" } }' `find $(LUFA_ROOT) -name *.[ch]`
20
21 # Generate a header containing all library functions
22 function-list:
23         $(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT))/LUFA doxygen DOXYGEN_OVERRIDE_PARAMS="GENERATE_HTML=no GENERATE_XML=yes"
24         @xsltproc $(patsubst %/,%,$(LUFA_ROOT))/LUFA/Documentation/xml/combine.xslt $(patsubst %/,%,$(LUFA_ROOT))/LUFA/Documentation/xml/index.xml > temp.xml
25         @xsltproc lufa_functionlist_transform.xslt temp.xml > function_list.h
26         @sort function_list.h | uniq > function_list_unique.h
27         @rm temp.xml
28
29 # Update all Doxygen configuration files to the latest Doxygen version
30 upgrade-doxygen:
31         @echo Upgrading Doxygen files...
32         @for doxygen_conf in `find $(LUFA_ROOT) -name doxyfile`; do \
33           doxygen -u $$doxygen_conf;                                \
34         done;
35         @echo Doxygen configuration update complete.
36
37 # Make all possible bootloaders for all targets and configurations as set by the BootloaderTest build test
38 # and store them in a separate directory called "Bootloaders"
39 bootloaders:
40         @echo "build_bootloaders:" > BuildMakefile
41         @printf "\t-mkdir Bootloaders 2>/dev/null\n\n" >> BuildMakefile
42
43         @while read line;                                         \
44          do                                                       \
45            build_cfg=`echo $$line | grep -v "#" | sed 's/ //g'`;  \
46                                                                   \
47            if ( test -n "$$build_cfg" ); then                     \
48              build_bootloader=`echo $$build_cfg | cut -d'=' -f1`; \
49                  build_cfg=`echo $$build_cfg | cut -d'=' -f2-`;       \
50                                                                       \
51              build_arch=`echo $$build_cfg | cut -d':' -f1`;       \
52              build_mcu=`echo $$build_cfg | cut -d':' -f2`;        \
53              build_board=`echo $$build_cfg | cut -d':' -f3`;      \
54              build_flashsize=`echo $$build_cfg | cut -d':' -f4`;  \
55              build_bootsize=`echo $$build_cfg | cut -d':' -f5`;   \
56              build_fusb=`echo $$build_cfg | cut -d':' -f6`;       \
57                                                                   \
58              printf "Found '%s' with FLASH: %3s KB, BOOT: %3s KB, MCU: %12s / %4s, BOARD: %s, F_USB: %sMHz\n" $$build_bootloader $$build_flashsize $$build_bootsize $$build_mcu $$build_arch $$build_board $$build_fusb; \
59                                                                   \
60              printf "\t-mkdir Bootloaders/%s 2>/dev/null\n" $$build_bootloader >> BuildMakefile; \
61              printf "\t@echo Building '%s' with FLASH: %3s KB, BOOT: %3s KB, MCU: %12s, BOARD: %s, F_USB: %sMHz\n" $$build_bootloader $$build_flashsize $$build_bootsize $$build_mcu $$build_board $$build_fusb >> BuildMakefile; \
62              printf "\t$(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT))/Bootloaders/%s/ clean hex ARCH=%s MCU=%s BOARD=%s FLASH_SIZE_KB=%s BOOT_SECTION_SIZE_KB=%s F_USB=%s000000 DEBUG_LEVEL=0\n" $$build_bootloader $$build_arch $$build_mcu $$build_board $$build_flashsize $$build_bootsize $$build_fusb >> BuildMakefile; \
63                  printf "\tmv $(patsubst %/,%,$(LUFA_ROOT))/Bootloaders/%s/Bootloader%s.hex Bootloaders/%s/%s-%s-%s-BOARD_%s-BOOT_%sKB-%sMHz.hex\n\n" $$build_bootloader $$build_bootloader $$build_bootloader $$build_bootloader $$build_arch $$build_mcu $$build_board $$build_bootsize $$build_fusb >> BuildMakefile; \
64            fi;                                                    \
65          done < $(patsubst %/,%,$(LUFA_ROOT))/BuildTests/BootloaderTest/BootloaderDeviceMap.cfg
66
67          $(MAKE) -f BuildMakefile build_bootloaders
68          cp $(patsubst %/,%,$(LUFA_ROOT))/LUFA/License.txt Bootloaders
69          rm -f BuildMakefile
70
71 # Check the working branch documentation, ensure no placeholder values
72 check-documentation-placeholders:
73         @echo Checking for release suitability...
74         @if ( grep " LUFA_VERSION_RELEASE_TYPE " $(patsubst %/,%,$(LUFA_ROOT))/LUFA/Version.h | grep "LUFA_VERSION_RELEASE_TYPE_DEVELOPMENT" > /dev/null ;); then          \
75           echo "  ERROR: Version header has not been updated for release!";           \
76           exit 1;                                                                     \
77         fi;
78         @if ( grep "XXXXXX" $(patsubst %/,%,$(LUFA_ROOT))/LUFA/DoxygenPages/*.txt > /dev/null ;); then \
79           echo "  ERROR: Doxygen documentation has not been updated for release!";    \
80           exit 1;                                                                     \
81         fi;
82         @echo Done.
83
84 # Validate the working branch - compile all documentation, demos/projects/examples and run build tests
85 validate-branch:
86         $(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT)) doxygen
87         $(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT)) all DEBUG_LEVEL=0
88         $(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT))/BuildTests all
89
90 # Validate the working branch for general release, check for placeholder documentation then build and test everything
91 validate-release: check-documentation-placeholders validate-branch
92
93
94 .PHONY: all upgrade-doxygen bootloaders check-documentation-placeholders validate-branch