help-make
[Top][All Lists]
Advanced

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

Re: dependency issues in Make


From: Johan Bezem
Subject: Re: dependency issues in Make
Date: Wed, 13 Oct 2004 08:12:31 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)

Did you try adding 'all' to the .PHONY list without packing all file names in variables? 
Even if it doesn't seem to have any consequence, it might very well be the single change 
you need for a succesful makefile. And then for good measure, add "touch 
$(EXE)" to the list of commands after the linker runs, cf. my inline comments below.

And concerning the variables: Every filename in its own variable doesn't make 
sense. Why not create a variable SOURCES:=... and OBJECTS:=$(patsubst 
%.cc,%.o,$(SOURCES)), and then turn to automatic dependency generation (cf.  
http://make.paulandlesley.org/autodep.html), you wouldn't need a variable for 
each file (which isn't helping you in any way AFAICT).

John David Ratliff wrote:
your 'all' rule doesn't touch/create a file called 'all', but it isn't declared .PHONY either. See Paul's Rule 2 (http://make.paulandlesley.org/rules.html#rule2). This may prevent make from doing what you want.


Hadn't thought of that, but the target is nevertheless being executed.

That doesn't have to mean that make is interpreting what you intended, see my 
initial comments...

I did
add it to the phony target list though.

Good.


[Also, you repeat your filenames several times. You might consider following Paul's rule 4. But as long as your spelling is consistent of itself, and in sync with your directory structure, this is just a nuisance for you, not a consideration for make.]


You mean in the dependencies? You think I should create variables for the
filenames? This would lesson the potential for typing mistakes.

The way you provide one variable per file, your potential for typing mistakes 
has not really decreased, it may well have increased!


And what do you know. Somehow this solves my problem. I wonder why...

I'd assume this has nothing to do with your makefile working all of a sudden. 
Unless I also missed a typo in your original...

Last thing that strikes me is your 'strip' command:
...
Mingw is weird. Well, actually, probably msys is weird. But the fact remains
its weird.

Here is the weirdness.

If you say -o filename, mingw-ld will automatically append a .exe. It used
to create both filename and filename.exe.

This is fine, as Windows needs this. But the problem is, the test command.

test -f filename
and test -f filename.exe

Both return true if filename.exe exists.

I had the hardest time trying to figure out why it thought filename was
being created when it wasn't. I finally figured out I had to do the win32
specific test first. It should work the same way on Linux, too, but I
haven't gotten around to testing yet.

OK, be sure to say "touch $(EXE)" after the linker has run. That way make will 
know that it's really done.
If the file has just been created, the timestamp will be updated a few seconds, 
no harm done. If it didn't exist, a new file with size 0 will be created, no 
harm done AFAICT, since $(EXE).exe will also exist.

... [Makefile stripped]

Johan
--
JB Enterprises - Johan Bezem         Tel:   +49 172 5463210
Software Architect - Project Manager Fax:   +49 172 50 5463210
Realtime / Embedded Consultant       Email: address@hidden
Design - Development - Test - QA     Web:   http://www.bezem.de






reply via email to

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