[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnu make: all generated files except executable should go to subdirector
From: |
Eric Lilja |
Subject: |
gnu make: all generated files except executable should go to subdirectory |
Date: |
Mon, 14 Mar 2005 21:55:39 +0100 |
Hello, I have another gnu make question. I am using it to compile a C++
program and I want all generated files except the final executable to be
placed in subdirectory build/. Apart from object files additional files are
also generated by the compiler.
Given this Makefile, what needs to change to accomplish what I want:
CXX = g++
CXXFLAGS = -Wall -W -ansi -pedantic -g -c -o
LD = g++
LDFLAGS = -o $(EXEC)
OBJECTS = my_recipes_database.o read_recipe_file.o
EXEC = add_recipes
SRC = src/
all: $(OBJECTS)
$(LD) $(OBJECTS) $(LDFLAGS)
%.o: $(SRC)%.cpp
$(CXX) $(CXXFLAGS) $@ $<
clean:
rm -f $(OBJECTS) $(EXEC) *~
This Makefile makes gnu make look for the source files in the source
directory (good, I want that), but it puts all generated files in the
current directory and I want it to put all generated files except the
executable produced when linking to be put in subdirectory
called build.
Thanks for reading and replying
/ Eric
- gnu make: all generated files except executable should go to subdirectory,
Eric Lilja <=