From: Soren A <sor...@fa...> - 2003-01-09 20:34:58
|
"Ulf Magnusson" <ulf...@ho...> wrote in news:F89...@ho...: >>>Hmmm... but here I Am stating that the executable depends on the object >>>files. What's the difference from Earnie's example that makes my version >>>faulty? >>You need to read http://make.paulandlesley.org/ since you don't understand >>the difference. The manual is the only help we can give you. The answer >>is that _you_ are _not_ stating dependancies. The $(OBJECTS) in your link >>target are arguments to the g++. >> >>Earnie. > The line I was refering to is > > $(EXENAME) : $(OBJECTS) You currently seem to have: ------------------------------------- Date: Wed, 08 Jan 2003 13:38:53 +0000 Subject: Re: Makefile problems From: "Ulf Magnusson" <ulf...@ho...> Newsgroups: gmane.comp.gnu.mingw.user ------------------------------------- I altered the makfile like this: EXENAME = Game.exe ... .PHONY : defTarget defTarget : compile link ... $(EXENAME) : $(OBJECTS) ... .PHONY : compile compile : $(EXENAME) ... .PHONY : link link : (tab) g++ $(OBJECTS) $(LINKFLAGS) Your <link> target needs to be a real file, I think. There's no point in compounding the abstraction -- this is I think a common misconception people fall into with <make>. You need to have something like: .PHONY: defTarget compile defTarget: compile $(EXENAME) compile: $(OBJECTS) $(EXENAME): $(OBJECTS) <TAB>g++ $^ $(LINKFLAGS) It would be more conventional to use LDFLAGS in place of "LINKFLAGS". Remember that 'make' is not a procedural language but more a declarative one. You are getting confused about how to write this Makefile partly on the basis of wanting to write a "script" for a procedural interpreter (like bash or perl) instead of doing what 'make' understands. A Makefile is not a "script". HTH, Soren A |