upload
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

lufa_core.mk 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. #
  2. # LUFA Library
  3. # Copyright (C) Dean Camera, 2014.
  4. #
  5. # dean [at] fourwalledcubicle [dot] com
  6. # www.lufa-lib.org
  7. #
  8. LUFA_BUILD_MODULES += CORE
  9. LUFA_BUILD_TARGETS += help list_targets list_modules list_mandatory list_optional list_provided list_macros
  10. LUFA_BUILD_MANDATORY_VARS +=
  11. LUFA_BUILD_OPTIONAL_VARS +=
  12. LUFA_BUILD_PROVIDED_VARS +=
  13. LUFA_BUILD_PROVIDED_MACROS +=
  14. # -----------------------------------------------------------------------------
  15. # LUFA Core Build System Makefile Module.
  16. # -----------------------------------------------------------------------------
  17. # DESCRIPTION:
  18. # Provides a set of core build targets for the LUFA build system
  19. # -----------------------------------------------------------------------------
  20. # TARGETS:
  21. #
  22. # help - Build system help
  23. # list_targets - List all build targets
  24. # list_modules - List all build modules
  25. # list_mandatory - List all mandatory make variables required by
  26. # the included build modules of the application
  27. # list_optional - List all optional make variables required by
  28. # the included build modules of the application
  29. # list_provided - List all provided make variables from the
  30. # included build modules of the application
  31. # list_macros - List all provided make macros from the
  32. # included build modules of the application
  33. #
  34. # MANDATORY PARAMETERS:
  35. #
  36. # (None)
  37. #
  38. # OPTIONAL PARAMETERS:
  39. #
  40. # (None)
  41. #
  42. # PROVIDED VARIABLES:
  43. #
  44. # (None)
  45. #
  46. # PROVIDED MACROS:
  47. #
  48. # (None)
  49. #
  50. # -----------------------------------------------------------------------------
  51. SHELL = /bin/sh
  52. # Converts a given input to a printable output using "(None)" if no items are in the list
  53. CONVERT_TO_PRINTABLE = $(if $(strip $(1)), $(1), (None))
  54. # Build sorted and filtered lists of the included build module data
  55. SORTED_LUFA_BUILD_MODULES = $(sort $(LUFA_BUILD_MODULES))
  56. SORTED_LUFA_BUILD_TARGETS = $(sort $(LUFA_BUILD_TARGETS))
  57. SORTED_LUFA_MANDATORY_VARS = $(sort $(LUFA_BUILD_MANDATORY_VARS))
  58. SORTED_LUFA_OPTIONAL_VARS = $(filter-out $(SORTED_LUFA_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS)))
  59. SORTED_LUFA_PROVIDED_VARS = $(sort $(LUFA_BUILD_PROVIDED_VARS))
  60. SORTED_LUFA_PROVIDED_MACROS = $(sort $(LUFA_BUILD_PROVIDED_MACROS))
  61. # Create printable versions of the sorted build module data (use "(None)" when no data is available)
  62. PRINTABLE_LUFA_BUILD_MODULES = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_BUILD_MODULES))
  63. PRINTABLE_LUFA_BUILD_TARGETS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_BUILD_TARGETS))
  64. PRINTABLE_LUFA_MANDATORY_VARS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_MANDATORY_VARS))
  65. PRINTABLE_LUFA_OPTIONAL_VARS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_OPTIONAL_VARS))
  66. PRINTABLE_LUFA_PROVIDED_VARS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_PROVIDED_VARS))
  67. PRINTABLE_LUFA_PROVIDED_MACROS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_PROVIDED_MACROS))
  68. help:
  69. @echo "==================================================================="
  70. @echo " LUFA Build System 2.0 "
  71. @echo " (C) Dean Camera, 2014 { dean @ fourwalledcubicle . com } "
  72. @echo "==================================================================="
  73. @echo "DESCRIPTION: "
  74. @echo " This build system is a set of makefile modules for (GNU) Make, to "
  75. @echo " provide a simple system for building LUFA powered applications. "
  76. @echo " Each makefile module can be included from within a user makefile, "
  77. @echo " to expose the build rules documented in the comments at the top of"
  78. @echo " each build module. "
  79. @echo " "
  80. @echo "USAGE: "
  81. @echo " To execute a rule, define all variables indicated in the desired "
  82. @echo " module as a required parameter before including the build module "
  83. @echo " in your project makefile. Parameters marked as optional will "
  84. @echo " assume a default value in the modules if not user-assigned. "
  85. @echo " "
  86. @echo " By default the target output shows both a friendly summary, as "
  87. @echo " well as the actual invoked command. To suppress the output of the "
  88. @echo " invoked commands and show only the friendly command output, run "
  89. @echo " make with the \"-s\" switch added before the target(s). "
  90. @echo " "
  91. @echo "SEE ALSO: "
  92. @echo " For more information, see the 'Build System' chapter of the LUFA "
  93. @echo " project documentation. "
  94. @echo "==================================================================="
  95. @echo " "
  96. @echo " Currently used build system modules in this application: "
  97. @echo " "
  98. @printf " %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%= - %\n)"
  99. @echo " "
  100. @echo " "
  101. @echo " Currently available build targets in this application: "
  102. @echo " "
  103. @printf " %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%= - %\n)"
  104. @echo " "
  105. @echo " "
  106. @echo " Mandatory variables required by the selected build Modules: "
  107. @echo " "
  108. @printf " %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%= - %\n)"
  109. @echo " "
  110. @echo " "
  111. @echo " Optional variables required by the selected build Modules: "
  112. @echo " "
  113. @printf " %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%= - %\n)"
  114. @echo " "
  115. @echo " "
  116. @echo " Variables provided by the selected build Modules: "
  117. @echo " "
  118. @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%= - %\n)"
  119. @echo " "
  120. @echo " "
  121. @echo " Macros provided by the selected build Modules: "
  122. @echo " "
  123. @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%= - %\n)"
  124. @echo " "
  125. @echo "==================================================================="
  126. @echo " The LUFA BuildSystem 2.0 - Powered By Positive Thinking (tm) "
  127. @echo "==================================================================="
  128. # Lists build modules included by the project makefile, in alphabetical order
  129. list_modules:
  130. @echo Currently Used Build System Modules:
  131. @printf " %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%= - %\n)"
  132. # Lists build targets included by the project makefile, in alphabetical order
  133. list_targets:
  134. @echo Currently Available Build Targets:
  135. @printf " %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%= - %\n)"
  136. # Lists mandatory variables that must be set by the project makefile, in alphabetical order
  137. list_mandatory:
  138. @echo Mandatory Variables for Included Modules:
  139. @printf " %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%= - %\n)"
  140. # Lists optional variables that must be set by the project makefile, in alphabetical order
  141. list_optional:
  142. @echo Optional Variables for Included Modules:
  143. @printf " %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%= - %\n)"
  144. # Lists variables provided by the included build modules, in alphabetical order
  145. list_provided:
  146. @echo Variables Provided by the Included Modules:
  147. @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%= - %\n)"
  148. # Lists macros provided by the included build modules, in alphabetical order
  149. list_macros:
  150. @echo Macros Provided by the Included Modules:
  151. @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%= - %\n)"
  152. # Disable default in-built make rules (those that are needed are explicitly
  153. # defined, and doing so has performance benefits when recursively building)
  154. ifeq ($(filter -r,$(MAKEFLAGS)),)
  155. MAKEFLAGS += -r
  156. endif
  157. .SUFFIXES:
  158. # Phony build targets for this module
  159. .PHONY: help list_modules list_targets list_mandatory list_optional list_provided list_macros