[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dependency problem
From: |
Paul D. Smith |
Subject: |
Re: Dependency problem |
Date: |
Wed, 4 May 2005 16:41:07 -0400 |
%% "j.ahlschlaeger" <address@hidden> writes:
ja> My problem is that I have some source files to compile, but there are
ja> two types of files to compile, the one with that command:
ja> $(COMPILECOMMAND1) $< -o $@
ja> and the others with that command:
ja> $(COMPILECOMMAND2) $< -o $@
ja> .
ja> But if I write it so:
ja> $(TYP1_OBJ):$(TYP1_SRC)
ja> $(COMPILECOMAND1) $< -o $@
ja> $(TYP2_OBJ):$(TYP2_SRC)
ja> $(COMPILECOMAND2) $< -o $@
ja> ,so compile make always all files of one typ, when only one source file
ja> of this type modified.
When you write something like this:
foo.o bar.o baz.o : foo.c bar.c baz.c
That's identical to writing this:
foo.o : foo.c bar.c baz.c
bar.o : foo.c bar.c baz.c
baz.o : foo.c bar.c baz.c
so this is why you see the results you do.
There are many ways to handle this situation but given your example
above the simplest one is static pattern rules; check the GNU make
manual for more information:
$(TYP1_OBJ) : %.o : %.c
$(COMPILECOMMAND1) $< -o $@
$(TYP2_OBJ) : %.o : %.c
$(COMPILECOMMAND2) $< -o $@
You can also use target-specific variables, or eval, or a host of other
options.
--
-------------------------------------------------------------------------------
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