>> 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. I did add it to the phony target list though. >> [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. And what do you know. Somehow this solves my problem. I wonder why... >> Last thing that strikes me is your 'strip' command: > if [ -e $(EXE).exe ]; then strip $(EXE).exe; else strip $(EXE); fi >> I'm not familiar with mingw, but if your linker may produce "$(EXE).exe" >> in stead of "$(EXE)", your make rule is again not updating the exact >> target of your rule, cf. Paul's Rule 2. >> If the makefile still doesn't work after correcting these issues, >> shout again ;-) 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. Anyway, the following makefile works great now. Thanks for your help. ############################################################################ # Makefile for wxCHTDecoder # Created for GNU make. Others may work, but YMMV. # # Copyright (C) 2004 emuWorks # http://games.technoplaza.net # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. ############################################################################ # global definitions # CXX=g++ CXXFLAGS=-O2 `wx-config --cxxflags` LIBS=`wx-config --libs` SRC=src BIN=. EXE=$(BIN)/chtdecoder ############################################################################ # source and object files # CHTDECODER=$(SRC)/chtdecoder.cc CHTDECODERH=$(SRC)/chtdecoder.hh CHTDECODERO=$(SRC)/chtdecoder.o CHTCODE=$(SRC)/datastructures/chtcode.cc CHTCODEH=$(SRC)/datastructures/chtcode.hh CHTCODEO=$(SRC)/datastructures/chtcode.o CHTCODELIST=$(SRC)/datastructures/chtcodelist.cc CHTCODELISTH=$(SRC)/datastructures/chtcodelist.hh CHTCODELISTO=$(SRC)/datastructures/chtcodelist.o INDEXOUTOFBOUNDSE=$(SRC)/exceptions/indexoutofboundsexception.cc INDEXOUTOFBOUNDSEH=$(SRC)/exceptions/indexoutofboundsexception.hh INDEXOUTOFBOUNDSEO=$(SRC)/exceptions/indexoutofboundsexception.o INVALIDCHTFILEE=$(SRC)/exceptions/invalidchtfileexception.cc INVALIDCHTFILEEH=$(SRC)/exceptions/invalidchtfileexception.hh INVALIDCHTFILEEO=$(SRC)/exceptions/invalidchtfileexception.o CHTFILEREADER=$(SRC)/tools/chtfilereader.cc CHTFILEREADERH=$(SRC)/tools/chtfilereader.hh CHTFILEREADERO=$(SRC)/tools/chtfilereader.o CHTFRAME=$(SRC)/view/chtframe.cc CHTFRAMEH=$(SRC)/view/chtframe.hh CHTFRAMEO=$(SRC)/view/chtframe.o CHTTEXTCTRL=$(SRC)/view/chttextcontrol.cc CHTTEXTCTRLH=$(SRC)/view/chttextcontrol.hh CHTTEXTCTRLO=$(SRC)/view/chttextcontrol.o ############################################################################ # the objects to compile # OBJS=$(CHTDECODERO) $(CHTCODEO) $(CHTCODELISTO) $(INDEXOUTOFBOUNDSEO) \ $(INVALIDCHTFILEEO) $(CHTFILEREADERO) $(CHTFRAMEO) $(CHTTEXTCTRLO) ############################################################################ # the targets # .PHONY: clean run all all: $(EXE) $(EXE): $(OBJS) $(CXX) -o $(EXE) $(OBJS) $(LIBS) if [ -e $(EXE).exe ]; then strip $(EXE).exe; else strip $(EXE); fi ############################################################################ # object dependencies # $(CHTDECODERO): $(CHTDECODER) $(CHTDECODERH) $(CHTFRAMEH) $(CHTCODEO): $(CHTCODE) $(CHTCODEH) $(CHTCODELISTO): $(CHTCODELIST) $(CHTCODELISTH) $(INDEXOUTOFBOUNDSEH) \ $(CHTCODEH) $(INDEXOUTOFBOUNDSEO): $(INDEXOUTOFBOUNDSE) $(INDEXOUTOFBOUNDSEH) $(INVALIDCHTFILEO): $(INVALIDCHTFILE) $(INVALIDCHTFILEH) $(CHTFILEREADERO): $(CHTFILEREADER) $(CHTFILEREADERH) $(CHTCODEH) \ $(INVALIDCHTFILEEH) $(CHTCODELISTH) $(CHTFRAMEO): $(CHTFRAME) $(CHTFRAMEH) $(CHTDECODERH) $(CHTFILEREADERH) \ $(CHTCODELISTH) $(CHTCODEH) $(INVALIDCHTFILEEH) $(CHTTEXTCTRLH) $(CHTTEXTCTRLO): $(CHTTEXTCTRL) $(CHTTEXTCTRLH) ############################################################################ # phony targets # clean: rm -rf $(OBJS) $(EXE) *.exe find . -iname '*~' -exec rm -f {} \; run: $(EXE) @$(EXE) # # end of Makefile ############################################################################ --John Ratliff _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/help-make
