help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to write rules for dependencies together with include?


From: Georg-Johann Lay
Subject: How to write rules for dependencies together with include?
Date: Sun, 18 Jan 2009 13:20:10 +0100
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

Hi make experts,

would anyone assist me in writing make rules for the following tasks?

In a make process I have to get verbatim copies (VPATH and vpath will not work) from files in, say, $(FILES), which are located in $(DIR).

DIR is one directory and FILES is a list of plain file names with no path prefixes.

So the rules to get the files should look like this:

foo1.a: $(DIR)/foo1.a
        cp $^ .

foo2.b: $(DIR)/foo2.b
        cp $^ .

...

How can I generate such rules?

I tried using awk to write a .depend.files file and include it which does not work because include is executed too early.

.INTERMEDIATE: $(FILES)

.depend.files: Makefile
        echo '$(FILES)' | gawk '...$(DIR)...' > .depend.files

The files in $(FILES) are needed to generate dependencies:

.depend: .depend.files Makefile $(FILES) $(SRC)
        $(CC) -MM ... > .depend

-include .depend .depend.files


How is the correct way to state this? I tried removing Makefile from the dependencies but that does not work either.

Thanks very much for your help and clues!

Grüß, Georg-Johann





reply via email to

[Prev in Thread] Current Thread [Next in Thread]