0
CFG_DATA_FILES := $(wildcard ../src/config/cfg_file*.csv)
CFG_DATA_MEM_FILES := $(addprefix bin/,$(notdir $(CFG_DATA_FILES:.csv=.mem)))
CFG_DATA_BIN_FILES := $(addprefix bin/,$(notdir $(CFG_DATA_MEM_FILES:.mem=.bin)))

COMBINED_BIN_FILES := $(subst cfg_file-,fw_,$(CFG_DATA_BIN_FILES))
COMBINED_BIN_FILES := $(subst .bin,_combined.bin,$(COMBINED_BIN_FILES))


ifdef CUSTOM_CONFIG
rom: build_images create_custom_binaries
else
rom: build_images create_binaries
endif

chk_custom_cfg:
ifdef CUSTOM_CONFIG
    export CUSTOM_CONFIG 
    $(eval CUST_CFG_DATA_FILES=$(CUSTOM_CONFIG)) 
    export CUST_CFG_DATA_FILES
    $(eval CUST_CFG_DATA_MEM_FILES=$(addprefix bin/,$(notdir $(CUST_CFG_DATA_FILES:.csv=.mem)))) 
    export CUST_CFG_DATA_MEM_FILES 
    $(eval CUST_CFG_DATA_BIN_FILES=$(addprefix bin/,$(notdir $(CUST_CFG_DATA_MEM_FILES:.mem=.bin))))
    export CUST_CFG_DATA_BIN_FILES 
    $(eval CUST_COMBINED_BIN_FILES=$(subst .bin,_combined.bin,$(CUST_CFG_DATA_BIN_FILES)))
    export CUST_COMBINED_BIN_FILES 
    @echo existing cfg files $(CUST_CFG_DATA_FILES)
    @echo existing mem files $(CUST_CFG_DATA_MEM_FILES)
    @echo existing bin files $(CUST_CFG_DATA_BIN_FILES)
    @echo existing combined files $(CUST_COMBINED_BIN_FILES)
endif
build_images: copy_ops_imgs 

create_binaries: config  $(COMBINED_BIN_FILES)

create_custom_binaries: chk_custom_cfg cust_config
    @echo custom config bin files $(CUST_CFG_DATA_BIN_FILES)

config: boot_partn_map_cfg $(CFG_DATA_BIN_FILES)
    @echo Removing temporary files
    @(cd bin; rm -rf *.mem)
cust_config: boot_partn_map_cfg $(CUST_CFG_DATA_BIN_FILES)
    @echo Removing temporary files
    @(cd bin; rm -rf *.mem) 

$(CFG_DATA_BIN_FILES): $(CFG_DATA_FILES)
    @echo Generating config data image $(subst /bin,,$@)

$(CUST_CFG_DATA_BIN_FILES):$(CUST_CFG_DATA_FILES)
    @echo Generating config data image $(subst /bin,,$@)

In the above make file : calling "make CUSTOM_CONFIG=../src/config/custom.config rom" expect $(CUST_CFG_DATA_BIN_FILES) build for ../src/config/custom.config in target cust_config , but I see the environment variable update properly but the target cust_config will not build $(CUST_CFG_DATA_BIN_FILES).

Am I missing anything here, My goal is build different binaries based on the input CUSTOM_CONFIG

C_Enthu
  • 65
  • 3
  • Have you checked this question? https://stackoverflow.com/questions/2826029/passing-additional-variables-from-command-line-to-make – Jose Mar 12 '19 at 10:27
  • Yeah, I followed that and using export to make the variable global. the problem is variable is shared globally, but the prerequisite show empy!. – C_Enthu Mar 15 '19 at 05:25

0 Answers0