lufa_core.mk 8.78 KB
Newer Older
1
2
3
4
5
6
7
8
#
#             LUFA Library
#     Copyright (C) Dean Camera, 2012.
#
#  dean [at] fourwalledcubicle [dot] com
#           www.lufa-lib.org
#

9
10
11
12
13
14
LUFA_BUILD_MODULES         += CORE
LUFA_BUILD_TARGETS         += help list_targets list_modules list_mandatory list_optional list_provided list_macros
LUFA_BUILD_MANDATORY_VARS  += 
LUFA_BUILD_OPTIONAL_VARS   += 
LUFA_BUILD_PROVIDED_VARS   += 
LUFA_BUILD_PROVIDED_MACROS += 
15
16

# -----------------------------------------------------------------------------
17
#               LUFA Core Build System Makefile Module.
18
19
# -----------------------------------------------------------------------------
# DESCRIPTION:
20
#   Provides a set of core build targets for the LUFA build system
21
22
23
24
25
26
27
28
29
30
# -----------------------------------------------------------------------------
# TARGETS:
#
#    help                      - Build system help
#    list_targets              - List all build targets
#    list_modules              - List all build modules
#    list_mandatory            - List all mandatory make variables required by
#                                the included build modules of the application
#    list_optional             - List all optional make variables required by
#                                the included build modules of the application
31
32
33
34
#    list_provided             - List all provided make variables from the
#                                included build modules of the application
#    list_macros               - List all provided make macros from the
#                                included build modules of the application
35
36
37
38
39
40
41
42
43
#
# MANDATORY PARAMETERS:
#
#    (None)
#
# OPTIONAL PARAMETERS:
#
#    (None)
#
44
45
46
47
48
49
50
51
# PROVIDED VARIABLES:
#
#    (None)
#
# PROVIDED MACROS:
#
#    (None)
#
52
53
# -----------------------------------------------------------------------------

54
55
SHELL = /bin/sh

56
57
58
59
# Converts a given input to a printable output using "(None)" if no items are in the list
CONVERT_TO_PRINTABLE           = $(if $(strip $(1)), $(1), (None))


60
# Build sorted and filtered lists of the included build module data
61
62
63
64
65
66
SORTED_LUFA_BUILD_MODULES      = $(sort $(LUFA_BUILD_MODULES))
SORTED_LUFA_BUILD_TARGETS      = $(sort $(LUFA_BUILD_TARGETS))
SORTED_LUFA_MANDATORY_VARS     = $(sort $(LUFA_BUILD_MANDATORY_VARS))
SORTED_LUFA_OPTIONAL_VARS      = $(filter-out $(SORTED_LUFA_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS)))
SORTED_LUFA_PROVIDED_VARS      = $(sort $(LUFA_BUILD_PROVIDED_VARS))
SORTED_LUFA_PROVIDED_MACROS    = $(sort $(LUFA_BUILD_PROVIDED_MACROS))
67

68
# Create printable versions of the sorted build module data (use "(None)" when no data is available)
69
70
71
72
73
74
PRINTABLE_LUFA_BUILD_MODULES   = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_BUILD_MODULES))
PRINTABLE_LUFA_BUILD_TARGETS   = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_BUILD_TARGETS))
PRINTABLE_LUFA_MANDATORY_VARS  = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_MANDATORY_VARS))
PRINTABLE_LUFA_OPTIONAL_VARS   = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_OPTIONAL_VARS))
PRINTABLE_LUFA_PROVIDED_VARS   = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_PROVIDED_VARS))
PRINTABLE_LUFA_PROVIDED_MACROS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_PROVIDED_MACROS))
75

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
help:
	@echo "==================================================================="
	@echo "                       LUFA Build System 2.0                       "
	@echo "      (C) Dean Camera, 2012 { dean @ fourwalledcubicle . com }     "
	@echo "==================================================================="
	@echo "DESCRIPTION:                                                       "
	@echo " This build system is a set of makefile modules for (GNU) Make, to "
	@echo " provide a simple system for building LUFA powered applications.   "
	@echo " Each makefile module can be included from within a user makefile, "
	@echo " to expose the build rules documented in the comments at the top of"
	@echo " each build module.                                                "
	@echo "                                                                   "
	@echo "USAGE:                                                             "	
	@echo " To execute a rule, define all variables indicated in the desired  "
	@echo " module as a required parameter before including the build module  "
	@echo " in your project makefile. Parameters marked as optional will      "
	@echo " assume a default value in the modules if not user-assigned.       "
	@echo "                                                                   "
	@echo " By default the target output shows both a friendly summary, as    "
	@echo " well as the actual invoked command. To suppress the output of the "
	@echo " invoked commands and show only the friendly command output, run   "
97
98
99
100
101
	@echo " make with the \"-s\" switch added before the target(s).           "
	@echo "                                                                   "
	@echo "SEE ALSO:                                                          "	
	@echo " For more information, see the 'Build System' chapter of the LUFA  "
	@echo " project documentation.                                            "
102
	@echo "==================================================================="
103
	@echo "                                                                   "
104
105
	@echo "  Currently used build system modules in this application:         "
	@echo "                                                                   "
106
	@printf " %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%=   - %\n)"
107
108
109
110
	@echo "                                                                   "
	@echo "                                                                   "
	@echo "  Currently available build targets in this application:           "
	@echo "                                                                   "
111
	@printf " %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%=   - %\n)"
112
113
114
115
	@echo "                                                                   "
	@echo "                                                                   "
	@echo "  Mandatory variables required by the selected build Modules:      "
	@echo "                                                                   "
116
	@printf " %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%=   - %\n)"
117
118
119
120
	@echo "                                                                   "
	@echo "                                                                   "
	@echo "  Optional variables required by the selected build Modules:       "
	@echo "                                                                   "
121
	@printf " %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%=   - %\n)"
122
	@echo "                                                                   "
123
124
125
	@echo "                                                                   "
	@echo "  Variables provided by the selected build Modules:                "
	@echo "                                                                   "
126
	@printf " %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%=   - %\n)"
127
128
129
130
	@echo "                                                                   "
	@echo "                                                                   "
	@echo "  Macros provided by the selected build Modules:                   "
	@echo "                                                                   "
131
	@printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%=   - %\n)"
132
	@echo "                                                                   "
133
	@echo "==================================================================="
134
	@echo "        The LUFA BuildSystem 2.0 - Powered By Duct Tape (tm)       "
135
	@echo "==================================================================="
136
137

# Lists build modules included by the project makefile, in alphabetical order
138
list_modules:
139
	@echo Currently Used Build System Modules: $(PRINTABLE_LUFA_BUILD_MODULES)
140

141
# Lists build targets included by the project makefile, in alphabetical order
142
list_targets:
143
	@echo Currently Available Build Targets: $(PRINTABLE_LUFA_BUILD_TARGETS)	
144

145
# Lists mandatory variables that must be set by the project makefile, in alphabetical order
146
list_mandatory:
147
	@echo Mandatory Variables for Included Modules: $(PRINTABLE_LUFA_MANDATORY_VARS)
148
	
149
# Lists optional variables that must be set by the project makefile, in alphabetical order
150
list_optional:
151
	@echo Optional Variables for Included Modules: $(PRINTABLE_LUFA_OPTIONAL_VARS)
152

153
# Lists variables provided by the included build modules, in alphabetical order
154
list_provided:
155
	@echo Variables Provided by the Included Modules: $(PRINTABLE_LUFA_PROVIDED_VARS)
156

157
# Lists macros provided by the included build modules, in alphabetical order
158
list_macros:
159
	@echo Macros Provided by the Included Modules: $(PRINTABLE_LUFA_PROVIDED_MACROS)
160

161
162
163
164
165
# Disable default in-built make rules (those that are needed are explicitly
# defined, and doing so has performance benefits when recursively building)
.SUFFIXES:

# Phony build targets for this module
166
.PHONY: help list_modules list_targets list_mandatory list_optional list_provided list_macros