3 # Copyright (C) Dean Camera, 2013.
5 # dean [at] fourwalledcubicle [dot] com
9 LUFA_BUILD_MODULES
+= CORE
10 LUFA_BUILD_TARGETS
+= help list_targets list_modules list_mandatory list_optional list_provided list_macros
11 LUFA_BUILD_MANDATORY_VARS
+=
12 LUFA_BUILD_OPTIONAL_VARS
+=
13 LUFA_BUILD_PROVIDED_VARS
+=
14 LUFA_BUILD_PROVIDED_MACROS
+=
16 # -----------------------------------------------------------------------------
17 # LUFA Core Build System Makefile Module.
18 # -----------------------------------------------------------------------------
20 # Provides a set of core build targets for the LUFA build system
21 # -----------------------------------------------------------------------------
24 # help - Build system help
25 # list_targets - List all build targets
26 # list_modules - List all build modules
27 # list_mandatory - List all mandatory make variables required by
28 # the included build modules of the application
29 # list_optional - List all optional make variables required by
30 # the included build modules of the application
31 # list_provided - List all provided make variables from the
32 # included build modules of the application
33 # list_macros - List all provided make macros from the
34 # included build modules of the application
36 # MANDATORY PARAMETERS:
40 # OPTIONAL PARAMETERS:
52 # -----------------------------------------------------------------------------
56 # Converts a given input to a printable output using "(None)" if no items are in the list
57 CONVERT_TO_PRINTABLE
= $(if
$(strip $(1)), $(1), (None
))
60 # Build sorted and filtered lists of the included build module data
61 SORTED_LUFA_BUILD_MODULES
= $(sort $(LUFA_BUILD_MODULES
))
62 SORTED_LUFA_BUILD_TARGETS
= $(sort $(LUFA_BUILD_TARGETS
))
63 SORTED_LUFA_MANDATORY_VARS
= $(sort $(LUFA_BUILD_MANDATORY_VARS
))
64 SORTED_LUFA_OPTIONAL_VARS
= $(filter-out $(SORTED_LUFA_MANDATORY_VARS
), $(sort $(LUFA_BUILD_OPTIONAL_VARS
)))
65 SORTED_LUFA_PROVIDED_VARS
= $(sort $(LUFA_BUILD_PROVIDED_VARS
))
66 SORTED_LUFA_PROVIDED_MACROS
= $(sort $(LUFA_BUILD_PROVIDED_MACROS
))
68 # Create printable versions of the sorted build module data (use "(None)" when no data is available)
69 PRINTABLE_LUFA_BUILD_MODULES
= $(call CONVERT_TO_PRINTABLE
, $(SORTED_LUFA_BUILD_MODULES
))
70 PRINTABLE_LUFA_BUILD_TARGETS
= $(call CONVERT_TO_PRINTABLE
, $(SORTED_LUFA_BUILD_TARGETS
))
71 PRINTABLE_LUFA_MANDATORY_VARS
= $(call CONVERT_TO_PRINTABLE
, $(SORTED_LUFA_MANDATORY_VARS
))
72 PRINTABLE_LUFA_OPTIONAL_VARS
= $(call CONVERT_TO_PRINTABLE
, $(SORTED_LUFA_OPTIONAL_VARS
))
73 PRINTABLE_LUFA_PROVIDED_VARS
= $(call CONVERT_TO_PRINTABLE
, $(SORTED_LUFA_PROVIDED_VARS
))
74 PRINTABLE_LUFA_PROVIDED_MACROS
= $(call CONVERT_TO_PRINTABLE
, $(SORTED_LUFA_PROVIDED_MACROS
))
77 @echo
"==================================================================="
78 @echo
" LUFA Build System 2.0 "
79 @echo
" (C) Dean Camera, 2013 { dean @ fourwalledcubicle . com } "
80 @echo
"==================================================================="
82 @echo
" This build system is a set of makefile modules for (GNU) Make, to "
83 @echo
" provide a simple system for building LUFA powered applications. "
84 @echo
" Each makefile module can be included from within a user makefile, "
85 @echo
" to expose the build rules documented in the comments at the top of"
86 @echo
" each build module. "
89 @echo
" To execute a rule, define all variables indicated in the desired "
90 @echo
" module as a required parameter before including the build module "
91 @echo
" in your project makefile. Parameters marked as optional will "
92 @echo
" assume a default value in the modules if not user-assigned. "
94 @echo
" By default the target output shows both a friendly summary, as "
95 @echo
" well as the actual invoked command. To suppress the output of the "
96 @echo
" invoked commands and show only the friendly command output, run "
97 @echo
" make with the \"-s\" switch added before the target(s). "
100 @echo
" For more information, see the 'Build System' chapter of the LUFA "
101 @echo
" project documentation. "
102 @echo
"==================================================================="
104 @echo
" Currently used build system modules in this application: "
106 @printf
" %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%= - %\n)"
109 @echo
" Currently available build targets in this application: "
111 @printf
" %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%= - %\n)"
114 @echo
" Mandatory variables required by the selected build Modules: "
116 @printf
" %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%= - %\n)"
119 @echo
" Optional variables required by the selected build Modules: "
121 @printf
" %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%= - %\n)"
124 @echo
" Variables provided by the selected build Modules: "
126 @printf
" %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%= - %\n)"
129 @echo
" Macros provided by the selected build Modules: "
131 @printf
" %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%= - %\n)"
133 @echo
"==================================================================="
134 @echo
" The LUFA BuildSystem 2.0 - Powered By Duct Tape (tm) "
135 @echo
"==================================================================="
137 # Lists build modules included by the project makefile, in alphabetical order
139 @echo Currently Used Build System Modules
:
140 @printf
" %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%= - %\n)"
142 # Lists build targets included by the project makefile, in alphabetical order
144 @echo Currently Available Build Targets
:
145 @printf
" %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%= - %\n)"
147 # Lists mandatory variables that must be set by the project makefile, in alphabetical order
149 @echo Mandatory Variables for Included Modules
:
150 @printf
" %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%= - %\n)"
152 # Lists optional variables that must be set by the project makefile, in alphabetical order
154 @echo Optional Variables for Included Modules
:
155 @printf
" %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%= - %\n)"
157 # Lists variables provided by the included build modules, in alphabetical order
159 @echo Variables Provided by the Included Modules
:
160 @printf
" %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%= - %\n)"
162 # Lists macros provided by the included build modules, in alphabetical order
164 @echo Macros Provided by the Included Modules
:
165 @printf
" %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%= - %\n)"
167 # Disable default in-built make rules (those that are needed are explicitly
168 # defined, and doing so has performance benefits when recursively building)
171 # Phony build targets for this module
172 .PHONY
: help list_modules list_targets list_mandatory list_optional list_provided list_macros