Subversion Repositories gelsvn

Rev

Rev 138 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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