help-make
[Top][All Lists]
Advanced

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

TR: Adresses email sur les problèmes gmake


From: Massonnier Laurent
Subject: TR: Adresses email sur les problèmes gmake
Date: Fri, 9 Jan 2004 17:25:55 +0100

Hi all,

I'm looking for help here because of a gmake problem, which gets on my nerves for a long time by now. That's why I decided to turn on your side.

Here it is :
I've got a generic makefile, called make_c.mk, which contains the following lines :

bin/CIBLE_%.elf : SUBST=$(shell echo $* | sed "s|^CIBLE_||")
bin/CIBLE_%.elf : DEPENDANCES=$(addprefix lib/CIBLE_, $(shell cat src/$(SUBST).mk | egrep "^$(SUBST).elf" | cut -d':' -f2))

bin/CIBLE_%.elf:$(DEPENDANCES)
        @echo "DEPENDANCES -> $(DEPENDANCES)"
        dld ${CIBLE_LINK_OPT} -o $@ $(DEPENDANCES) src/CIBLE_$*.dld -m2 > bin/CIBLE_$*.map


+ a few rules for .o and .a files.


The two first lines are there so as to get the prerequisites (in the variable $(DEPENDANCES) ) of the binary I'm interested in.

Those prerequisites are all in specifics makefiles of the ./src directory, their wording is as follow :
* for binaries called bin/<foo>.elf or bin/CIBLE_<foo>.elf --> the specific file containing prerequisites is called src/<foo>.mk ;

My sources are in the ./src directory, my libraries (.o & .a) in the ./lib one and the binaries in the ./bin one.

The problem is, using this way to get the prerequisites, gmake doesn't succeed in following the objects defined in the prerequisites.

My binaries prerequisites are .o or .a files, which depend on rules described in the makefile too ; they run ok when i run gmake with them as target.

But when they're defined in the "specific makefile" of an executable, gmake doesn't want to run these rules prior to the commands of the binary.

In fact, everything seems to be as if the prerequisites weren't seen in the binary rule (after many tests, it has proved to be a good theory)

bin/CIBLE_%.elf: $(DEPENDANCES) # invisible ??
        @echo "DEPENDANCES -> $(DEPENDANCES)"
        dld ${CIBLE_LINK_OPT} -o $@ $(DEPENDANCES) src/CIBLE_$*.dld -m2 > bin/CIBLE_$*.map

I've also been able to see that this problem might be solved if, instead of using target-specific variables to define the prerequisites, I wrote directly at the beginning of the makefile the values I was waiting for.

Of course, that's not what I want for a definitive makefile, but seems to indicate that, depending on how you affect your variables, they will be or not visible in your "target : rules" line.

I don't know if it does matter, but I'm using the 3.79.1 release.


Thanks,

Laurent.

(Btw, may you excuse my approximative english)



reply via email to

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