emp1953 wrote: > Below is my makefile > It works fine as it is > I want to put all the .o files into the ../bin/ directory OBJDIR > then upon a clean I want the .o's removed from that directory > I was able to get the executable to go into the ../exe/ directory and > it is removed upon a clean. > > I cannot get it the .o's to work. any help would be appreciated. > >
If you are using GNU Make... Note - CXX and CXXFLAGS are normally used for C++ in Makefiles because that's what GNU Make's built-in rules use. CC & CFLAGS are used by Make's built-in rules for C files. If using GNU Make, most of the built-in compile & link rules can be used without writing your own > CC=g++ > CFLAGS=-c -Wall > LDFLAGS= OBJDIR=../bin > SOURCES=a.cpp \ > b.cpp \ > c.cpp \ > d.cpp \ > e.cpp OBJECTS=$(addprefix $(OBJDIR)/,$(SOURCES:.cpp=.o)) > EXECUTABLE=../exe/msg_broker > all : $(EXECUTABLE) > $(EXECUTABLE): $(OBJECTS) > $(CC) $(LDFLAGS) $(OBJECTS) -o $@ > $(OBJDIR)/%.o: %.cpp $(CC) $(CFLAGS) -o $@ $< clean: -rm -rf $(OBJECTS) -rm -rf $(EXECUTABLE) _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus