Example Makefile replacing a string in an already existing Variable

(see also http://www.gnu.org/software/make/manual/make.html#Text-Functions)

OLDSTRING=-Wall -Wshadow -Wblue
SUBST=$(OLDSTRING)
FILTEROUT=$(OLDSTRING)

SUBST:=$(subst -Wshadow,,$(SUBST))
FILTEROUT:=$(filter-out -Wshadow,$(FILTEROUT))

test:
   @echo OLD $(OLDSTRING)
   @echo FILTEROUT $(FILTEROUT)
   @echo SUBST $(SUBST)

produces as output
OLD -Wall -Wshadow -Wblue
FILTEROUT -Wall -Wblue
SUBST -Wall -Wblue
-- PeterZumbruch - 18 Jan 2007
Topic revision: r2 - 2007-01-18, PeterZumbruch
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)