Subversion Repositories gelsvn

Rev

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