Subversion Repositories gelsvn

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 bj 1
SHELL = /bin/sh
2
 
3
.SUFFIXES:
4
.SUFFIXES: .cpp .o .c
5
 
137 jab 6
### the user configuration makefile
7
include ${SOURCEROOT}/makefiles/config.mk
2 bj 8
 
9
### Include platform specific makefile
10
include  ${SOURCEROOT}/makefiles/${PLATFORM}.mk
11
 
12
### BUILD is the subdirectory where all builds reside.
13
BUILD								= .build
14
 
15
### BUILDDIR is the directory where the compilation for a specific 
16
### platform and target combination takes place.
17
BUILDDIR						= ./${BUILD}/$(PLATFORM_TARG)
18
 
19
### Append path to compiler flags
178 bj 20
CXXFLAGS						+= -I${SOURCEROOT}/src 
2 bj 21
 
22
### Generate list of source files.
23
sources							= $(shell ls *.cpp)
24
### Generate list if object files from list of sources.
25
objects							= $(sources:.cpp=.o)
26
### Generate list if dependency files from list of sources.
27
deps								= $(addprefix ${BUILDDIR}/,$(sources:.cpp=.d))
28
 
29
### Set up vpath so that make finds object files in builddir
30
### hence does not rebuild unneccesarily
31
VPATH 							= ${BUILDDIR}
32
 
137 jab 33
 
34
### Make dependencies,
35
ifneq (clean,$(findstring clean,${MAKECMDGOALS}))
36
${BUILDDIR}/%.d:%.cpp 
37
	$(shell if \[ \! -d ${BUILDDIR} \] ; then mkdir -p ${BUILDDIR} ; fi)
38
	$(CXX) ${DEPFLAGS} ${CXXFLAGS} $< > $@
39
 
2 bj 40
### Include dependencies - but not if we are cleaning
41
include ${deps}
42
endif
43
 
44
### Rule for building object files from C++ source files
137 jab 45
%.o: %.cpp 
46
	$(shell if \[ \! -d ${BUILDDIR} \] ; then mkdir -p ${BUILDDIR} ; fi)
2 bj 47
	${CXX} -c ${CXXFLAGS} -o ${BUILDDIR}/$@ $<
48
 
49
### Rule for building object files from C source files
50
### I use a C++ compiler. I think this is best.
137 jab 51
%.o: %.c 
52
	$(shell if \[ \! -d ${BUILDDIR} \] ; then mkdir -p ${BUILDDIR} ; fi)
2 bj 53
	${CXX} -c ${CXXFLAGS} -o ${BUILDDIR}/$@ $<
54
 
55