makefile 5.2 KB

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