From dd574ba3eabee4f9f8661ea21619b6352cb9a935 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Mon, 7 Dec 2009 20:08:54 +0100 Subject: fixed postgres tests, synched makefile system with the one from sqlite3xx --- makefiles/gmake/clean.mk | 32 +++--- makefiles/gmake/compiler.mk | 240 +++++++++++++++++++++++++++++++++++++++----- makefiles/gmake/depend.mk | 56 ++++++++++- makefiles/gmake/dist.mk | 40 ++++++++ makefiles/gmake/guess_env | 180 +++++++++++++++++++++++++++------ makefiles/gmake/help.mk | 15 +++ makefiles/gmake/i18n.mk | 103 +++++++++++++++++++ makefiles/gmake/install.mk | 64 ++++++++++++ makefiles/gmake/libs.mk | 53 ++++++++++ makefiles/gmake/platform.mk | 219 ++++++++++++++++++++++++++++++++++++++-- makefiles/gmake/sub.mk | 7 +- makefiles/gmake/top.mk | 48 ++++++++- 12 files changed, 969 insertions(+), 88 deletions(-) create mode 100644 makefiles/gmake/dist.mk create mode 100644 makefiles/gmake/help.mk create mode 100644 makefiles/gmake/i18n.mk create mode 100644 makefiles/gmake/install.mk create mode 100644 makefiles/gmake/libs.mk (limited to 'makefiles') diff --git a/makefiles/gmake/clean.mk b/makefiles/gmake/clean.mk index efeef68..92061d4 100644 --- a/makefiles/gmake/clean.mk +++ b/makefiles/gmake/clean.mk @@ -1,9 +1,12 @@ # cleans up directories # # requires: -# - BINS, OBJS, CPPOBJS, BIN_OBJS -# - CMODULES, CPPMODULES -# - SUBDIRS +# - SUBDIRS: for recursive cleaning +# - local_clean, local_distclean targets in local GNUmakefile +# - all artifacts to clean: +# - BINS, TEST_BINS, TEST_CPP_BINS, CPP_BINS +# - OBJS, CPPOBJS, BIN_OBJS, TEST_BIN_OBJS, CPP_BIN_OBJS, TEST_CPP_BIN_OBJS +# - CMODULES, CPPMODULES # # provides: # - target: clean @@ -15,16 +18,19 @@ clean_recursive: @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ (set -e; $(MAKE) -C $$d clean || exit 1); done) -clean: clean_recursive local_clean - -@rm *.bak 2>/dev/null - -@rm *~ 2>/dev/null - -@rm *.d port/*.d 2>/dev/null - -@rm $(BINS) $(CPP_BINS) 2>/dev/null - -@rm $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) 2>/dev/null - -@rm exec/* - -@rm *.core - -@rm $(CMODULES) $(CPPMODULES) - -@rm $(CMODULES .o=.d) $(CPPMODULES .o=.d) +clean: clean_recursive clean_po local_clean + -@rm -f *.bak 2>/dev/null + -@rm -f *~ 2>/dev/null + -@rm -f *.d port/*.d 2>/dev/null + -@rm -f $(BINS) $(CPP_BINS) $(TEST_BINS) $(TEST_CPP_BINS) 2>/dev/null + -@rm -f $(OBJS) $(CPP_OBJS) $(BIN_OBJS) $(TEST_BIN_OBJS) $(CPP_BIN_OBJS) $(TEST_CPP_BIN_OBJS) 2>/dev/null + -@rm -f exec/* 2>/dev/null + -@rm -f *.core 2>/dev/null + -@rm -f $(CMODULES) $(CPPMODULES) 2>/dev/null + -@rm -f $(CMODULES:.o=.d) $(CPPMODULES:.o=.d) 2>/dev/null + -@rm -rf $(STATIC_LIB) 2>/dev/null + -@rm -rf $(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) 2>/dev/null + -@rm -f $(SH_OBJS) rm -f $(SHPP_OBJS) 2>/dev/null .PHONY: distclean_recursive distclean local_distclean diff --git a/makefiles/gmake/compiler.mk b/makefiles/gmake/compiler.mk index 4f93160..01e9837 100644 --- a/makefiles/gmake/compiler.mk +++ b/makefiles/gmake/compiler.mk @@ -4,9 +4,20 @@ # - INCLUDE_DIRS # # provides: -# - BIN_OBJS: the object files we need for the binaries (containing the main) +# - BIN_OBJS: the object files we need for the binaries which we build always +# - CPP_BIN_OBJS: same for binaries which have C++ code in them +# - TEST_BIN_OBJS: same as BIN_OBJS but for test binaries compiled only when +# testing +# - TEST_CPP_BIN_OBJS: same for C++ tests # +# start of gcc section + +ifeq "$(COMPILER)" "gcc" + +GCC_MAJOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --gcc-major-version $(CC) "$(CURDIR)" $(TOPDIR)) +GCC_MINOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --gcc-minor-version $(CC) "$(CURDIR)" $(TOPDIR)) + # -Wswitch-default: not good for switches with enums # -Wsystem-headers: bad idea, as header files are usually happily broken :-) # -Wtraditional: we don't want to program tradition K&R C anymore! @@ -22,12 +33,13 @@ # -fstack-protector-all: does something funny to the shared objects.. # -Wstack-protector makes no sense without SSP # everything implied by -Wall is not explicitly specified (gcc 4.2.3) +# TODO: reenable -O2 # -Waggregate-return: is for K&R code and mostly useless nowadays -# -funit-at-a-time: TODO check first gcc version it appears +# -Wno-long-long: sqlite.h on FreeBSD 6.2 shows problems otherwise # compilation flags and compilers COMMON_COMPILE_FLAGS = \ - -g -D_REENTRANT \ + -g -Wno-long-long \ -fstrict-aliasing \ -pedantic -Wall -Werror \ -Wunused -Wno-import \ @@ -35,18 +47,25 @@ COMMON_COMPILE_FLAGS = \ -Wswitch-enum -Wunknown-pragmas -Wfloat-equal \ -Wundef -Wshadow -Wpointer-arith \ -Wcast-qual -Wcast-align \ - -Wwrite-strings -Wconversion \ + -Wwrite-strings \ -Wmissing-noreturn \ -Wno-multichar -Wparentheses -Wredundant-decls \ -Winline \ - -Wdisabled-optimization \ - $(INCLUDE_DIRS) - + -Wdisabled-optimization ifeq "$(GCC_MAJOR_VERSION)" "4" COMMON_COMPILE_FLAGS += \ -Wfatal-errors -Wmissing-include-dirs -Wvariadic-macros \ -Wvolatile-register-var \ -Wstrict-aliasing=2 -Wextra -Winit-self +# -Wconversion had to meanings before gcc 4.3 (warn about ABI changes when porting +# old K&R code without function prototypes) and warn about conversions loosing +# precision. So we enable only -Wconversion (not -Wtraditional-conversion) for gcc +# >= 4.3 and no -Wconversion for older gcc versions! +# (see also http://gcc.gnu.org/wiki/NewWconversion) +ifeq "$(GCC_MINOR_VERSION)" "3" +COMMON_COMPILE_FLAGS += -Wconversion +endif + endif ifeq "$(GCC_MAJOR_VERSION)" "3" @@ -65,9 +84,12 @@ endif endif +STD99_COMPILE_FLAGS = \ + -std=c99 + COMPILE_FLAGS = \ $(COMMON_COMPILE_FLAGS) \ - -std=c99 \ + $(STD99_COMPILE_FLAGS) \ -Wnonnull \ -Wbad-function-cast -Wstrict-prototypes \ -Wmissing-prototypes -Wmissing-declarations \ @@ -76,7 +98,8 @@ COMPILE_FLAGS = \ # gcc 4.x ifeq "$(GCC_MAJOR_VERSION)" "4" COMPILE_FLAGS += \ - -Wc++-compat -Wdeclaration-after-statement -Wold-style-definition + -Wc++-compat -Wdeclaration-after-statement -Wold-style-definition \ + -funit-at-a-time endif ifeq "$(GCC_MAJOR_VERSION)" "3" @@ -84,7 +107,8 @@ ifeq "$(GCC_MAJOR_VERSION)" "3" # gcc 3.4, not tested yet ifeq "$(GCC_MINOR_VERSION)" "4" COMPILE_FLAGS += \ - -Wdeclaration-after-statement -Wold-style-definition + -Wdeclaration-after-statement -Wold-style-definition \ + -funit-at-a-time endif # gcc 3.3, testend on OpenBSD 4.2 @@ -93,7 +117,6 @@ ifeq "$(GCC_MINOR_VERSION)" "3" # -Wdeclaration-after-statement endif - endif CCPP_COMPILE_FLAGS = \ @@ -103,8 +126,7 @@ CCPP_COMPILE_FLAGS = \ # gcc 4.x ifeq "$(GCC_MAJOR_VERSION)" "4" CCPP_COMPILE_FLAGS += \ - -Wno-invalid-offsetof \ - -funit-at-a-time + -Wno-invalid-offsetof -funit-at-a-time endif ifeq "$(GCC_MAJOR_VERSION)" "3" @@ -123,13 +145,175 @@ endif endif -CFLAGS = $(COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(DEBUGLEVELFLAGS) -CCPPFLAGS = $(CCPP_COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(DEBUGLEVELFLAGS) -CC = gcc +#CC = gcc CCPP = g++ -LDFLAGS = $(LDFLAGS_DIR) -LIBS = $(LIBS_DL) $(LIBS_SSP) $(LIBS_DIR) +endif + +# end of gcc section + +# start of tcc section + +# currently we don't need this, the tcc flags are fairly consistent +#TCC_MAJOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --tcc-major-version $(CC) "$(CURDIR)" $(TOPDIR)) +#TCC_MINOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --tcc-minor-version $(CC) "$(CURDIR)" $(TOPDIR)) + +ifeq "$(COMPILER)" "tcc" +COMPILE_FLAGS = \ + -Wall -Werror +endif + +# end of tcc section + +# start of icc section + +# currently we don't need this, the icc flags are fairly consistent +#ICC_MAJOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --icc-major-version $(CC) "$(CURDIR)" $(TOPDIR)) +#ICC_MINOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --icc-minor-version $(CC) "$(CURDIR)" $(TOPDIR)) + +# -vec-report0: turn of SSE2 vector usage messages (they are common since P-4 anyway!) + +ifeq "$(COMPILER)" "icc" +COMPILE_FLAGS = \ + -Wall -Werror -w1 -vec-report0 +endif + +# end of icc section + +# start of spro section + +# -xc99=all: full C99 compliance for the code (syntax and library functions) +# -Xc: full ISO compliance, no K&R stuf +# -mt: enable mutlithreading (-D_REENTRANT for header files, -lthread for ld) +# -errwarn=%all: convert all warnings to errors +# -v: do more restrictive syntax checking +# TODO: enable -O2 + +ifeq "$(COMPILER)" "spro" +STD99_COMPILE_FLAGS = \ + -xc99=all +COMPILE_FLAGS = \ + $(STD99_COMPILE_FLAGS) -Xc -errwarn=%all -mt -v +endif + +# end of spro section + +# start of pcc section + +# currently we don't need this, the pcc flags are fairly consistent +#PCC_MAJOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --pcc-major-version $(CC) "$(CURDIR)" $(TOPDIR)) +#PCC_MINOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --pcc-minor-version $(CC) "$(CURDIR)" $(TOPDIR)) + +ifeq "$(COMPILER)" "pcc" +COMPILE_FLAGS = \ + --fatal-warnings +endif + +# end of pcc section + +# set flags for threading support using POSIX threads. This is completly different +# between compiler/platforms +ifeq "$(COMPILER)" "gcc" +ifeq "$(PLATFORM)" "LINUX" +PTHREADS_CFLAGS = -D_REENTRANT -pthread +PTHREADS_LDFLAGS = -pthread +PTHREADS_LIBS = +endif +ifeq "$(PLATFORM)" "SUNOS" +PTHREADS_CFLAGS = -D_REENTRANT -pthreads +PTHREADS_LDFLAGS = -pthreads +PTHREADS_LIBS = +endif +ifeq "$(PLATFORM)" "FREEBSD" +PTHREADS_CFLAGS = -D_REENTRANT -pthread +PTHREADS_LDFLAGS = -pthread +PTHREADS_LIBS = +endif +ifeq "$(PLATFORM)" "NETBSD" +PTHREADS_CFLAGS = -D_REENTRANT -pthread +PTHREADS_LDFLAGS = -pthread +PTHREADS_LIBS = +endif +ifeq "$(PLATFORM)" "OPENBSD" +PTHREADS_CFLAGS = -D_REENTRANT -pthread +PTHREADS_LDFLAGS = -pthread +PTHREADS_LIBS = +endif +ifeq "$(PLATFORM)" "CYGWIN" +PTHREADS_CFLAGS = +PTHREADS_LDFLAGS = +PTHREADS_LIBS = +endif +endif + +ifeq "$(COMPILER)" "tcc" +ifeq "$(PLATFORM)" "LINUX" +PTHREADS_CFLAGS = -D_REENTRANT +PTHREADS_LDFLAGS = +PTHREADS_LIBS = -lpthread +endif +endif + +ifeq "$(COMPILER)" "pcc" +ifeq "$(PLATFORM)" "LINUX" +PTHREADS_CFLAGS = -D_REENTRANT -pthread +PTHREADS_LDFLAGS = -pthread +PTHREADS_LIBS = +endif +endif + +ifeq "$(COMPILER)" "icc" +ifeq "$(PLATFORM)" "LINUX" +PTHREADS_CFLAGS = -D_REENTRANT -pthread +PTHREADS_LDFLAGS = -pthread +PTHREADS_LIBS = +endif +endif + +# set flags for position independend code (as required for shared libraries +# on some platforms) +ifeq "$(COMPILER)" "gcc" +ifeq "$(PLATFORM)" "LINUX" +SO_COMPILE_FLAGS = -fPIC +endif +ifeq "$(PLATFORM)" "SUNOS" +SO_COMPILE_FLAGS = -fPIC +endif +ifeq "$(PLATFORM)" "FREEBSD" +SO_COMPILE_FLAGS = -fPIC +endif +ifeq "$(PLATFORM)" "NETBSD" +SO_COMPILE_FLAGS = -fPIC +endif +ifeq "$(PLATFORM)" "OPENBSD" +SO_COMPILE_FLAGS = -fPIC +endif +ifeq "$(PLATFORM)" "CYGWIN" +# code on Cygwin is always position independend +SO_COMPILE_FLAGS = +endif +endif + +ifeq "$(COMPILER)" "icc" +ifeq "$(PLATFORM)" "LINUX" +SO_COMPILE_FLAGS = -fPIC +endif +endif + +# TODO: test this +#ifeq "$(COMPILER)" "spro" +#ifeq "$(PLATFORM)" "SUNOS" +#ifeq "$(ARCH)" "sun4u" +#SO_COMPILE_FLAGS = -xcode=pic32 +#endif +#endif +#endif + +CFLAGS = $(COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $(PTHREADS_CFLAGS) +CCPPFLAGS = $(CCPP_COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $(PTHREADS_CFLAGS) + +LDFLAGS = $(INCLUDE_LDFLAGS) $(PTHREADS_LDFLAGS) $(LDFLAGS_NET) $(LDFLAGS_LT) +LIBS = $(INCLUDE_LIBS) $(PTHREADS_LIBS) $(LIBS_NET) $(LIBS_LT) LINK = $(CC) CCPP_LINK = $(CCPP) @@ -139,20 +323,24 @@ CCPP_LINK = $(CCPP) %.o : %.cpp $(CCPP) -c -o $@ $(CCPPFLAGS) $< -%$(EXE): %.o $(OBJS) - $(CCPP_LINK) -o $@ $(LIBS) $(OBJS) $< +%$(EXE): %.o $(OBJS) $(TEST_OBJS) + $(CCPP_LINK) -o $@ $(LDFLAGS) $(OBJS) $(TEST_OBJS) $< $(LIBS) %.sho : %.c - $(CC) -c -o $@ -fPIC -DSHARED $(CFLAGS) $< + $(CC) -c -o $@ $(SO_COMPILE_FLAGS) -DSHARED $(CFLAGS) $< -%$(SO) : %.sho $(OBJS) - $(LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $< +#%$(SO) : %.sho $(OBJS) +# $(LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $< %.sho++ : %.cpp - $(CCPP) -c -o $@ -fPIC -DSHARED $(CCPPFLAGS) $< + $(CCPP) -c -o $@ $(SO_COMPILE_FLAGS) -DSHARED $(CCPPFLAGS) $< -%$(SO) : %.sho++ $(OBJS) $(CPPOBJS) - $(CCPP_LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $(CPPOBJS) $< +#%$(SO) : %.sho++ $(OBJS) $(CPPOBJS) +# $(CCPP_LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $(CPPOBJS) $< BIN_OBJS = $(BINS:$(EXE)=.o) +TEST_BIN_OBJS = $(TEST_BINS:$(EXE)=.o) CPP_BIN_OBJS = $(CPP_BINS:$(EXE)=.o) +TEST_CPP_BIN_OBJS = $(TEST_CPP_BINS:$(EXE)=.o) +SH_OBJS = $(OBJS:.o=.sho) +SHPP_OBJS = $(CPP_OBJS:.o=.sho++) diff --git a/makefiles/gmake/depend.mk b/makefiles/gmake/depend.mk index bd49fe1..eb832e7 100644 --- a/makefiles/gmake/depend.mk +++ b/makefiles/gmake/depend.mk @@ -4,27 +4,73 @@ # requires: # - compilers CC and CCPP # - INCLUDEDIRS -# - OBJS, CPP_OBJS and BIN_OBJS +# - OBJS, CPP_OBJS and BIN_OBJS, CPP_BIN_OBJS +# - TEST_BINS, TEST_BIN_OBJS, TEST_CPP_BINS, TEST_CPP_BIN_OBJS # # provides: # - included dependency files # # author: Andreas Baumann, abaumann at yahoo dot com -MAKEDEPEND = $(CC) -MM $(INCLUDE_DIRS) -CCPP_MAKEDEPEND = $(CCPP) -MM $(INCLUDE_DIRS) +ifeq "$(COMPILER)" "gcc" %.d : %.c @echo Generating dependencies for $< - @$(MAKEDEPEND) $(CFLAGS) $< | \ + @$(CC) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(CFLAGS) $< | \ sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ %.d : %.cpp @echo Generating dependencies for $< - @$(CCPP_MAKEDEPEND) $(CCPPFLAGS) $< | \ + @$(CCPP) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(CCPPFLAGS) $< | \ sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ +endif + +ifeq "$(COMPILER)" "tcc" + +%.d : %.c + @echo Generating dependencies for $< + @makedepend -DMAKE_DEPENDENCIES $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) -I/usr/lib/tcc/include -f - $< > $@ + +endif + +ifeq "$(COMPILER)" "icc" + +%.d : %.c + @echo Generating dependencies for $< + @$(CC) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(CFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +%.d : %.cpp + @echo Generating dependencies for $< + @$(CCPP) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(CCPPFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +endif + +ifeq "$(COMPILER)" "spro" + +%.d : %.c + @echo Generating dependencies for $< + @$(CC) -DMAKE_DEPENDENCIES -xM1 $(CFLAGS) $< > $@ + +%.d : %.cpp + @echo Generating dependencies for $< + @$(CCPP) -DMAKE_DEPENDENCIES -xM1 $(CCPPFLAGS) $< > $@ +endif + +ifeq "$(COMPILER)" "pcc" + +# FIXME: platform in path of compiler include files, mmh, how to fix? +%.d : %.c + @echo Generating dependencies for $< + @$(CC) -DMAKE_DEPENDENCIES $(CFLAGS) -M $< > $@ + +endif + -include $(OBJS:.o=.d) -include $(CPP_OBJS:.o=.d) -include $(BIN_OBJS:.o=.d) -include $(CPP_BIN_OBJS:.o=.d) +-include $(TEST_BIN_OBJS:.o=.d) +-include $(TEST_CPP_BIN_OBJS:.o=.d) diff --git a/makefiles/gmake/dist.mk b/makefiles/gmake/dist.mk new file mode 100644 index 0000000..85ceae7 --- /dev/null +++ b/makefiles/gmake/dist.mk @@ -0,0 +1,40 @@ +# creates a source tarball ready for distribution +# +# requires: +# - PACKAGE_NAME +# - PACKAGE_VERSION +# +# provides: +# - target: dist +# - target: dist-bz2, dist-gz, dist-Z + +.PHONY: dist dist-bz2 dist-gz dist-Z + +dist: + -@rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION) + -@rm -rf /tmp/$(PACKAGE_NAME)-$(PACKAGE_VERSION) + mkdir /tmp/$(PACKAGE_NAME)-$(PACKAGE_VERSION) + cp -r * /tmp/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/. + -@cd /tmp/$(PACKAGE_NAME)-$(PACKAGE_VERSION) ; \ + $(MAKE) distclean ; \ + rm -f makefiles/gmake/platform.mk.vars; \ + find . -name .svn -exec rm -rf {} \; ; \ + find . -name .git -exec rm -rf {} \; ; \ + cd .. ; \ + tar cvf $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar \ + $(PACKAGE_NAME)-$(PACKAGE_VERSION) + -@rm -rf /tmp/$(PACKAGE_NAME)-$(PACKAGE_VERSION) + @mv /tmp/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar . + +dist-bz2: dist + -@rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION).bz2 + @bzip2 -f $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar + +dist-gz: dist + -@rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION).gz + @gzip $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar + +dist-Z: dist + -@rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION).Z + @compress -f $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar + diff --git a/makefiles/gmake/guess_env b/makefiles/gmake/guess_env index f11ef5a..2e4f3de 100755 --- a/makefiles/gmake/guess_env +++ b/makefiles/gmake/guess_env @@ -1,57 +1,74 @@ #!/bin/sh +# operating system and major, minor version, more should not be necessary + UNAME_SYSTEM=`(uname -s) 2>/dev/null` UNAME_RELEASE=`(uname -r) 2>/dev/null` UNAME_VERSION=`(uname -v) 2>/dev/null` UNAME_MACHINE=`(uname -m) 2>/dev/null` -# operating system and major, minor version, more should not be necessary case "$UNAME_SYSTEM.$UNAME_RELEASE" in Linux*) PLATFORM=LINUX OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2` - LIBS_DL='-ldl' + + if test -f /etc/arch-release; then + LINUX_DIST='arch' + LINUX_REV='current' + elif test -f /etc/debian_version; then + LINUX_DIST='debian' + LINUX_REV=`cat /etc/debian_version | cut -d . -f 1` + elif test -f /etc/slackware-version; then + LINUX_DIST='slackware' + LINUX_REV=`cat /etc/slackware-version | cut -d ' ' -f 2 | cut -d . -f 1` + elif test -f /etc/redhat-release; then + LINUX_DIST='redhat' + LINUX_REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*// | cut -f 1 -d .` + else + LINUX_DIST='unknown' + LINUX_REV='unknown' + fi ;; FreeBSD*) PLATFORM=FREEBSD OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2 | cut -d - -f 1` - LIBS_DL= - LIBS_SSP= ;; OpenBSD*) PLATFORM=OPENBSD OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2 | cut -d - -f 1` - LIBS_DL= - LIBS_SSP= + ;; + + NetBSD*) PLATFORM=NETBSD + OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` + OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2 | cut -d - -f 1` ;; SunOS*) PLATFORM=SUNOS OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2` - LIBS_DL='-ldl' - LIBS_SSP= ;; CYGWIN_NT*) PLATFORM=CYGWIN _tmp=`echo $UNAME_SYSTEM | cut -d - -f 2` OS_MAJOR_VERSION=`echo $_tmp | cut -d . -f 1` OS_MINOR_VERSION=`echo $_tmp | cut -d . -f 2` - LIBS_SSP= ;; *) PLATFORM=UNKNOWN - echo "Unknown platform '$UNAME_SYSTEM#$UNAME_RELEASE'" + echo "Unknown platform '$UNAME_SYSTEM $UNAME_RELEASE'" exit 1 esac # the architecture + case "$UNAME_MACHINE" in i*86*) ARCH=x86 ;; - + x86_64) ARCH=x86_64 + ;; sun4u) ARCH=sun4u ;; @@ -61,10 +78,82 @@ case "$UNAME_MACHINE" in esac +# get last line, old 'tail' syntax and POSIX syntax, both exist out there +if test "x${PLATFORM}" = "xSUNOS"; then + TAIL1='tail -1' +else + TAIL1='tail -n 1' +fi + # the compiler and version -GCC_VERSION=`gcc -dumpversion` -GCC_MAJOR_VERSION=`echo $GCC_VERSION | cut -d . -f 1` -GCC_MINOR_VERSION=`echo $GCC_VERSION | cut -d . -f 2` + +# what compiler do we have (we can't relly on it's name as it may be a cc link to the binary!) +CC=$2 +(( $CC -v 2>&1 | $TAIL1 ) | grep -i GCC ) 2>/dev/null 1>/dev/null +if test $? = 0; then + COMPILER='gcc' +else + ( $CC -v | grep tcc ) 2>/dev/null 1>/dev/null + if test $? = 0; then + COMPILER='tcc' + else + ( $CC -V 2>&1 | grep l_cproc_p ) >/dev/null + if test $? = 0; then + COMPILER='icc' + else + ( $CC -xhelp=readme | head -n 1 | grep 'Sun Studio' ) >/dev/null + if test $? = 0; then + COMPILER='spro' + else + ( $CC -v | head -n 1 | grep 'pcc' ) >/dev/null + if test $? = 0; then + COMPILER='pcc' + else + COMPILER='unknown' + fi + fi + fi + fi +fi + +# version of gcc (GNU C compiler) + +if test $COMPILER = "gcc"; then + GCC_VERSION=`gcc -dumpversion` + GCC_MAJOR_VERSION=`echo $GCC_VERSION | cut -d . -f 1` + GCC_MINOR_VERSION=`echo $GCC_VERSION | cut -d . -f 2` +fi + +# version of tcc (Tiny C compiler) + +if test $COMPILER = "tcc"; then + TCC_VERSION=`tcc -v | cut -d ' ' -f 3` + TCC_MAJOR_VERSION=`echo $ICC_VERSION | cut -d . -f 1` + TCC_MINOR_VERSION=`echo $ICC_VERSION | cut -d . -f 2` +fi + +# version of icc (Intel C compiler) + +if test $COMPILER = "icc"; then + ICC_VERSION=`icc -dumpversion` + ICC_MAJOR_VERSION=`echo $ICC_VERSION | cut -d . -f 1` + ICC_MINOR_VERSION=`echo $ICC_VERSION | cut -d . -f 2` +fi + +# version of spro (Sun Pro compiler, Sun Studio) + +if test $COMPILER = "spro"; then + SPRO_VERSION=`$CC -xhelp=readme | head -n 1 | cut -d ' ' -f 3` + SPRO_MAJOR_VERSION=`echo $SPRO_VERSION | cut -d : -f 1` +fi + +# version of pcc (Portable C Compiler) + +if test $COMPILER = "pcc"; then + PCC_VERSION=`$CC -v | head -n 1 | cut -d ' ' -f 2` + PCC_MAJOR_VERSION=`echo $PCC_VERSION | cut -d . -f 1` + PCC_MINOR_VERSION=`echo $PCC_VERSION | cut -d . -f 2` +fi case "$1" in --platform) echo $PLATFORM @@ -78,29 +167,58 @@ case "$1" in --arch) echo $ARCH ;; - - --libs-dl) echo $LIBS_DL + + --compiler) echo $COMPILER ;; - --libs-ssl) echo $LIBS_SSL - ;; - --gcc-major-version) echo $GCC_MAJOR_VERSION ;; --gcc-minor-version) echo $GCC_MINOR_VERSION ;; - - *) - cat <"${MAKEFILE_DIR}/makefiles/gmake/platform.mk.vars" </dev/null + @-rm -f po/$(CATALOG_NAME).pot 2>/dev/null + @-rm -f po/*.bak 2>/dev/null + @-rm -f po/*~ 2>/dev/null + +# hooks for the standard targets handling gettext stuff + +all_po: $(MO_FILES) + +install_po: + @test -z "$(GETTEXT_LANGUAGES)" || \ + for lang in $(GETTEXT_LANGUAGES)""; do ( \ + echo "installing po/$$lang.mo to $(localedir)/$$lang/LC_MESSAGES.." && \ + $(INSTALL) -d -m 755 $(localedir)/$$lang/LC_MESSAGES && \ + $(INSTALL) -m 644 po/$$lang.mo $(localedir)/$$lang/LC_MESSAGES/$(CATALOG_NAME).mo || exit 1 \ + ) done + +uninstall_po: + @test -z "$(GETTEXT_LANGUAGES)" || \ + for lang in $(GETTEXT_LANGUAGES)""; do ( \ + echo "uninstalling $(localedir)/$$lang/LC_MESSAGES.." && \ + rm $(localedir)/$$lang/LC_MESSAGES/$(CATALOG_NAME).mo && \ + rmdir $(localedir)/$$lang/LC_MESSAGES || exit 1 \ + ) done + +else + +# No NLS supported wanted, provide dummy targets + +init-po: +merge-po: +check-po: + +all_po: +clean_po: +install_po: +uninstall_po: + +endif diff --git a/makefiles/gmake/install.mk b/makefiles/gmake/install.mk new file mode 100644 index 0000000..ac6d49d --- /dev/null +++ b/makefiles/gmake/install.mk @@ -0,0 +1,64 @@ +# install +# +# requires: +# - DESTDIR: temporary or final destination dir for installation +# - prefix: prefix for the directory root (e.g. /usr) +# +# provides: +# - target: install +# - target: uninstall + +# default values +DESTDIR= +prefix=/usr + +# standard directories following FHS +execdir=$(DESTDIR)$(prefix) +bindir=$(execdir)/bin +sbindir=$(execdir)/sbin +libdir=$(execdir)/lib +sysconfdir=$(execdir)/etc +includedir=$(execdir)/include +datadir=$(execdir)/share +localedir=$(datadir)/locale + +.PHONY: install_recursive install local_install + +install_recursive: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d install || exit 1); done) + +install: install_recursive local_install install_po + @test -d "$(libdir)" || mkdir -p "$(libdir)" + @test -z "$(STATIC_LIB)" || ( \ + $(INSTALL) -m 644 $(STATIC_LIB) $(libdir)/$(STATIC_LIB) ) + @test -z "$(DYNAMIC_LIB)" || ( \ + $(INSTALL) -m 755 $(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) \ + $(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) ) + @test -z "$(DYNAMIC_LIB)" || ( \ + rm -f "$(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR)" && \ + ln -s "$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH)" \ + "$(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR)" ) + @test -z "$(DYNAMIC_LIB)" || ( \ + rm -f "$(libdir)/$(DYNAMIC_LIB)" && \ + ln -s "$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH)" \ + "$(libdir)/$(DYNAMIC_LIB)" ) + +.PHONY: uninstall_recursive uninstall local_uninstall + +uninstall_recursive: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d uninstall || exit 1); done) + +uninstall: uninstall_recursive local_uninstall uninstall_po + test -z "$(DYNAMIC_LIB)" || ( \ + test ! -f "$(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH)" || \ + rm "$(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH)" ) + test -z "$(DYNAMIC_LIB)" || ( \ + test ! -h "$(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR)" || \ + rm "$(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR)" ) + test -z "$(DYNAMIC_LIB)" || ( \ + test ! -h "$(libdir)/$(DYNAMIC_LIB)" || \ + rm "$(libdir)/$(DYNAMIC_LIB)" ) + test -z "$(STATIC_LIB)" || ( \ + test ! -f "$(libdir)/$(STATIC_LIB)" || rm "$(libdir)/$(STATIC_LIB)" ) diff --git a/makefiles/gmake/libs.mk b/makefiles/gmake/libs.mk new file mode 100644 index 0000000..08899c3 --- /dev/null +++ b/makefiles/gmake/libs.mk @@ -0,0 +1,53 @@ +# provides explicit library rules +# +# requires: +# - STATIC_LIB: name of the static library +# - DYNAMIC_LIB: soname and versions of the shared library +# - all others like OBJS, CPP_OBJS, LIBS, SH_OBJS, SHPP_OBJS, LDFLAGS +# +# provides: +# - targets to build the static and dynamic version of the project's library +# + +ifeq "$(PLATFORM)" "LINUX" +SO_FLAGS = -shared -Wl,-soname,$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif + +ifeq "$(PLATFORM)" "SUNOS" +ifeq "$(COMPILER)" "gcc" +SO_FLAGS = -shared -Wl,-h,$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif +ifeq "$(COMPILER)" "spro" +SO_FLAGS = -G -h $(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif +endif + +ifeq "$(PLATFORM)" "FREEBSD" +SO_FLAGS = -shared -Wl,-x,-soname,$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif + +ifeq "$(PLATFORM)" "OPENBSD" +SO_FLAGS = -shared -Wl,-soname,$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif + +ifeq "$(PLATFORM)" "NETBSD" +SO_FLAGS = -shared -Wl,-soname,$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif + +ifeq "$(PLATFORM)" "CYGWIN" +SO_FLAGS = -shared -Wl,-soname,$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif + +ifneq "$(STATIC_LIB)" "" +$(STATIC_LIB) : $(OBJS) $(CPP_OBJS) + $(AR) cr $@ $(OBJS) $(CPP_OBJS) +else +$(STATIC_LIB) : +endif + +ifneq "$(DYNAMIC_LIB)" "" +$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) : $(SH_OBJS) $(SHPP_OBJS) + $(CCPP_LINK) $(SO_FLAGS) -o $@ $(LDFLAGS) $(SH_OBJS) $(SHPP_OBJS) $(LIBS) +else +$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) : +endif diff --git a/makefiles/gmake/platform.mk b/makefiles/gmake/platform.mk index 36d5ebb..452c9e1 100644 --- a/makefiles/gmake/platform.mk +++ b/makefiles/gmake/platform.mk @@ -7,28 +7,229 @@ # # provides: # - PLATFORM -# - OS_MAJOR_VERSION -# - OS_MINOR_VERSION +# - OS_MAJOR_VERSION and OS_MINOR_VERSION +# - GCC_MAJOR_VERSION and GCC_MINOR_VERSION # - PLATFORM_COMPILE_FLAGS # - EXE # - SO +# - INSTALL # # author: Andreas Baumann, abaumann at yahoo dot com -PLATFORM = $(shell $(TOPDIR)/makefiles/gmake/guess_env --platform) -OS_MAJOR_VERSION = $(shell $(TOPDIR)/makefiles/gmake/guess_env --os-major-version) -OS_MINOR_VERSION = $(shell $(TOPDIR)/makefiles/gmake/guess_env --os-minor-version) +-include $(TOPDIR)/makefiles/gmake/platform.mk.vars + +PLATFORM ?= $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --platform $(CC) "$(CURDIR)" $(TOPDIR)) +OS_MAJOR_VERSION ?= $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --os-major-version $(CC) "$(CURDIR)" $(TOPDIR)) +OS_MINOR_VERSION ?= $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --os-minor-version $(CC) "$(CURDIR)" $(TOPDIR)) +COMPILER ?= $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --compiler $(CC) "$(CURDIR)" $(TOPDIR)) +ifeq "$(PLATFORM)" "LINUX" +LINUX_DIST ?= $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --linux-dist $(CC) "$(CURDIR)" $(TOPDIR)) +LINUX_REV ?= $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --linux-rev $(CC) "$(CURDIR)" $(TOPDIR)) +endif + +# platform specific flags +######################### PLATFORM_COMPILE_FLAGS = \ -D$(PLATFORM) \ -DOS_MAJOR_VERSION=$(OS_MAJOR_VERSION) \ -DOS_MINOR_VERSION=$(OS_MINOR_VERSION) -LIBS_DL = $(shell $(TOPDIR)/makefiles/gmake/guess_env --libs-dl) -LIBS_SSP = $(shell $(TOPDIR)/makefiles/gmake/guess_env --libs-ssl) +ifeq "$(PLATFORM)" "LINUX" +PLATFORM_COMPILE_FLAGS += \ + -DLINUX_DIST=$(LINUX_DIST) -DLINUX_REV=$(LINUX_REV) +endif +# extensions for binaries +ifeq "$(PLATFORM)" "CYGWIN" +EXE = .exe +else EXE = +endif + +# extensions for shared libraries +# (TOOD: HP/Unix has .shlib, Mac/X has .lib, but we can't test it currently) SO = .so -GCC_MAJOR_VERSION = $(shell $(TOPDIR)/makefiles/gmake/guess_env --gcc-major-version $(CC)) -GCC_MINOR_VERSION = $(shell $(TOPDIR)/makefiles/gmake/guess_env --gcc-minor-version $(CC)) +# name if the installation program +# (TODO: use the MIT or openradio install-sh script instead?) +INSTALL = $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --install) +ifeq "$(PLATFORM)" "SUNOS" +INSTALL = /usr/ucb/install +else +INSTALL = install +endif + +# dynamic linker +################ + +# the linker library for dynamically loadable modules +# (TODO: check for all platforms, as soon we add loadable modules here from +# old TextWolf) +ifeq "$(PLATFORM)" "LINUX" +LIBS_DL = -ldl +else +LIBS_DL = +endif + +# i18n, gettext/libintl +####################### + +# enable or disable internationalization code +ENABLE_NLS = 1 + +ifeq "$(ENABLE_NLS)" "1" + +# we relly only on the GNU version, other versions (e.g. Solaris) are not +# so nice.. + +MSGFMT=msgfmt +MSGMERGE=msgmerge +XGETTEXT=xgettext + +# the GNU internationalization support is sometimes in separate libarries +ifeq "$(PLATFORM)" "LINUX" +INCLUDE_FLAGS_LT = +LDFLAGS_LT = +LIBS_LT = +endif + +ifeq "$(PLATFORM)" "SUNOS" +INCLUDE_FLAGS_LT = -I/usr/local/include +LDFLAGS_LT = -L/usr/local/lib +LIBS_LT = -lintl +endif + +ifeq "$(PLATFORM)" "FREEBSD" +INCLUDE_FLAGS_LT = -I/usr/local/include +LDFLAGS_LT = -L/usr/local/lib +LIBS_LT = -lintl +endif + +ifeq "$(PLATFORM)" "OPENBSD" +INCLUDE_FLAGS_LT = -I/usr/local/include +LDFLAGS_LT = -L/usr/local/lib +LIBS_LT = -lintl -liconv +endif + +ifeq "$(PLATFORM)" "CYGWIN" +INCLUDE_FLAGS_LT = +LDFLAGS_LT = +LIBS_LT = -lintl +endif + +ifeq "$(PLATFORM)" "NETBSD" +INCLUDE_FLAGS_LT = +LDFLAGS_LT = +LIBS_LT = -lintl +endif + +PLATFORM_COMPILE_FLAGS += $(INCLUDE_FLAGS_LT) + +endif + +PLATFORM_COMPILE_FLAGS += \ + -DENABLE_NLS=$(ENABLE_NLS) -DLOCALEDIR=\"$(localedir)\" + +# command line parser generator gengetopt +######################################## + +# location of gengetopt (default: in the path) +GENGETOPT=gengetopt + +# some platform either have no getopt/getopt_long or a broken one, so +# gengetopt can include its own one + +GENGETOPT_INCLUDE_GETOPT = + +ifeq "$(PLATFORM)" "SUNOS" +ifeq "$(OS_MAJOR_VERSION)" "5" +ifeq "$(OS_MINOR_VERSION)" "8" +GENGETOPT_INCLUDE_GETOPT = --include-getopt +endif +endif + +endif + +# TCP/IP, DNS +############# + +ifeq "$(PLATFORM)" "LINUX" +INCLUDE_FLAGS_NET = +LDFLAGS_NET = +LIBS_NET = +endif + +ifeq "$(PLATFORM)" "SUNOS" +INCLUDE_FLAGS_NET = +LDFLAGS_NET = +LIBS_NET = -lsocket -lnsl +endif + +ifeq "$(PLATFORM)" "FREEBSD" +INCLUDE_FLAGS_NET = +LDFLAGS_NET = +LIBS_NET = +endif + +ifeq "$(PLATFORM)" "OPENBSD" +INCLUDE_FLAGS_NET = +LDFLAGS_NET = +LIBS_NET = +endif + +ifeq "$(PLATFORM)" "CYGWIN" +INCLUDE_FLAGS_NET = +LDFLAGS_NET = +LIBS_NET = +endif + +ifeq "$(PLATFORM)" "NETBSD" +INCLUDE_FLAGS_NET = +LDFLAGS_NET = +LIBS_NET = +endif + +PLATFORM_COMPILE_FLAGS += $(INCLUDE_FLAGS_NET) + +# sqlite3 +######### + +# the GNU internationalization support is sometimes in separate libarries +ifeq "$(PLATFORM)" "LINUX" +INCLUDE_FLAGS_SQLITE3 = -I/usr/include +LDFLAGS_SQLITE3 = -L/usr/lib +LIBS_SQLITE3 = -lsqlite3 +endif + +ifeq "$(PLATFORM)" "SUNOS" +INCLUDE_FLAGS_SQLITE3 = +LDFLAGS_SQLITE3 = +LIBS_SQLITE3 = -lsqlite3 +endif + +ifeq "$(PLATFORM)" "FREEBSD" +INCLUDE_FLAGS_SQLITE3 = +LDFLAGS_SQLITE3 = +LIBS_SQLITE3 = -lsqlite3 +endif + +ifeq "$(PLATFORM)" "OPENBSD" +INCLUDE_FLAGS_SQLITE3 = +LDFLAGS_SQLITE3 = +LIBS_SQLITE3 = -lsqlite3 +endif + +ifeq "$(PLATFORM)" "CYGWIN" +INCLUDE_FLAGS_SQLITE3 = +LDFLAGS_SQLITE3 = +LIBS_SQLITE3 = -lsqlite3 +endif + +ifeq "$(PLATFORM)" "NETBSD" +INCLUDE_FLAGS_SQLITE3 = -I/usr/pkg/include +LDFLAGS_SQLITE3 = -L/usr/pkg/lib +LIBS_SQLITE3 = -lsqlite3 +endif + +PLATFORM_COMPILE_FLAGS += $(INCLUDE_FLAGS_SQLITE3) diff --git a/makefiles/gmake/sub.mk b/makefiles/gmake/sub.mk index 024bb76..962c63f 100644 --- a/makefiles/gmake/sub.mk +++ b/makefiles/gmake/sub.mk @@ -12,14 +12,17 @@ -include $(TOPDIR)/makefiles/gmake/compiler.mk .PHONY: all $(SUBDIRS) local_all -all: local_all $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) $(BINS) $(CPP_BINS) $(CMODULES) $(CPPMODULES) +all: $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) $(BINS) $(CPP_BINS) $(CMODULES) $(CPPMODULES) $(STATIC_LIB) $(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) local_all all_po @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ (set -e; $(MAKE) -C $$d all || exit 1); done) .PHONY: test local_test -test: local_test $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(BINS) $(CPP_BINS) $(CMODULES) $(CPPMODULES) +test: $(OBJS) $(TEST_OBJS) $(CPPOBJS) $(BIN_OBJS) $(BINS) $(CPP_BINS) $(TEST_BIN_OBJS) $(TEST_BINS) $(TEST_CPP_BINS) $(CMODULES) $(CPPMODULES) $(STATIC_LIB) local_test @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ (set -e; $(MAKE) -C $$d test || exit 1); done) -include $(TOPDIR)/makefiles/gmake/depend.mk -include $(TOPDIR)/makefiles/gmake/clean.mk +-include $(TOPDIR)/makefiles/gmake/install.mk +-include $(TOPDIR)/makefiles/gmake/i18n.mk +-include $(TOPDIR)/makefiles/gmake/libs.mk diff --git a/makefiles/gmake/top.mk b/makefiles/gmake/top.mk index 98993f7..810bedc 100644 --- a/makefiles/gmake/top.mk +++ b/makefiles/gmake/top.mk @@ -9,6 +9,13 @@ # - target 'clean' # - target 'distclean' # - target 'test' +# - target 'doc' +# - target 'dist' +# - target 'help' +# - target 'install' +# - target 'uninstall' + +-include makefiles/gmake/platform.mk .PHONY: all all: @@ -19,12 +26,49 @@ all: clean: @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ (set -e; $(MAKE) -C $$d clean || exit 1); done) + @-rm $(TOPDIR)/makefiles/gmake/platform.mk.vars .PHONY: distclean -distclean: clean - test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ +distclean: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ (set -e; $(MAKE) -C $$d distclean || exit 1); done) + @-rm $(TOPDIR)/makefiles/gmake/platform.mk.vars + +.PHONY: install +install: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d install || exit 1); done) + +.PHONY: uninstall +uninstall: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d uninstall || exit 1); done) .PHONY: test test: all @$(MAKE) -C tests test + +.PHONY: doc +doc: + cd docs; $(MAKE) doc + +.PHONY: help +help: + @cat $(TOPDIR)/makefiles/gmake/help.mk + +.PHONY: init-po +init-po: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d init-po || exit 1); done) + +.PHONY: merge-po +merge-po: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d merge-po || exit 1); done) + +.PHONY: check-po +check-po: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d check-po || exit 1); done) + +-include $(TOPDIR)/makefiles/gmake/dist.mk -- cgit v1.2.3-54-g00ecf