diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -56,6 +56,11 @@ PROGRAM_LST = $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).lst # Finds the directory in which this BSP is located, ensuring that there is # exactly one. BSP_DIR := $(wildcard $(TARGET_ROOT)/bsp/$(TARGET)) + +# Only perform these error checks and include the standalone.mk fragment +# if we're not processing one of the "list-" targets +ifneq ($@,$(filter $@, list-targets list-target-tags list-programs list-options)) + ifeq ($(words $(BSP_DIR)),0) $(error Unable to find BSP for $(TARGET), expected to find "bsp/$(TARGET)") endif @@ -77,6 +82,9 @@ endif include scripts/standalone.mk +# End of exclusion when procesinng "list-" targets. +endif + ############################################################# # Prints help message ############################################################# @@ -214,7 +222,11 @@ standalone: \ find $</scripts/elf2hex -name ".git*" | xargs rm -rf +ifeq ($(PORT_DIR),) $(MAKE) -C $(SRC_DIR) clean +else + $(MAKE) -C $(SRC_DIR) PORT_DIR=${PORT_DIR} clean +endif cp -r $(SRC_DIR)/* $</src/ cp debug.mk $</debug.mk @@ -222,7 +234,7 @@ standalone: \ echo "PROGRAM = $(PROGRAM)" > $</Makefile ifneq ($(PORT_DIR),) - echo "PORT_DIR = $(PORT_DIR)" > $</Makefile + echo "PORT_DIR = $(PORT_DIR)" >> $</Makefile endif cat scripts/standalone.mk >> $</Makefile cat scripts/libmetal.mk >> $</Makefile @@ -243,7 +255,11 @@ standalone: \ find $</freedom-metal -name ".git*" | xargs rm -rf +ifeq ($(PORT_DIR),) $(MAKE) -C $(SRC_DIR) clean +else + $(MAKE) -C $(SRC_DIR) PORT_DIR=${PORT_DIR} clean +endif cp -r $(SRC_DIR)/* $</src/ cp debug.mk $</debug.mk @@ -251,7 +267,7 @@ standalone: \ echo "PROGRAM = $(PROGRAM)" > $</Makefile ifneq ($(PORT_DIR),) - echo "PORT_DIR = $(PORT_DIR)" > $</Makefile + echo "PORT_DIR = $(PORT_DIR)" >> $</Makefile endif cat scripts/standalone.mk >> $</Makefile cat scripts/libmetal.mk >> $</Makefile |