diff options
author | Perry Hung <iperry@alum.mit.edu> | 2010-07-08 22:27:37 -0400 |
---|---|---|
committer | Perry Hung <iperry@alum.mit.edu> | 2010-07-08 22:27:37 -0400 |
commit | 3aa755870aa45004edc848475e361db8b639284a (patch) | |
tree | 5edea0724a7a30520e1424c53b676708a1145b86 /Makefile | |
parent | e20771d28264125586c6cff7cc4a6b4d51e69110 (diff) | |
download | librambutan-3aa755870aa45004edc848475e361db8b639284a.tar.gz librambutan-3aa755870aa45004edc848475e361db8b639284a.zip |
makefile: fix install target
The makefile 'install' target should upload to whatever the last build
target was, regardless of the environment's value of MAPLE_TARGET.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 46 |
1 files changed, 24 insertions, 22 deletions
@@ -9,9 +9,8 @@ BUILD_PATH = build LIBMAPLE_PATH := libmaple # Useful variables -GLOBAL_CFLAGS = -Os -g -mcpu=cortex-m3 -mthumb -march=armv7-m -nostdlib \ - -ffunction-sections -fdata-sections -Wl,--gc-sections - +GLOBAL_CFLAGS := -Os -g -mcpu=cortex-m3 -mthumb -march=armv7-m -nostdlib \ + -ffunction-sections -fdata-sections -Wl,--gc-sections GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions -Wall @@ -24,33 +23,22 @@ LDFLAGS = -T$(LDDIR)/$(LDSCRIPT) -L$(LDDIR) \ include support/make/build-rules.mk include support/make/build-templates.mk -VENDOR_ID = 1EAF -PRODUCT_ID = 0003 - -# Force a rebuild if the maple target changed -PREV_BUILD_TYPE = $(shell cat $(BUILD_PATH)/build-type 2>/dev/null) +# Maple USB id +VENDOR_ID := 1EAF +PRODUCT_ID := 0003 # Some target specific things ifeq ($(MAPLE_TARGET), ram) VECT_BASE_ADDR := VECT_TAB_RAM LDSCRIPT := ram.ld - UPLOAD := support/scripts/reset.py && \ - sleep 1 && \ - $(DFU) -a0 -d $(VENDOR_ID):$(PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R - endif ifeq ($(MAPLE_TARGET), flash) LDSCRIPT := flash.ld VECT_BASE_ADDR := VECT_TAB_FLASH - UPLOAD := support/scripts/reset.py && \ - sleep 1 && \ - $(DFU) -a1 -d $(VENDOR_ID):$(PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R endif ifeq ($(MAPLE_TARGET), jtag) LDSCRIPT := jtag.ld VECT_BASE_ADDR := VECT_TAB_BASE - UPLOAD := \ - openocd -f support/openocd/flash.cfg endif # Set all submodules here @@ -65,9 +53,23 @@ include support/make/build-targets.mk .PHONY: install sketch clean help debug cscope tags ctags ram flash jtag -install: sketch - $(UPLOAD) +# Target upload commands +UPLOAD_ram := support/scripts/reset.py && \ + sleep 1 && \ + $(DFU) -a0 -d $(VENDOR_ID):$(PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R +UPLOAD_flash := support/scripts/reset.py && \ + sleep 1 && \ + $(DFU) -a1 -d $(VENDOR_ID):$(PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R +UPLOAD_jtag := $(OPENOCD) -f support/openocd/flash.cfg + +# conditionally upload to whatever the last build was +install: INSTALL_TARGET = $(shell cat $(BUILD_PATH)/build-type 2>/dev/null) +install: $(BUILD_PATH)/$(BOARD).bin + @echo Install target: $(INSTALL_TARGET) + $(UPLOAD_$(INSTALL_TARGET)) +# Force a rebuild if the maple target changed +PREV_BUILD_TYPE = $(shell cat $(BUILD_PATH)/build-type 2>/dev/null) build-check: ifneq ($(PREV_BUILD_TYPE), $(MAPLE_TARGET)) $(shell rm -rf $(BUILD_PATH)) @@ -113,10 +115,10 @@ ctags: @echo "Made tags file for VIM code browsing" ram: - $(MAKE) MAPLE_TARGET=ram --no-print-directory + @$(MAKE) MAPLE_TARGET=ram --no-print-directory sketch flash: - $(MAKE) MAPLE_TARGET=flash --no-print-directory + @$(MAKE) MAPLE_TARGET=flash --no-print-directory sketch jtag: - $(MAKE) MAPLE_TARGET=jtag --no-print-directory + @$(MAKE) MAPLE_TARGET=jtag --no-print-directory sketch |