[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnu make: all generated files except executable should go to subdire
From: |
Paul D. Smith |
Subject: |
Re: gnu make: all generated files except executable should go to subdirectory |
Date: |
14 Mar 2005 21:38:01 -0500 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
%% "Eric Lilja" <mindcooler_thisshouldberemoved@gmail.com> writes:
el> CXX = g++
el> CXXFLAGS = -Wall -W -ansi -pedantic -g -c -o
el> LD = g++
el> LDFLAGS = -o $(EXEC)
el> OBJECTS = my_recipes_database.o read_recipe_file.o
el> EXEC = add_recipes
el> SRC = src/
A "standard" GNU make makefile would look something like this:
CXX = g++
CXXFLAGS = -Wall -W -ansi -pedantic -g
OBJECTS = my_recipes_database.o read_recipe_file.o
EXEC = add_recipes
SRC = src/
BLD = build/
all: $(EXEC)
$(EXEC): $(addprefix $(BLD),$(OBJECTS))
$(CXX) $^ -o $@
$(BLD)%.o: $(SRC)%.cpp
$(COMPILE.cc) -o $@ $<
clean:
rm -f $(BLD)*.o $(EXEC) *~
(COMPILE.cc is a builtin variable)
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@gnu.org> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist