“Krupa” <firstname.lastname@example.org> wrote in message
I need to create a makefile for my project. We need to use options in
such a way that executable files, source files and obj files will be
in separate directories. How to route obj files to a specfic directory
(which is not same as diretory in which source code is stored)?
Sorry for other post I hit a wrong key:
Here is a very strip down version of a Makefile file I sometime use under
INCPATH defines location of header files. OBJPATH defines location of
files. TARGET is the full path of where to store the executable
I like to have my makefile automaticaly build list of object files from the
sources in the directory, but I wanted to keep things simple here.
Check out use of vpath to tell make where to search for certain files.
Personnaly I have not yet master the use of vpath and have manage
INCPATH = -Iinclude
TARGET = exec/application
OBJECT = src1.o src2.o src3.o
SRC = src1.c src2.c src3.c
OBJPATH = obj
automatical prefix object files with the path
OBJLIST= $(addprefix $(OBJPATH)/,$(OBJECT1))
$(LD) $(LDFLAGS) $(OBJLIST) -o $@
CFLAGS = $(INCPATH) -o$@