简体   繁体   中英

how to call a makefile target it it contain variable name?

If let's say target of makefile (ie $(SESSION)/compiled.csh ) contains a variable name .. how can we call a makefile to run with that target ??

--------------calling makefile -------------------------

make \
     -f makefile  \
     session_name=rtl_unit \

---------------- makefile content ----------------------

ifeq ($(MAKECMDGOALS), all) 
 DEFAULT_DEP := dep1 dep2
else
 DEFAULT_DEP := dep1
endif*

export SESSION = $(TESTBENCH_PATH)/blocks/$(session_name)
$(SESSION)/compiled.csh : something

Just add another phony target and make it depend on your hard-to-spell target:

$(SESSION)/compiled.csh : something
compiled : $(SESSION)/compiled.csh
.PHONY: compiled

And then:

make compiled

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM