Subversion Repositories gelsvn

Rev

Rev 189 | Rev 349 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 bj 1
SHELL = /bin/sh
2
########################################################################
3
#
4
# Central makefile. Descends all source directories, making recursively.
5
#
6
# Targets:
7
#
8
#  all       - make all libraries, then all applications
9
#  cvs       - add all cpp h and Makefile files to cvs
10
#  lib       - make all libraries
11
#  app       - make all applications
12
#  clean     - clean all library directories and app directories.
13
#  this removes only files pertaining to the current platform and
14
#	 target (release/debug). This also removes generated libraries.
15
#  distclean - removes all build directories. 
16
#  platform  - copies a template to OS_CPU_COMPILER.mk in the makefiles
17
#			directory
18
#
19
########################################################################
20
 
21
override SOURCEROOT		= $(shell pwd)
22
 
138 jab 23
include makefiles/config.mk
2 bj 24
 
54 jab 25
INSTALL_PREFIX = /usr/local
26
LIBSRC 				 = ./src
27
LIBRARIES 		 =$(dir $(shell cd ${LIBSRC}; find . -type f -name 'Makefile'))
113 jab 28
 
54 jab 29
APPSRC 			 	 = ./apps
30
APPLICATIONS 	 = $(dir $(shell cd ${APPSRC}; find . -type f -name 'Makefile'))
2 bj 31
 
113 jab 32
TESTSRC 			 	 = ./test
33
TESTAPPS 	 = $(dir $(shell cd ${TESTSRC}; find . -type f -name 'Makefile'))
2 bj 34
 
113 jab 35
.PHONY: test app lib clean distclean platform makefiles
2 bj 36
 
178 bj 37
all: lib shared test app
113 jab 38
 
2 bj 39
lib: 
54 jab 40
	$(foreach lib, ${LIBRARIES},	${MAKE} -C ${LIBSRC}/${lib};)
2 bj 41
 
178 bj 42
test:
43
	$(foreach test, ${TESTAPPS},	${MAKE} -C ${TESTSRC}/${test};)
44
 
2 bj 45
app:
54 jab 46
	$(foreach app, ${APPLICATIONS},	${MAKE} -C ${APPSRC}/${app};)
2 bj 47
 
178 bj 48
shared:
321 jab 49
	cd ${LIBDIR}; gcc -dynamiclib -o libGEL_${TARGET}.so *.a 
50
#	cd ${LIBDIR}; gcc -shared -o libGEL_${TARGET}.so -Wl,--whole-archive *.a -Wl,--no-whole-archive
113 jab 51
 
187 jab 52
 
54 jab 53
install:
54
	$(foreach lib, ${LIBRARIES}, mkdir -p ${INSTALL_PREFIX}/include/GEL/${lib}; cp ${SOURCEROOT}/src/${lib}*.h ${INSTALL_PREFIX}/include/GEL/${lib};)
55
	mkdir -p ${INSTALL_PREFIX}/lib/GEL_${TARGET}
178 bj 56
	cp ${LIBDIR}/*.a ${INSTALL_PREFIX}/lib/GEL_${TARGET}/.
57
	cp ${LIBDIR}/libGEL_${TARGET}.so ${INSTALL_PREFIX}/lib/.
58
	ldconfig
54 jab 59
 
2 bj 60
clean:
54 jab 61
	$(foreach lib, ${LIBRARIES},	${MAKE} -C ${LIBSRC}/${lib} clean;)
62
	$(foreach app, ${APPLICATIONS},	${MAKE} -C ${APPSRC}/${app} clean;)
113 jab 63
	$(foreach app, ${TESTAPPS},	${MAKE} -C ${TESTSRC}/${app} clean;)
2 bj 64
 
65
distclean: clean
66
	find ./lib -type d \! \( -name 'CVS' -o -name 'lib' \) -print > .remove
67
	find ./bin -type f -print >> .remove
68
	find . -name '.build' -type d -print >> .remove
69
	find . -type f -name '*.o' -o -name '*.d' -o -name 'core' -o -name '*~' -print >> .remove
70
	${RM} -fr `cat .remove`
71
	${RM} -f  .remove
72
 
73
platform: makefiles/${PLATFORM}.mk lib/${PLATFORM}
74
 
75
makefiles/${PLATFORM}.mk:
76
	cp makefiles/PlatformTemplate.mk makefiles/${PLATFORM}.mk
77
 
78
lib/${PLATFORM}:
79
	mkdir lib/${PLATFORM}