Message-ID: <35EAC306.9C8B932C@gsi.dit.upm.es> Date: Mon, 31 Aug 1998 17:36:38 +0200 From: "Jesús Martín Oya" Organization: Grupo de Sistemas Inteligentes - DIT - MAT- UPM MIME-Version: 1.0 To: Eli Zaretskii CC: djgpp AT delorie DOT com, oya AT tid DOT es Subject: Re: Problems with .d files References: Content-Type: multipart/mixed; boundary="------------B5CC7FF9963809C34E609AAA" Precedence: bulk This is a multi-part message in MIME format. --------------B5CC7FF9963809C34E609AAA Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Eli Zaretskii wrote: > On Thu, 27 Aug 1998, Jesús Martín Oya wrote: > > > I have a problem with the tmp/*.d files generated with my Makefile. > > The problem is that the structure of the .d file should be like this > > > > tmp/whatever.o: src/whatever.c > > > > and what I get is > > > > tmp/src/whatever.o: src/whatever.c > > You don't expect us to have a clue without even seeing your Makefile, > do you? You're right. I forgot to send you the Makefile. I'm nearly sure the problem is in the "sed" sentence.Here you have. Cheers, Jesús --------------B5CC7FF9963809C34E609AAA Content-Type: text/plain; charset=us-ascii; name="Makeinc" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="Makeinc" SHELL = bash CC = gcc ccopts = -ansi -pedantic ccdefs = CXX = g++ cxxopts = -ansi -pedantic #cxxdefs = -D__cplusplus cxxdefs = LD = gcc LDXX = g++ LINTFLAGS = YACC = bison LEX = flex system = -DDOSPC CFLAGS = $(ccopts) $(system) $(ccdefs) $(CCOPT) $(EXTRACCFLAGS) \ $(EXTRAINCLUDES) -I$(ARIESINC) CXXFLAGS = $(cxxopts) $(system) $(cxxdefs) $(CXXOPT) $(EXTRACXXFLAGS) \ $(EXTRAINCLUDES) -I$(ARIESINC) LDFLAGS = $(EXTRALDFLAGS) -L$(ARIESLIB) LDXXFLAGS = $(EXTRALDFLAGS) -L$(ARIESLIB) MAKEDEPEND = gcc -MM -MG $(EXTRAINCLUDES) -I$(ARIESINC) # # First adds $(ODIR) at dependency beginning # Second adds $(ODIR) in nonexistent include (should be generated include). # FILTER = sed -e "/^[^ ]/s+^+$(ODIR)/+" -e "s+ \([^/][^/ ]*\.h\)+ $(ODIR)/\1+g" # # Does not add $(ODIR) in nonexistent include, but eliminates dependency # #FILTER = sed -e "/^[^ ]/s+^+$(ODIR)/+" -e "s+ \([^/ ]*\.h\)+ +g" INSTALL = cp UNINSTALL = rm AR = ar MSG = awk 'BEGIN {printf "******************************\n"} \ {print $0} \ END {printf "******************************\n"}' ## # Install directories # ARIESBIN = $(ARIESD)/bin ARIESLIB = $(ARIESD)/lib ARIESINC = $(ARIESD)/include ARIESDAT = $(ARIESD)/data ## # Local directories # SDIR = src ODIR = tmp ## # Default rules # .SUFFIXES: # Default rules are erased #.SUFFIXES: .c .cxx .cc .o .a .d .lnt $(ODIR)/%.o: $(SDIR)/%.c $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ $(ODIR)/%.o: $(SDIR)/%.cxx $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ $(ODIR)/%.o: $(SDIR)/%.cc $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ $(ODIR)/%.c $(ODIR)/%.h: $(SDIR)/%.y $(YACC) $(YACCFLAGS) $< -o $(ODIR)/$*.c $(ODIR)/%.c: $(SDIR)/%.l $(LEX) $(LEXFLAGS) -o$(ODIR)/$*.c $< $(ODIR)/%.o: $(ODIR)/%.c $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ $(ODIR)/%.lnt: $(SDIR)/%.c $(LINT) $(LINTFLAGS) $^ > $@ $(ODIR)/%.d: $(SDIR)/%.c -@if [ ! -d $(ODIR) ]; then mkdir -p $(ODIR); fi @$(MAKEDEPEND) $^ | $(FILTER) > $@ $(ODIR)/%.d: $(SDIR)/%.cxx -@if [ ! -d $(ODIR) ]; then mkdir -p $(ODIR); fi @$(MAKEDEPEND) $^ | $(FILTER) > $@ $(ODIR)/%.d: $(SDIR)/%.cc -@if [ ! -d $(ODIR) ]; then mkdir -p $(ODIR); fi @$(MAKEDEPEND) $^ | $(FILTER) > $@ ## # VPATH # vpath %.h $(SDIR) # TIENE UN EFECTO LATERAL INDESEADO. VER COMO ARREGLAR #vpath %.h $(ARIESINC) vpath %.c $(SDIR) vpath %.cc $(SDIR) vpath %.cxx $(SDIR) vpath %.y $(SDIR) vpath %.l $(SDIR) vpath %.o $(ODIR) vpath %.d $(ODIR) vpath %.lnt $(ODIR) #vpath %.a . # TIENE UN EFECTO LATERAL INDESEADO. VER COMO ARREGLAR #vpath %.a $(ARIESLIB) vpath %.db $(SDIR) vpath %.rul $(SDIR) ## # # ntargets = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 srcs = $(foreach i, $(ntargets), $(S$(i))) objs = $(foreach j, l y c cxx cc, $(patsubst %.$(j),%.o,\ $(filter %.$(j), $(srcs)))) \ $(patsubst %.y,%.c, $(filter %.y, $(srcs)))\ $(patsubst %.y,%.h, $(filter %.y, $(srcs)))\ $(patsubst %.l,%.c, $(filter %.l, $(srcs))) lints = $(patsubst %.c, $(ODIR)/%.lnt, $(filter %.c, $(srcs))) cleanobjs = $(patsubst %,$(ODIR)/%,$(objs)) depends = kk987654321 $(foreach k, c cc cxx, \ $(patsubst %.$(k),$(ODIR)/%.d,$(filter %.$(k), $(srcs)))) targets = $(foreach l, $(ntargets), $(T$(l))) .PHONY: all products test clean testtmpdir testinstdirs install uninstall \ usergoal all: testtmpdir usergoal products usergoal:: ; products: $(targets) @echo Done: "$^" test: @echo "************************" @echo CC: $(CC) $(CFLAGS) @echo "************************" @echo CXX: $(CXX) $(CXXFLAGS) @echo "************************" @echo LD: $(LD) $(LDFLAGS) @echo "************************" @echo LDXX: $(LDXX) $(LDFLAGS) @echo "************************" @echo YACC: $(YACC) $(YACCFLAGS) @echo "************************" @echo LEX: $(LEX) $(LEXFLAGS) @echo "************************" @echo LINT: $(LINT) $(LINTFLAGS) @echo "************************" clean: -@$(UNINSTALL) -f $(targets) $(cleanobjs) $(lints) veryclean: clean -@$(UNINSTALL) -f $(depends) -@rmdir $(ODIR) dist: -@ARIESKK=`echo $${ARIESD}| awk '{print length()+1}'`;\ TOOLDIR=`pwd | cut -c$${ARIESKK}- | sed 's+^+.+'` ;\ cd ${ARIESD} ; tar czf dist/${NAME}.tgz \ $${TOOLDIR}/Makefile* \ $${TOOLDIR}/src \ $${TOOLDIR}/doc \ $${TOOLDIR}/data lint: $(lints) @if [ "$(lints)" != "" ]; then \ echo "See lint (.lnt) files in $(ODIR)."; \ else \ echo "No lint (.lnt) files in $(ODIR).";\ fi testtmpdir: -@if [ ! -d $(ODIR) ]; then mkdir -p $(ODIR); fi testinstdirs: @if [ ! -d $(ARIESBIN) ]; then mkdir -p $(ARIESBIN) ; fi @if [ ! -d $(ARIESLIB) ]; then mkdir -p $(ARIESLIB) ; fi @if [ ! -d $(ARIESINC) ]; then mkdir -p $(ARIESINC) ; fi @if [ ! -d $(ARIESDAT) ]; then mkdir -p $(ARIESDAT) ; fi install: testinstdirs all @if [ "$(T1)" != "" ]; then \ $(INSTALL) $(T1) $(D1);\ if [ -r $(D1)/$(T1) ]; then \ echo "Installed $(T1) in directory $(D1)";fi;fi @if [ "$(T2)" != "" ]; then \ $(INSTALL) $(T2) $(D2);\ if [ -r $(D2)/$(T2) ]; then \ echo "Installed $(T2) in directory $(D2)";fi;fi @if [ "$(T3)" != "" ]; then \ $(INSTALL) $(T3) $(D3);\ if [ -r $(D3)/$(T3) ]; then \ echo "Installed $(T3) in directory $(D3)";fi;fi @if [ "$(T4)" != "" ]; then \ $(INSTALL) $(T4) $(D4);\ if [ -r $(D4)/$(T4) ]; then \ echo "Installed $(T4) in directory $(D4)"; fi;fi @if [ "$(T5)" != "" ]; then \ $(INSTALL) $(T5) $(D5);\ if [ -r $(D5)/$(T5) ]; then \ echo "Installed $(T5) in directory $(D5)";fi;fi @if [ "$(T6)" != "" ]; then \ $(INSTALL) $(T6) $(D6);\ if [ -r $(D6)/$(T6) ]; then \ echo "Installed $(T6) in directory $(D6)";fi;fi @if [ "$(T7)" != "" ]; then \ $(INSTALL) $(T7) $(D7);\ if [ -r $(D7)/$(T7) ]; then \ echo "Installed $(T7) in directory $(D7)";fi;fi @if [ "$(T8)" != "" ]; then \ $(INSTALL) $(T8) $(D8);\ if [ -r $(D8)/$(T8) ]; then \ echo "Installed $(T8) in directory $(D8)";fi;fi @if [ "$(T9)" != "" ]; then \ $(INSTALL) $(T9) $(D9);\ if [ -r $(D9)/$(T9) ]; then \ echo "Installed $(T9) in directory $(D9)";fi;fi @if [ "$(T10)" != "" ]; then \ $(INSTALL) $(T10) $(D10);\ if [ -r $(D10)/$(T10) ]; then \ echo "Installed $(T10) in directory $(D10)";fi;fi @if [ "$(T11)" != "" ]; then \ $(INSTALL) $(T11) $(D11);\ if [ -r $(D11)/$(T11) ]; then \ echo "Installed $(T11) in directory $(D11)";fi;fi @if [ "$(T12)" != "" ]; then \ $(INSTALL) $(T12) $(D12);\ if [ -r $(D12)/$(T12) ]; then \ echo "Installed $(T12) in directory $(D12)";fi;fi @if [ "$(T13)" != "" ]; then \ $(INSTALL) $(T13) $(D13);\ if [ -r $(D13)/$(T13) ]; then \ echo "Installed $(T13) in directory $(D13)";fi;fi @if [ "$(T14)" != "" ]; then \ $(INSTALL) $(T14) $(D14);\ if [ -r $(D14)/$(T14) ]; then \ echo "Installed $(T14) in directory $(D14)";fi;fi @if [ "$(T15)" != "" ]; then \ $(INSTALL) $(T15) $(D15);\ if [ -r $(D15)/$(T15) ]; then \ echo "Installed $(T15) in directory $(D15)";fi;fi uninstall: @if [ "$(T1)" != "" ]; then \ if [ -r $(D1)/$(T1) ]; then \ $(UNINSTALL) $(D1)/$(T1);\ echo "Uninstalled $(D1)/$(T1)" ;fi; fi @if [ "$(T2)" != "" ]; then \ if [ -r $(D2)/$(T2) ]; then \ $(UNINSTALL) $(D2)/$(T2);\ echo "Uninstalled $(D2)/$(T2)" ;fi; fi @if [ "$(T3)" != "" ]; then \ if [ -r $(D3)/$(T3) ]; then \ $(UNINSTALL) $(D3)/$(T3);\ echo "Uninstalled $(D3)/$(T3)" ;fi; fi @if [ "$(T4)" != "" ]; then \ if [ -r $(D4)/$(T4) ]; then \ $(UNINSTALL) $(D4)/$(T4);\ echo "Uninstalled $(D4)/$(T4)" ;fi; fi @if [ "$(T5)" != "" ]; then \ if [ -r $(D5)/$(T5) ]; then \ $(UNINSTALL) $(D5)/$(T5);\ echo "Uninstalled $(D5)/$(T5)" ;fi; fi @if [ "$(T6)" != "" ]; then \ if [ -r $(D6)/$(T6) ]; then \ $(UNINSTALL) $(D6)/$(T6);\ echo "Uninstalled $(D6)/$(T6)" ;fi; fi @if [ "$(T7)" != "" ]; then \ if [ -r $(D7)/$(T7) ]; then \ $(UNINSTALL) $(D7)/$(T7);\ echo "Uninstalled $(D7)/$(T7)" ;fi; fi @if [ "$(T8)" != "" ]; then \ if [ -r $(D8)/$(T8) ]; then \ $(UNINSTALL) $(D8)/$(T8);\ echo "Uninstalled $(D8)/$(T8)" ;fi; fi @if [ "$(T9)" != "" ]; then \ if [ -r $(D9)/$(T9) ]; then \ $(UNINSTALL) $(D9)/$(T9);\ echo "Uninstalled $(D9)/$(T9)" ;fi; fi @if [ "$(T10)" != "" ]; then \ if [ -r $(D10)/$(T10) ]; then \ $(UNINSTALL) $(D10)/$(T10);\ echo "Uninstalled $(D10)/$(T10)" ;fi; fi @if [ "$(T11)" != "" ]; then \ if [ -r $(D11)/$(T11) ]; then \ $(UNINSTALL) $(D11)/$(T11);\ echo "Uninstalled $(D11)/$(T11)" ;fi; fi @if [ "$(T12)" != "" ]; then \ if [ -r $(D12)/$(T12) ]; then \ $(UNINSTALL) $(D12)/$(T12);\ echo "Uninstalled $(D12)/$(T12)" ;fi; fi @if [ "$(T13)" != "" ]; then \ if [ -r $(D13)/$(T13) ]; then \ $(UNINSTALL) $(D13)/$(T13);\ echo "Uninstalled $(D13)/$(T13)" ;fi; fi @if [ "$(T14)" != "" ]; then \ if [ -r $(D14)/$(T14) ]; then \ $(UNINSTALL) $(D14)/$(T14);\ echo "Uninstalled $(D14)/$(T14)" ;fi; fi @if [ "$(T15)" != "" ]; then \ if [ -r $(D15)/$(T15) ]; then \ $(UNINSTALL) $(D15)/$(T15);\ echo "Uninstalled $(D15)/$(T15)" ;fi; fi ## # Include depend files # -include $(depends) --------------B5CC7FF9963809C34E609AAA--