3 # Released into the public domain.
5 # dean [at] fourwalledcubicle [dot] com
6 # www.fourwalledcubicle.com
9 DMBS_BUILD_MODULES
+= CORE
10 DMBS_BUILD_TARGETS
+= help list_targets list_modules list_mandatory list_optional list_provided list_macros
11 DMBS_BUILD_MANDATORY_VARS
+=
12 DMBS_BUILD_OPTIONAL_VARS
+=
13 DMBS_BUILD_PROVIDED_VARS
+= DMBS_VERSION
14 DMBS_BUILD_PROVIDED_MACROS
+=
18 # Current DMBS release version
21 # Converts a given input to a printable output using "(None)" if no items are in the list
22 CONVERT_TO_PRINTABLE
= $(if
$(strip $(1)), $(1), (None
))
24 # Build sorted and filtered lists of the included build module data
25 SORTED_DMBS_BUILD_MODULES
= $(sort $(DMBS_BUILD_MODULES
))
26 SORTED_DMBS_BUILD_TARGETS
= $(sort $(DMBS_BUILD_TARGETS
))
27 SORTED_DMBS_MANDATORY_VARS
= $(sort $(DMBS_BUILD_MANDATORY_VARS
))
28 SORTED_DMBS_OPTIONAL_VARS
= $(filter-out $(SORTED_DMBS_MANDATORY_VARS
), $(sort $(DMBS_BUILD_OPTIONAL_VARS
)))
29 SORTED_DMBS_PROVIDED_VARS
= $(sort $(DMBS_BUILD_PROVIDED_VARS
))
30 SORTED_DMBS_PROVIDED_MACROS
= $(sort $(DMBS_BUILD_PROVIDED_MACROS
))
32 # Create printable versions of the sorted build module data (use "(None)" when no data is available)
33 PRINTABLE_DMBS_BUILD_MODULES
= $(call CONVERT_TO_PRINTABLE
, $(SORTED_DMBS_BUILD_MODULES
))
34 PRINTABLE_DMBS_BUILD_TARGETS
= $(call CONVERT_TO_PRINTABLE
, $(SORTED_DMBS_BUILD_TARGETS
))
35 PRINTABLE_DMBS_MANDATORY_VARS
= $(call CONVERT_TO_PRINTABLE
, $(SORTED_DMBS_MANDATORY_VARS
))
36 PRINTABLE_DMBS_OPTIONAL_VARS
= $(call CONVERT_TO_PRINTABLE
, $(SORTED_DMBS_OPTIONAL_VARS
))
37 PRINTABLE_DMBS_PROVIDED_VARS
= $(call CONVERT_TO_PRINTABLE
, $(SORTED_DMBS_PROVIDED_VARS
))
38 PRINTABLE_DMBS_PROVIDED_MACROS
= $(call CONVERT_TO_PRINTABLE
, $(SORTED_DMBS_PROVIDED_MACROS
))
41 @echo
"==================================================================="
42 @echo
" The DMBS Build System "
43 @echo
" By Dean Camera { dean @ fourwalledcubicle . com } "
44 @echo
"==================================================================="
46 @echo
" This build system is a set of makefile modules for (GNU) Make, to "
47 @echo
" provide a simple system for building DMBS powered applications. "
48 @echo
" Each makefile module can be included from within a user makefile, "
49 @echo
" to expose the build rules documented in the comments at the top of"
50 @echo
" each build module. "
53 @echo
" To execute a rule, define all variables indicated in the desired "
54 @echo
" module as a required parameter before including the build module "
55 @echo
" in your project makefile. Parameters marked as optional will "
56 @echo
" assume a default value in the modules if not user-assigned. "
58 @echo
" By default the target output shows both a friendly summary, as "
59 @echo
" well as the actual invoked command. To suppress the output of the "
60 @echo
" invoked commands and show only the friendly command output, run "
61 @echo
" make with the \"-s\" switch added before the target(s). "
62 @echo
"==================================================================="
64 @echo
" Currently used build system modules in this application: "
66 @printf
" %b" "$(PRINTABLE_DMBS_BUILD_MODULES:%= - %\n)"
69 @echo
" Currently available build targets in this application: "
71 @printf
" %b" "$(PRINTABLE_DMBS_BUILD_TARGETS:%= - %\n)"
74 @echo
" Mandatory variables required by the selected build Modules: "
76 @printf
" %b" "$(PRINTABLE_DMBS_MANDATORY_VARS:%= - %\n)"
79 @echo
" Optional variables required by the selected build Modules: "
81 @printf
" %b" "$(PRINTABLE_DMBS_OPTIONAL_VARS:%= - %\n)"
84 @echo
" Variables provided by the selected build Modules: "
86 @printf
" %b" "$(PRINTABLE_DMBS_PROVIDED_VARS:%= - %\n)"
89 @echo
" Macros provided by the selected build Modules: "
91 @printf
" %b" "$(PRINTABLE_DMBS_PROVIDED_MACROS:%= - %\n)"
93 @echo
"==================================================================="
94 @echo
" The DMBS Build System $(DMBS_VERSION) - Making MAKE easier."
95 @echo
"==================================================================="
97 # Lists build modules included by the project makefile, in alphabetical order
99 @echo Currently Used Build System Modules
:
100 @printf
" %b" "$(PRINTABLE_DMBS_BUILD_MODULES:%= - %\n)"
102 # Lists build targets included by the project makefile, in alphabetical order
104 @echo Currently Available Build Targets
:
105 @printf
" %b" "$(PRINTABLE_DMBS_BUILD_TARGETS:%= - %\n)"
107 # Lists mandatory variables that must be set by the project makefile, in alphabetical order
109 @echo Mandatory Variables for Included Modules
:
110 @printf
" %b" "$(PRINTABLE_DMBS_MANDATORY_VARS:%= - %\n)"
112 # Lists optional variables that must be set by the project makefile, in alphabetical order
114 @echo Optional Variables for Included Modules
:
115 @printf
" %b" "$(PRINTABLE_DMBS_OPTIONAL_VARS:%= - %\n)"
117 # Lists variables provided by the included build modules, in alphabetical order
119 @echo Variables Provided by the Included Modules
:
120 @printf
" %b" "$(PRINTABLE_DMBS_PROVIDED_VARS:%= - %\n)"
122 # Lists macros provided by the included build modules, in alphabetical order
124 @echo Macros Provided by the Included Modules
:
125 @printf
" %b" "$(PRINTABLE_DMBS_PROVIDED_MACROS:%= - %\n)"
127 # Debugging; "make print-VARNAME" will output the variable VARNAME's value
129 @printf
"%s = %s" $(@
:print-
%=%) $($(@
:print-
%=%))
131 # Disable default in-built make rules (those that are needed are explicitly
132 # defined, and doing so has performance benefits when recursively building)
133 ifeq ($(filter -r
,$(MAKEFLAGS
)),)
138 # Phony build targets for this module
139 .PHONY
: $(DMBS_BUILD_TARGETS
)