[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: |
Eric Lilja |
Subject: |
Re: gnu make: all generated files except executable should go to subdirectory |
Date: |
Tue, 15 Mar 2005 10:49:08 +0100 |
"Paul D. Smith" wrote:
> %% "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
Thanks Paul, you solved my Makefile problems!
/ Eric