Subversion Repositories gelsvn

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 bj 1
# application.mk - Application makefile. This makefile is included from
2
# Application directories.
3
#
4
#
5
#
6
 
7
### Make sure app is primary goal
8
all: app
9
 
10
### Include common rules and defs
11
include ${SOURCEROOT}/makefiles/common.mk
12
 
13
### Set up load libraries
54 jab 14
LOADLIBES  	= $(addprefix -lGEL_,${OWN_LIBS}) ${LIBS}
2 bj 15
 
16
### Where to find libraries
17
LDFLAGS 		+= -L${LIBDIR} -L${SOURCEROOT}/lib/${PLATFORM}
18
 
19
### Generate a list of object files that are not programs.
20
not_main_objects = $(filter-out $(addsuffix .o,${PROGRAMS}), ${objects})
21
 
22
######################################################################
23
############ We are building #########################################
24
######################################################################
25
clean:
26
	rm -fr ${BUILDDIR}
27
 
28
# The force target is useful for recompiling libraries. Thus if the appliaction
29
# or any library it depends on have been changed, we only have to go
30
# > make force 
31
# in the directory containing the application. Application is also compiled
32
# and linked.
33
force:  ${not_main_objects}
6 jab 34
	$(foreach lib, ${OWN_LIBS},	${MAKE} -C ${SOURCEROOT}/src/${lib};)
2 bj 35
	${MAKE} ${PROGRAMS}
36
	$(foreach prg, ${PROGRAMS},	${INSTALL} ${BUILDDIR}/${prg} ${SOURCEROOT}/bin/${prg};)
37
 
38
# app is default target. Compiles and links all applications.
39
app: ${not_main_objects}
40
	${MAKE} ${PROGRAMS}
41
	$(foreach prg, ${PROGRAMS},	${INSTALL} ${BUILDDIR}/${prg} ${SOURCEROOT}/bin;)
42
 
43
 
44
# Link application. .FORCE ensures that we always link. I haven't found a 
45
# great way to make compilation depend on the timestamp of the libraries, but
46
# always linking solves the problem at moderate cost.
47
%:%.o .FORCE
48
	${CXX} -o ${BUILDDIR}/$@ ${BUILDDIR}/$@.o \
49
	${CXXFLAGS} ${LDFLAGS} $(addprefix ${BUILDDIR}/,${not_main_objects}) \
50
	${LOADLIBES}
51
 
52
.FORCE:
53
 
54