[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Pattern Rules
From: |
Paul D. Smith |
Subject: |
Re: Pattern Rules |
Date: |
Thu, 30 Mar 2006 21:40:09 -0500 |
%% "PATTON, BILLY \(SBCSI\)" <address@hidden> writes:
pb> Here's the problem I have now that I'm trying to correct.
pb> EX:
pb> CFLAGS := -Ddogs -Dcats ...
pb> Has over 25 unique definitions spread over 1k+ makefiles. The c code
pb> will be compiled differently from directory to directory.
pb> My current thought is to do something like
pb> define cflags1
pb> $(1) : $(2)
pb> $(CC) -Ddogs -Dcats ...
pb> endef
pb> Now what Paul suggested I look at was the pattern rules.
pb> %.o : %.c
pb> Bu these are wild card patterns for all .c. This I cannot have.
Why not? You say you can't do it but don't explain why.
If you mean because you need different flags for each directory that's
trivially managed with target-specific variables.
pb> Is it possible to associate a patter rule with a particular list
pb> LIST_1 := a.c b.c d.c ...
pb> $(LIST_1) : $(LIB)(%.o) : %.c
pb> $(CC) -Ddogs -Dcats ...
Well, that's a static pattern rule (see the documentation). Although
the list has to match the TARGET pattern (a.o b.o c.o) not the
prerequisite pattern.
That will definitely be clearer in the makefile than a complex set of
eval and call.
However, it won't save you any space or much time parsing makefiles,
since static pattern rules expand into explicit rules during makefile
read-in.
pb> Main point, I cannot associate all .c files to one pattern rule.
pb> I have some 400 + directories that may contain c/cpp/cobol
You still haven't clearly explained why you cannot.
pb> If I can associate a single pattern rule with a particular list
pb> that would be great. Unless I can do it I'll be generating
pb> $(LIB)(dogs.o) : dogs.c
pb> blablabla
pb> $(LIB)(cats.o) : cats.c
pb> blablabla
Why?
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
- Pattern Rules, PATTON, BILLY \(SBCSI\), 2006/03/30
- Re: Pattern Rules,
Paul D. Smith <=