Saturday, 15 August 2015

linux - Makefile, Run environment check target before user run any targets -



linux - Makefile, Run environment check target before user run any targets -

i want run next environment check target checkenv before of other targets,

all: build_sub_target1 build_target2 clean: clean_sub_target1 clean_target2 ... ... checkenv: $(if $(project_root), , \ $(error $(shell echo -e '\033[41;33mfatal: please load project settings first. \ run "source project_root_dir/envsetup.sh"\033[0m')) \ )

i want every other target run checkenv target before task, how can this? other way except add together checkenv depends list of each targets? since have many targets in file, , think it's not cool add together each targets... should there potential rules this? lot help!

you utilize make conditionals that, status checked while makefile beingness read , before targets evaluated:

ifndef project_root $(error "please load project settings first. run source project_root_dir/envsetup.sh") endif

linux bash shell makefile

No comments:

Post a Comment