Add Python test script using pywinusb for the Class Driver Generic HID Device demo...
[pub/lufa.git] / LUFA / Build / lufa_core.mk
index f44b407..11bf65c 100644 (file)
@@ -1,6 +1,6 @@
 #
 #             LUFA Library
-#     Copyright (C) Dean Camera, 2012.
+#     Copyright (C) Dean Camera, 2013.
 #
 #  dean [at] fourwalledcubicle [dot] com
 #           www.lufa-lib.org
@@ -8,10 +8,10 @@
 
 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 += 
+LUFA_BUILD_MANDATORY_VARS  +=
+LUFA_BUILD_OPTIONAL_VARS   +=
+LUFA_BUILD_PROVIDED_VARS   +=
+LUFA_BUILD_PROVIDED_MACROS +=
 
 # -----------------------------------------------------------------------------
 #               LUFA Core Build System Makefile Module.
@@ -53,26 +53,30 @@ LUFA_BUILD_PROVIDED_MACROS +=
 
 SHELL = /bin/sh
 
+# 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))
+
+
 # Build sorted and filtered lists of the included build module data
-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))
+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))
 
 # Create printable versions of the sorted build module data (use "(None)" when no data is available)
-PRINTABLE_LUFA_BUILD_MODULES   = $(if $(strip $(SORTED_LUFA_BUILD_MODULES)), $(SORTED_LUFA_BUILD_MODULES), (None))
-PRINTABLE_LUFA_BUILD_TARGETS   = $(if $(strip $(SORTED_LUFA_BUILD_TARGETS)), $(SORTED_LUFA_BUILD_TARGETS), (None))
-PRINTABLE_LUFA_MANDATORY_VARS  = $(if $(strip $(SORTED_LUFA_MANDATORY_VARS)), $(SORTED_LUFA_MANDATORY_VARS), (None))
-PRINTABLE_LUFA_OPTIONAL_VARS   = $(if $(strip $(SORTED_LUFA_OPTIONAL_VARS)), $(SORTED_LUFA_OPTIONAL_VARS), (None))
-PRINTABLE_LUFA_PROVIDED_VARS   = $(if $(strip $(SORTED_LUFA_PROVIDED_VARS)), $(SORTED_LUFA_PROVIDED_VARS), (None))
-PRINTABLE_LUFA_PROVIDED_MACROS = $(if $(strip $(SORTED_LUFA_PROVIDED_MACROS)), $(SORTED_LUFA_PROVIDED_MACROS), (None))
+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))
 
 help:
        @echo "==================================================================="
        @echo "                       LUFA Build System 2.0                       "
-       @echo "      (C) Dean Camera, 2012 { dean @ fourwalledcubicle . com }     "
+       @echo "      (C) Dean Camera, 2013 { dean @ fourwalledcubicle . com }     "
        @echo "==================================================================="
        @echo "DESCRIPTION:                                                       "
        @echo " This build system is a set of makefile modules for (GNU) Make, to "
@@ -81,7 +85,7 @@ help:
        @echo " to expose the build rules documented in the comments at the top of"
        @echo " each build module.                                                "
        @echo "                                                                   "
-       @echo "USAGE:                                                             "     
+       @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      "
@@ -90,7 +94,11 @@ help:
        @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   "
-       @echo " make with the \"-s\" switch added before the target(s).           "             
+       @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.                                            "
        @echo "==================================================================="
        @echo "                                                                   "
        @echo "  Currently used build system modules in this application:         "
@@ -123,29 +131,44 @@ help:
        @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%=   - %\n)"
        @echo "                                                                   "
        @echo "==================================================================="
-       @echo "        The LUFA BuildSystem 2.0 - Powered By Unicorns (tm)        "
+       @echo "   The LUFA BuildSystem 2.0 - Powered By Positive Thinking (tm)    "
        @echo "==================================================================="
-       
+
+# Lists build modules included by the project makefile, in alphabetical order
 list_modules:
-       @echo Currently Used Build System Modules: $(PRINTABLE_LUFA_BUILD_MODULES)
+       @echo Currently Used Build System Modules:
+       @printf " %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%=   - %\n)"
 
+# Lists build targets included by the project makefile, in alphabetical order
 list_targets:
-       @echo Currently Available Build Targets: $(PRINTABLE_LUFA_BUILD_TARGETS)        
+       @echo Currently Available Build Targets:
+       @printf " %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%=   - %\n)"
 
+# Lists mandatory variables that must be set by the project makefile, in alphabetical order
 list_mandatory:
-       @echo Mandatory Variables for Included Modules: $(PRINTABLE_LUFA_MANDATORY_VARS)
-       
+       @echo Mandatory Variables for Included Modules:
+       @printf " %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%=   - %\n)"
+
+# Lists optional variables that must be set by the project makefile, in alphabetical order
 list_optional:
-       @echo Optional Variables for Included Modules: $(PRINTABLE_LUFA_OPTIONAL_VARS)
+       @echo Optional Variables for Included Modules:
+       @printf " %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%=   - %\n)"
 
+# Lists variables provided by the included build modules, in alphabetical order
 list_provided:
-       @echo Variables Provided by the Included Modules: $(PRINTABLE_LUFA_PROVIDED_VARS)
+       @echo Variables Provided by the Included Modules:
+       @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%=   - %\n)"
 
+# Lists macros provided by the included build modules, in alphabetical order
 list_macros:
-       @echo Macros Provided by the Included Modules: $(PRINTABLE_LUFA_PROVIDED_MACROS)
+       @echo Macros Provided by the Included Modules:
+       @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%=   - %\n)"
 
 # Disable default in-built make rules (those that are needed are explicitly
 # defined, and doing so has performance benefits when recursively building)
+ifeq ($(filter -r,$(MAKEFLAGS)),)
+  MAKEFLAGS += -r
+endif
 .SUFFIXES:
 
 # Phony build targets for this module