Subversion Repositories gelsvn

Rev

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

Rev 137 Rev 138
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
### Use a shell script to guess the compiler
-
 
10
ifeq ($(strip ${CXX}),)
-
 
11
CXX = $(shell ${SOURCEROOT}/makefiles/findcompiler.sh)
-
 
12
endif
-
 
13
 
-
 
14
### Define operating system and CPU
-
 
15
OS =$(subst ${empty} ${empty},_,$(shell uname -s))
-
 
16
CPU =$(subst ${empty} ${empty},_,$(shell uname -m))
-
 
17
 
-
 
18
### Define the empty string
-
 
19
empty =
-
 
20
 
-
 
21
### The platform is determined by OS CPU and compiler 
-
 
22
PLATFORM = ${OS}_${CPU}_${CXX}
-
 
23
 
-
 
24
### Default target is release, unless debug is given as goal
-
 
25
ifndef TARGET
-
 
26
TARGET = release
-
 
27
endif
-
 
28
 
-
 
29
### Concatenation of platform and target yields a string used as 
-
 
30
### suffix of makefiles and in the name of the builddir.
-
 
31
PLATFORM_TARG = ${PLATFORM}_$(TARGET)
-
 
32
 
-
 
33
### Include platform specific makefile
9
### Include platform specific makefile
34
include  ${SOURCEROOT}/makefiles/${PLATFORM}.mk
10
include  ${SOURCEROOT}/makefiles/${PLATFORM}.mk
35
 
11
 
36
### BUILD is the subdirectory where all builds reside.
12
### BUILD is the subdirectory where all builds reside.
37
BUILD								= .build
13
BUILD								= .build
38
 
14
 
39
### BUILDDIR is the directory where the compilation for a specific 
15
### BUILDDIR is the directory where the compilation for a specific 
40
### platform and target combination takes place.
16
### platform and target combination takes place.
41
BUILDDIR						= ./${BUILD}/$(PLATFORM_TARG)
17
BUILDDIR						= ./${BUILD}/$(PLATFORM_TARG)
42
 
18
 
43
### LIBDIR is the directory where we stick .a files pertaining to 
19
### LIBDIR is the directory where we stick .a files pertaining to 
44
### the specific combination of platform and target.
20
### the specific combination of platform and target.
45
LIBDIR							= ${SOURCEROOT}/lib/${PLATFORM_TARG}
21
LIBDIR							= ${SOURCEROOT}/lib/${PLATFORM_TARG}
46
 
22
 
47
### BINDIR is the directory where binary files are put.
23
### BINDIR is the directory where binary files are put.
48
BINDIR							= ${SOURCEROOT}/bin
24
BINDIR							= ${SOURCEROOT}/bin
49
 
25
 
50
### Append path to compiler flags
26
### Append path to compiler flags
51
CXXFLAGS						+= -I${SOURCEROOT}/src -I${SOURCEROOT}/include
27
CXXFLAGS						+= -I${SOURCEROOT}/src -I${SOURCEROOT}/include
52
 
28
 
53
### Generate list of source files.
29
### Generate list of source files.
54
sources							= $(shell ls *.cpp)
30
sources							= $(shell ls *.cpp)
55
### Generate list if object files from list of sources.
31
### Generate list if object files from list of sources.
56
objects							= $(sources:.cpp=.o)
32
objects							= $(sources:.cpp=.o)
57
### Generate list if dependency files from list of sources.
33
### Generate list if dependency files from list of sources.
58
deps								= $(addprefix ${BUILDDIR}/,$(sources:.cpp=.d))
34
deps								= $(addprefix ${BUILDDIR}/,$(sources:.cpp=.d))
59
 
35
 
60
### Set up vpath so that make finds object files in builddir
36
### Set up vpath so that make finds object files in builddir
61
### hence does not rebuild unneccesarily
37
### hence does not rebuild unneccesarily
62
VPATH 							= ${BUILDDIR}
38
VPATH 							= ${BUILDDIR}
63
 
39
 
64
 
40
 
65
### Make dependencies,
41
### Make dependencies,
66
ifneq (clean,$(findstring clean,${MAKECMDGOALS}))
42
ifneq (clean,$(findstring clean,${MAKECMDGOALS}))
67
${BUILDDIR}/%.d:%.cpp 
43
${BUILDDIR}/%.d:%.cpp 
68
	$(shell if \[ \! -d ${BUILDDIR} \] ; then mkdir -p ${BUILDDIR} ; fi)
44
	$(shell if \[ \! -d ${BUILDDIR} \] ; then mkdir -p ${BUILDDIR} ; fi)
69
	$(CXX) ${DEPFLAGS} ${CXXFLAGS} $< > $@
45
	$(CXX) ${DEPFLAGS} ${CXXFLAGS} $< > $@
70
 
46
 
71
### Include dependencies - but not if we are cleaning
47
### Include dependencies - but not if we are cleaning
72
include ${deps}
48
include ${deps}
73
endif
49
endif
74
 
50
 
75
### Rule for building object files from C++ source files
51
### Rule for building object files from C++ source files
76
%.o: %.cpp 
52
%.o: %.cpp 
77
	$(shell if \[ \! -d ${BUILDDIR} \] ; then mkdir -p ${BUILDDIR} ; fi)
53
	$(shell if \[ \! -d ${BUILDDIR} \] ; then mkdir -p ${BUILDDIR} ; fi)
78
	${CXX} -c ${CXXFLAGS} -o ${BUILDDIR}/$@ $<
54
	${CXX} -c ${CXXFLAGS} -o ${BUILDDIR}/$@ $<
79
 
55
 
80
### Rule for building object files from C source files
56
### Rule for building object files from C source files
81
### I use a C++ compiler. I think this is best.
57
### I use a C++ compiler. I think this is best.
82
%.o: %.c 
58
%.o: %.c 
83
	$(shell if \[ \! -d ${BUILDDIR} \] ; then mkdir -p ${BUILDDIR} ; fi)
59
	$(shell if \[ \! -d ${BUILDDIR} \] ; then mkdir -p ${BUILDDIR} ; fi)
84
	${CXX} -c ${CXXFLAGS} -o ${BUILDDIR}/$@ $<
60
	${CXX} -c ${CXXFLAGS} -o ${BUILDDIR}/$@ $<
85
 
61
 
86
 
62
 
87
 
63