help-make
[Top][All Lists]
Advanced

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

dependency issues in Make


From: John David Ratliff
Subject: dependency issues in Make
Date: Mon, 11 Oct 2004 16:41:40 -0500

I have a "simple" Makefile. At least, it should be simple. But whenever I
add the dependencies to it, it stops compiling some of the files. Not all,
just a few. I can identify no reason why some work and some do not.

I am using mingw, make 3.79.1. I wanted to compile make 3.80 and see if that
would fix my problem, but it did not compile.

If you comment out the section labeled "object dependencies", it will
compile all the objects. But then if you change a header, it doesn't know
what files should be recompiled. That makes the Makefile somewhat useless to
me. I could write a configure script to recompile all the cc files. I want
Make to figure out the dependencies, obviously.

Using this version, I get the following output.

g++ -O2 `wx-config --cxxflags`   -c -o src/chtdecoder.o src/chtdecoder.cc
g++ -O2 `wx-config --cxxflags`   -c -o src/datastructures/chtcode.o
src/datastructures/chtcode.cc
g++ -O2 `wx-config --cxxflags`   -c -o src/datastructures/chtcodelist.o
src/datastructures/chtcodelist.cc
g++ -O2 `wx-config --cxxflags`   -c -o
src/exceptions/invalidchtfileexception.o
src/exceptions/invalidchtfileexception.cc
g++ -O2 `wx-config --cxxflags`   -c -o src/view/chttextcontrol.o
src/view/chttextcontrol.cc
g++ -o ./chtdecoder src/chtdecoder.o src/datastructures/chtcode.o
src/datastructures/chtcodelist.o src/exceptions/indexoutofboundsexception.o
src/exceptions/invalidchtfileexception.o src/tools/chtfilereader.o
src/view/chtframe.o src/view/chttextcontrol.o `wx-config --libs`
g++.exe: src/exceptions/indexoutofboundsexception.o: No such file or
directory
g++.exe: src/tools/chtfilereader.o: No such file or directory
g++.exe: src/view/chtframe.o: No such file or directory
make: *** [chtdecoder] Error 1

Notice it did not compile the indexoutofboundsexception, the chtfilereader,
or the chtframe. Remove their dependency section in the object dependencies
part of the Makefile and it will compile the objects, but of course won't
recompile if you change any of their headers.

I have retyped the section several times. I have also retyped the OBJS=
section and tried using tabs instead of spaces for the continued lines. I've
even tried no spaces. None of my efforts have been successful.

If someone wants the source, it's at
http://games.technoplaza.net/CHTDecoder/history/wxCHTDecoder-1.0.zip. But
since you need wxWidgets to compile, that probably won't help a lot of
people diagnose.

############################################################################
####
# 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

############################################################################
####
# the objects to compile
#

OBJS=$(SRC)/chtdecoder.o \
  $(SRC)/datastructures/chtcode.o $(SRC)/datastructures/chtcodelist.o \
  $(SRC)/exceptions/indexoutofboundsexception.o \
  $(SRC)/exceptions/invalidchtfileexception.o \
  $(SRC)/tools/chtfilereader.o \
  $(SRC)/view/chtframe.o $(SRC)/view/chttextcontrol.o

############################################################################
####
# the targets
#

.PHONY: clean run

all: $(EXE)

$(EXE): $(OBJS)
        $(CXX) -o $(EXE) $(OBJS) $(LIBS)
        if [ -e $(EXE).exe ]; then strip $(EXE).exe; else strip $(EXE); fi

############################################################################
####
# object dependencies 
#

$(SRC)/chtdecoder.o: $(SRC)/chtdecoder.cc $(SRC)/chtdecoder.hh \
  $(SRC)/view/chtframe.hh

$(SRC)/datastructures/chtcode.o: $(SRC)/datastructures/chtcode.cc \
  $(SRC)/datastructures/chtcode.hh

$(SRC)/datastructures/chtcodelist.o: $(SRC)/datastructures/chtcodelist.cc \
  $(SRC)/datastructures/chtcodelist.hh \
  $(SRC)/exceptions/indexoutofboundsexception.hh \
  $(SRC)/datastructures/chtcode.hh

$(SRC)/exceptions/indexoutofboundsexception.o: \
  $(SRC)/exceptions/indexoutofboundsexception.cc \
  $(SRC)/exceptions/indexoutofboundsexception.hh
        
$(SRC)/exceptions/invalidchtfileexception.o: \
  $(SRC)/exceptions/invalidchtfileexception.cc \
  $(SRC)/exceptions/invalidchtfileexception.hh

$(SRC)/tools/chtfilereader.o: $(SRC)/tools/chtfilereader.cc \
  $(SRC)/tools/chtfilereader.hh \
  $(SRC)/datastructures/chtcode.hh \
  $(SRC)/exceptions/invalidchtfileexception.hh \
  $(SRC)/datastructures/chtcodelist.hh
        
$(SRC)/view/chtframe.o: $(SRC)/view/chtframe.cc $(SRC)/view/chtframe.hh \
  $(SRC)/chtdecoder.hh $(SRC)/tools/chtfilereader.hh \
  $(SRC)/datastructures/chtcodelist.hh \
  $(SRC)/datastructures/chtcode.hh \
  $(SRC)/exceptions/invalidchtfileexception.hh \
  $(SRC)/view/chttextcontrol.hh
        
$(SRC)/view/chttextcontrol.o: $(SRC)/view/chttextcontrol.cc \
  $(SRC)/view/chttextcontrol.hh

############################################################################
####
# phony targets
#

clean:
        rm -rf $(OBJS) $(EXE) *.exe
        find . -iname '*~' -exec rm -f {} \;

run: $(EXE)
        @$(EXE)

#
# end of Makefile
############################################################################
####

--John Ratliff







reply via email to

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