RPGDXThe center of Indie-RPG gaming
Not logged in. [log in] [register]
 
 
Post new topic Reply to topic  
View previous topic - View next topic  
Author Message
BigManJones
Scholar


Joined: 22 Mar 2003
Posts: 196

PostPosted: Fri Jun 27, 2003 2:31 am    Post subject: makefile question [quote]

Code:
CPP  = g++.exe
CC   = gcc.exe
WINDRES = windres.exe
RES  =
OBJ  = Hello.o $(RES)
LINKOBJ  = Hello.o $(RES)
LIBS =  -L"C:/Dev-Cpp/lib"
INCS =  -I"C:/Dev-Cpp/include"
CXXINCS =  -I"C:/Dev-Cpp/include/c++"  -I"C:/Dev-Cpp/include/c++/mingw32"  -I"C:/Dev-Cpp/include/c++/backward"  -I"C:/Dev-Cpp/include"
BIN  = Hello.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)

.PHONY: all all-before all-after clean clean-custom

all: all-before Hello.exe all-after


clean: clean-custom
   rm -f $(OBJ) $(BIN)

$(BIN): $(LINKOBJ)
   $(CPP) $(LINKOBJ) -o "Hello.exe" $(LIBS)

Hello.o: Hello.cpp
   $(CPP) -c Hello.cpp -o Hello.o $(CXXFLAGS)


This make file is generated by dev cpp, so I know it must be right. But when I goto the command line and type make Makefile it says 'Nothing to be done for hello.exe' and thats all. I think it might have something to do with time stamps. Does anyone know what the problem is?
Back to top  
Mokona
Pretty, Pretty Fairy Princess


Joined: 26 Jun 2003
Posts: 12

PostPosted: Fri Jun 27, 2003 11:47 am    Post subject: [quote]

You're almost certainly right about it being timestamp related.

'make' compares the modification date of the target file(s) for each step to the input files, and if the target file(s) are newer it skips that step (This is to speed up rebuilding of large projects, since if you haven't changed a source file it doesn't need to rebuild the corresponding object file)

So in this case, it's finding that hello.exe is more recent than hello.c
(Which suggests either you haven't changed hello.c since last building hello.exe or the dates on the files are wrong for some reason)

If you you want to force it to rebuild, use:

make Makefile clean
make Makefile
Back to top  
BigManJones
Scholar


Joined: 22 Mar 2003
Posts: 196

PostPosted: Mon Jun 30, 2003 11:32 pm    Post subject: [quote]

Well, that doesn't work. I just made a batch file so I can compile from the bin in my_documents on my desktop at work (they won't let me have a c compiler :( )
Back to top  
LeoDraco
Demon Hunter


Joined: 24 Jun 2003
Posts: 584
Location: Riverside, South Cali

PostPosted: Tue Jul 01, 2003 3:12 am    Post subject: [quote]

First: for the definitive understanding of make, I refer you to the GNU manual for it. While there, you might consider looking at the g++ manual, as that might be useful if you are not terribly familiar with the GNU c++ compiler.

Second: Are you sure that your case is all correct? In the make source you provided, Hello.exe is written with a capital "H", whilst the output you say you are receiving spells the same with a lower-case "h". I assumed this was simply a typo on your part, but you might want to check everything. In Windows, there isn't a difference between cases for file names, but most Linux distros handle case as significant; so, if you were attempting to force a make on a given file, ala "make Hello.exe", make sure that you are specifying hte appropriate case -- even in Windows.

Third: There are a few make variables you have there that are not being used; some of the ways in which they are being used is a bit silly, and several of the rules are just foolish. Now, if this was generated by some program, then I can see why that is. (For example, $@ references the file to build -- the name that occurs before the colon; while not necessarily as clear as the statements in the $(BIN) and Hello.o rules, it is easier to write. On that note, why the generator wrote $(BIN) and then used "Hello.exe", inside the rule, I am not sure. Unless for each item in $(BIN) it outputs a line like that. But, there are even ways to avoid that...)
However, I doubt this would be the source of the problem.

Fourth: As mentioned, it could be your timestamps, but that would only make sense if you had a copy of Hello.o or Hello.exe already in the directory you are making. You could try saving your file and looking at the timestamp your OS has for it, ensuring that it is (relatively) recent.

Fifth: the problem might stem from the "useless" production rules that are not defined anywhere. I don't know what version of make you have, but as of 3.79.1, make bitches if you attempt to make a rule that is not defined. For example, the production rule you have associated with "clean" has as a dependency the rule "clean-custom", which is, unless you left some of the Makefile source out, undefined. So, you might try taking the useless production rules out of your dependency lists, and see what happens.
_________________
"...LeoDraco is a pompus git..." -- Mandrake
Back to top  
BigManJones
Scholar


Joined: 22 Mar 2003
Posts: 196

PostPosted: Tue Jul 01, 2003 11:18 am    Post subject: [quote]

Thanks for the links, I've been needing those.
Back to top  
Post new topic Reply to topic Page 1 of 1 All times are GMT
 



Display posts from previous:   
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum