Change 'TARGET' in makefiles to 'PROGRAM', keep consistent with documentation terminology

This commit is contained in:
Angus Gratton 2015-06-12 10:26:02 +10:00
parent 47a7bb1952
commit 685a48583a
7 changed files with 30 additions and 30 deletions

View file

@ -20,22 +20,22 @@
# assume the 'root' directory (ie top of the tree) is the directory common.mk is in # assume the 'root' directory (ie top of the tree) is the directory common.mk is in
ROOT := $(dir $(lastword $(MAKEFILE_LIST))) ROOT := $(dir $(lastword $(MAKEFILE_LIST)))
# include local overrides (if present) at top level, then in program directory # include optional local overrides at the root level, then in program directory
-include $(ROOT)local.mk -include $(ROOT)local.mk
-include local.mk -include local.mk
ifndef TARGET ifndef PROGRAM
$(error "Set the TARGET environment variable in your Makefile before including common.mk" $(error "Set the PROGRAM environment variable in your Makefile before including common.mk"
endif endif
# esptool defaults # esptool defaults
ESPTOOL ?= esptool.py ESPTOOL ?= esptool.py
ESPBAUD ?= 115200 ESPBAUD ?= 115200
# Output directors to store intermediate compiled files # Output directories to store intermediate compiled files
# relative to the target directory # relative to the program directory
BUILD_DIR ?= $(TARGET_DIR)build/ BUILD_DIR ?= $(PROGRAM_DIR)build/
FW_BASE ?= $(TARGET_DIR)firmware/ FW_BASE ?= $(PROGRAM_DIR)firmware/
# we create two different files for uploading into the flash # we create two different files for uploading into the flash
# these are the names and options to generate them # these are the names and options to generate them
@ -71,7 +71,7 @@ LIBS ?= gcc hal
ENTRY_SYMBOL = call_user_start ENTRY_SYMBOL = call_user_start
CFLAGS = -Wall -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -std=gnu99 CFLAGS = -Wall -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -std=gnu99
LDFLAGS = -nostdlib -Wl,--no-check-sections -Wl,-L$(BUILD_DIR)sdklib -Wl,-L$(ROOT)lib -u $(ENTRY_SYMBOL) -Wl,-static -Wl,-Map=build/${TARGET}.map LDFLAGS = -nostdlib -Wl,--no-check-sections -Wl,-L$(BUILD_DIR)sdklib -Wl,-L$(ROOT)lib -u $(ENTRY_SYMBOL) -Wl,-static -Wl,-Map=build/${PROGRAM}.map
ifeq ($(FLAVOR),debug) ifeq ($(FLAVOR),debug)
CFLAGS += -g -O0 CFLAGS += -g -O0
@ -97,13 +97,13 @@ space := $(empty) $(empty)
# GNU Make lowercase function, bit of a horrorshow but works (courtesy http://stackoverflow.com/a/665045) # GNU Make lowercase function, bit of a horrorshow but works (courtesy http://stackoverflow.com/a/665045)
lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1)))))))))))))))))))))))))) lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
# assume the target_dir is the directory the top-level makefile was run in # assume the program dir is the directory the top-level makefile was run in
TARGET_DIR := $(dir $(firstword $(MAKEFILE_LIST))) PROGRAM_DIR := $(dir $(firstword $(MAKEFILE_LIST)))
# derive various parts of compiler/linker arguments # derive various parts of compiler/linker arguments
SDK_LIB_ARGS = $(addprefix -l,$(SDK_LIBS)) SDK_LIB_ARGS = $(addprefix -l,$(SDK_LIBS))
LIB_ARGS = $(addprefix -l,$(LIBS)) LIB_ARGS = $(addprefix -l,$(LIBS))
TARGET_OUT = $(BUILD_DIR)$(TARGET).out PROGRAM_OUT = $(BUILD_DIR)$(PROGRAM).out
LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS)) LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS))
FW_FILE_1 = $(addprefix $(FW_BASE),$(FW_1).bin) FW_FILE_1 = $(addprefix $(FW_BASE),$(FW_1).bin)
FW_FILE_2 = $(addprefix $(FW_BASE),$(FW_2).bin) FW_FILE_2 = $(addprefix $(FW_BASE),$(FW_2).bin)
@ -111,10 +111,10 @@ FW_FILE_2 = $(addprefix $(FW_BASE),$(FW_2).bin)
# Common include directories, shared across all "components" # Common include directories, shared across all "components"
# components will add their include directories to this argument # components will add their include directories to this argument
# #
# Placing $(TARGET_DIR) and $(TARGET_DIR)include first allows # Placing $(PROGRAM_DIR) and $(PROGRAM_DIR)include first allows
# targets to have their own copies of header config files for components # programs to have their own copies of header config files for components
# , which is useful for overriding things. # , which is useful for overriding things.
INC_DIRS = $(TARGET_DIR) $(TARGET_DIR)include $(ROOT)include INC_DIRS = $(PROGRAM_DIR) $(PROGRAM_DIR)include $(ROOT)include
ifeq ("$(V)","1") ifeq ("$(V)","1")
Q := Q :=
@ -126,7 +126,7 @@ endif
.PHONY: all clean debug_print .PHONY: all clean debug_print
all: $(TARGET_OUT) $(FW_FILE_1) $(FW_FILE_2) all: $(PROGRAM_OUT) $(FW_FILE_1) $(FW_FILE_2)
# component_compile_rules: Produces compilation rules for a given # component_compile_rules: Produces compilation rules for a given
# component # component
@ -212,32 +212,32 @@ $(BUILD_DIR)sdklib/%.rename: $(ROOT)lib/%.a $(BUILD_DIR)sdklib/norename.match
$(BUILD_DIR)sdklib/allsymbols.rename: $(patsubst %.a,%.rename,$(SDK_PROCESSED_LIBS)) $(BUILD_DIR)sdklib/allsymbols.rename: $(patsubst %.a,%.rename,$(SDK_PROCESSED_LIBS))
cat $^ > $@ cat $^ > $@
# include "dummy component" for the 'target' object files # include "dummy component" for the 'program' object files, defined in the Makefile
TARGET_SRC_DIR ?= $(TARGET_DIR) PROGRAM_SRC_DIR ?= $(PROGRAM_DIR)
TARGET_ROOT ?= $(TARGET_DIR) PROGRAM_ROOT ?= $(PROGRAM_DIR)
TARGET_MAKEFILE = $(firstword $(MAKEFILE_LIST)) PROGRAM_MAKEFILE = $(firstword $(MAKEFILE_LIST))
$(eval $(call component_compile_rules,TARGET)) $(eval $(call component_compile_rules,PROGRAM))
## Include other components (this is where the actual compiler sections are generated) ## Include other components (this is where the actual compiler sections are generated)
$(foreach component,$(COMPONENTS), $(eval include $(ROOT)$(component)/component.mk)) $(foreach component,$(COMPONENTS), $(eval include $(ROOT)$(component)/component.mk))
# final linking step to produce .elf # final linking step to produce .elf
$(TARGET_OUT): $(COMPONENT_ARS) $(SDK_PROCESSED_LIBS) $(LINKER_SCRIPTS) $(PROGRAM_OUT): $(COMPONENT_ARS) $(SDK_PROCESSED_LIBS) $(LINKER_SCRIPTS)
$(vecho) "LD $@" $(vecho) "LD $@"
$(Q) $(LD) $(LDFLAGS) -Wl,--start-group $(SDK_LIB_ARGS) $(LIB_ARGS) $(COMPONENT_ARS) -Wl,--end-group -o $@ $(Q) $(LD) $(LDFLAGS) -Wl,--start-group $(SDK_LIB_ARGS) $(LIB_ARGS) $(COMPONENT_ARS) -Wl,--end-group -o $@
$(BUILD_DIR) $(FW_BASE) $(BUILD_DIR)sdklib: $(BUILD_DIR) $(FW_BASE) $(BUILD_DIR)sdklib:
$(Q) mkdir -p $@ $(Q) mkdir -p $@
$(FW_FILE_1) $(FW_FILE_2): $(TARGET_OUT) $(FW_BASE) $(FW_FILE_1) $(FW_FILE_2): $(PROGRAM_OUT) $(FW_BASE)
$(vecho) "FW $@" $(vecho) "FW $@"
$(ESPTOOL) elf2image $< -o $(FW_BASE) $(ESPTOOL) elf2image $< -o $(FW_BASE)
flash: $(FW_FILE_1) $(FW_FILE_2) flash: $(FW_FILE_1) $(FW_FILE_2)
$(ESPTOOL) -p $(ESPPORT) --baud $(ESPBAUD) write_flash $(FW_1) $(FW_FILE_1) $(FW_2) $(FW_FILE_2) $(ESPTOOL) -p $(ESPPORT) --baud $(ESPBAUD) write_flash $(FW_1) $(FW_FILE_1) $(FW_2) $(FW_FILE_2)
size: $(TARGET_OUT) size: $(PROGRAM_OUT)
$(Q) $(CROSS)size --format=sysv $(TARGET_OUT) $(Q) $(CROSS)size --format=sysv $(PROGRAM_OUT)
test: flash test: flash
screen $(ESPPORT) 115200 screen $(ESPPORT) 115200

View file

@ -1,2 +1,2 @@
TARGET=blink PROGRAM=blink
include ../../common.mk include ../../common.mk

View file

@ -1,2 +1,2 @@
TARGET=button PROGRAM=button
include ../../common.mk include ../../common.mk

View file

@ -1,2 +1,2 @@
TARGET=http_get PROGRAM=http_get
include ../../common.mk include ../../common.mk

View file

@ -1,2 +1,2 @@
TARGET=http_get PROGRAM=http_get
include ../../common.mk include ../../common.mk

View file

@ -1,3 +1,3 @@
# Simple makefile for simple example # Simple makefile for simple example
TARGET=simple PROGRAM=simple
include ../../common.mk include ../../common.mk

View file

@ -1,2 +1,2 @@
TARGET=hmac_test PROGRAM=hmac_test
include ../../../common.mk include ../../../common.mk