Thanks for your replies. I haven't fixed this yet. > Why don't you provide a sample of the makefile that doesn't work?
Here is the essence of my makefile (which makes a static library): ==================================================== # List the object files that comprise this library OBJFILES = ErrorHandler.o \ EnvVars.o \ EVD.o \ <snip> include $(TRUNKDIR)/LibCommon.mk ==================================================== and here is LibCommon.mk: ==================================================== # Set include path CXXFLAGS += $(patsubst %,-I%,$(INCPATH)) # Debug mode CXXFLAGS_D=$(CXXFLAGS) CXXFLAGS_D+=-g # Release mode. Optimise for speed CXXFLAGS_R=$(CXXFLAGS) CXXFLAGS_R+=-O3 # Ensure that output directories exist REQUIRED_DIRS := $(shell mkdir -p $(OBJDIR_D); mkdir -p $(OBJDIR_R) ) # This is the default target. # Running make with no command line arguments will build the release mode version of the library. .PHONY : release release : $(OBJDIR_R)/lib$(STATICLIBNAME).a # Running 'make debug' will build the debug mode version of the library. .PHONY : debug debug : $(OBJDIR_D)/lib$(STATICLIBNAME).a # Running 'make all' will build the debug and release mode versions of the library. .PHONY : all all : release debug # Running 'make clean' will remove the output files .PHONY: clean clean: @rm -rf $(OBJDIR_D) @rm -rf $(OBJDIR_R) # Below are the rules for building the debug or release library. Note that # included in each rule is a command to run versionInfo on the source files # of the library. versionInfo generates SourceFileInfo.cpp, which is compiled # and linked into the library and then deleted. # Rule for building release library $(OBJDIR_R)/lib$(STATICLIBNAME).a : $(patsubst %,$(OBJDIR_R)/%,$(OBJFILES)) $(TRUNKDIR)/$(SVI) $(CURDIR) KERNEL $(CXX) -c $(CXXFLAGS_R) SourceFileInfo.cpp -o $(OBJDIR_R)/SourceFileInfo.o @rm -f SourceFileInfo.cpp $(AR) $(ARFLAGS) $@ $^ $(OBJDIR_R)/SourceFileInfo.o # Rule for building debug library $(OBJDIR_D)/lib$(STATICLIBNAME).a : $(patsubst %,$(OBJDIR_D)/%,$(OBJFILES)) $(TRUNKDIR)/$(SVI) $(CURDIR) KERNEL $(CXX) -c $(CXXFLAGS_D) SourceFileInfo.cpp -o $(OBJDIR_D)/SourceFileInfo.o @rm -f SourceFileInfo.cpp $(AR) $(ARFLAGS) $@ $^ $(OBJDIR_D)/SourceFileInfo.o # Include dependency files to ensure they get updated ifneq "$(MAKECMDGOALS)" "clean" -include $(patsubst %.o,$(OBJDIR_R)/%.d,$(OBJFILES)) -include $(patsubst %.o,$(OBJDIR_D)/%.d,$(OBJFILES)) endif # Rule for compiling in release mode $(OBJDIR_R)/%.o : %.cpp @$(call make-depend,$<,$@,$(patsubst %.o,%.d,$@),$(CXXFLAGS_R)) # Rule for compiling in debug mode $(OBJDIR_D)/%.o : %.cpp @$(call make-depend,$<,$@,$(patsubst %.o,%.d,$@),$(CXXFLAGS_D)) # $(call make-depend,source-file,object-file,depend-file,cxxflags) # Compile and create a dependency file define make-depend @echo $(CXX) -c $4 $1 -o $2; \ $(CXX) -c -MMD -MP -MF $3.$$$$ $4 $1 -o $2; \ sed 's,\($*\)\.o[ :]*,$(notdir $2) $3 : ,g' < $3.$$$$ > $3; \ rm -f $3.$$$$ endef ==================================================== Any comments would be appreciated. best regards David _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make