Rev 321 | Blame | Last modification | View Log | RSS feed
SHELL = /bin/sh
########################################################################
#
# Central makefile. Descends all source directories, making recursively.
#
# Targets:
#
# all - make all libraries, then all applications
# cvs - add all cpp h and Makefile files to cvs
# lib - make all libraries
# app - make all applications
# clean - clean all library directories and app directories.
# this removes only files pertaining to the current platform and
# target (release/debug). This also removes generated libraries.
# distclean - removes all build directories.
# platform - copies a template to OS_CPU_COMPILER.mk in the makefiles
# directory
#
########################################################################
override SOURCEROOT = $(shell pwd)
include makefiles/config.mk
INSTALL_PREFIX = /usr/local
LIBSRC = ./src
LIBRARIES =$(dir $(shell cd ${LIBSRC}; find . -type f -name 'Makefile'))
APPSRC = ./apps
APPLICATIONS = $(dir $(shell cd ${APPSRC}; find . -type f -name 'Makefile'))
TESTSRC = ./test
TESTAPPS = $(dir $(shell cd ${TESTSRC}; find . -type f -name 'Makefile'))
.PHONY: test app lib clean distclean platform makefiles
all: lib shared test app
lib:
$(foreach lib, ${LIBRARIES}, ${MAKE} -C ${LIBSRC}/${lib};)
test:
$(foreach test, ${TESTAPPS}, ${MAKE} -C ${TESTSRC}/${test};)
app:
$(foreach app, ${APPLICATIONS}, ${MAKE} -C ${APPSRC}/${app};)
shared:
# cd ${LIBDIR}; gcc -dynamiclib -o libGEL_${TARGET}.so *.a
cd ${LIBDIR}; gcc -shared -o libGEL_${TARGET}.so -Wl,--whole-archive *.a -Wl,--no-whole-archive
install:
$(foreach lib, ${LIBRARIES}, mkdir -p ${INSTALL_PREFIX}/include/GEL/${lib}; cp ${SOURCEROOT}/src/${lib}*.h ${INSTALL_PREFIX}/include/GEL/${lib};)
mkdir -p ${INSTALL_PREFIX}/lib/GEL_${TARGET}
cp ${LIBDIR}/*.a ${INSTALL_PREFIX}/lib/GEL_${TARGET}/.
cp ${LIBDIR}/libGEL_${TARGET}.so ${INSTALL_PREFIX}/lib/.
ldconfig
clean:
$(foreach lib, ${LIBRARIES}, ${MAKE} -C ${LIBSRC}/${lib} clean;)
$(foreach app, ${APPLICATIONS}, ${MAKE} -C ${APPSRC}/${app} clean;)
$(foreach app, ${TESTAPPS}, ${MAKE} -C ${TESTSRC}/${app} clean;)
distclean: clean
find ./lib -type d \! \( -name 'CVS' -o -name 'lib' \) -print > .remove
find ./bin -type f -print >> .remove
find . -name '.build' -type d -print >> .remove
find . -type f -name '*.o' -o -name '*.d' -o -name 'core' -o -name '*~' -print >> .remove
${RM} -fr `cat .remove`
${RM} -f .remove
platform: makefiles/${PLATFORM}.mk lib/${PLATFORM}
makefiles/${PLATFORM}.mk:
cp makefiles/PlatformTemplate.mk makefiles/${PLATFORM}.mk
lib/${PLATFORM}:
mkdir lib/${PLATFORM}