On Mon, Mar 16, 2009 at 06:37:40PM +0100, Raphael Hertzog wrote: > Suppose you have "FOO ?= bar" in the Makefile, write me the rest of the > Makefile so that I have this: > $ FOO=foo make > FOO was set in the environment > $ make FOO=foo > FOO was set on the command-line > $ make > FOO was set in the Makefile
$ cat Makefile
FOO ?= bar
all:
ifeq "$(origin FOO)" "command line"
$(info "FOO was set on the command-line")
endif
ifeq "$(origin FOO)" "environment"
$(info "FOO was set in the environment")
endif
ifeq "$(origin FOO)" "file"
$(info "FOO was set in the Makefile")
endif
--
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
signature.asc
Description: Digital signature

