Subversion Repositories gelsvn

Rev

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

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