summaryrefslogtreecommitdiff
path: root/makefiles/gmake
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2010-02-13 09:56:58 +0100
committerAndreas Baumann <abaumann@yahoo.com>2010-02-13 09:56:58 +0100
commit68354c7d41085d1f976a5b1d7ee542479a85f621 (patch)
treeaec761c793093e4a2e4ce18d78b3b531bcb12a42 /makefiles/gmake
downloadsqlitexx-68354c7d41085d1f976a5b1d7ee542479a85f621.tar.gz
sqlitexx-68354c7d41085d1f976a5b1d7ee542479a85f621.tar.bz2
imported trunk from sourceforge SVN
Diffstat (limited to 'makefiles/gmake')
-rw-r--r--makefiles/gmake/clean.mk41
-rw-r--r--makefiles/gmake/compiler.mk346
-rw-r--r--makefiles/gmake/depend.mk76
-rw-r--r--makefiles/gmake/dist.mk40
-rwxr-xr-xmakefiles/gmake/guess_env224
-rw-r--r--makefiles/gmake/help.mk15
-rw-r--r--makefiles/gmake/i18n.mk103
-rw-r--r--makefiles/gmake/install.mk64
-rw-r--r--makefiles/gmake/libs.mk53
-rw-r--r--makefiles/gmake/platform.mk235
-rw-r--r--makefiles/gmake/sub.mk28
-rw-r--r--makefiles/gmake/top.mk74
12 files changed, 1299 insertions, 0 deletions
diff --git a/makefiles/gmake/clean.mk b/makefiles/gmake/clean.mk
new file mode 100644
index 0000000..92061d4
--- /dev/null
+++ b/makefiles/gmake/clean.mk
@@ -0,0 +1,41 @@
+# cleans up directories
+#
+# requires:
+# - 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
+# - target: distclean
+
+.PHONY: clean_recursive clean local_clean
+
+clean_recursive:
+ @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \
+ (set -e; $(MAKE) -C $$d clean || exit 1); done)
+
+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
+
+distclean_recursive:
+ @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \
+ (set -e; $(MAKE) -C $$d distclean || exit 1); done)
+
+distclean: distclean_recursive local_distclean clean
diff --git a/makefiles/gmake/compiler.mk b/makefiles/gmake/compiler.mk
new file mode 100644
index 0000000..01e9837
--- /dev/null
+++ b/makefiles/gmake/compiler.mk
@@ -0,0 +1,346 @@
+# sets compiler settings
+#
+# requires:
+# - INCLUDE_DIRS
+#
+# provides:
+# - 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!
+# -Wunsafe-loop-optimizations: ??
+# -Wno-attributes, -Wmissing-format-attribute: ?? later
+# -Wpacked -Wpadded: ?? very questionable
+# -Wunreachable-code: doesn't work
+# -Wno-div-by-zero: we get NaN and friend over macros, so need for funny tricks :-)
+# -Wstrict-overflow=5 is relatively new, later maybe
+# -fstack-protector or -fstack-protector-all: should be used, but U
+# have currently big problems to get it around compiler gcc and -lssl
+# probing! FIXME later
+# -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
+# -Wno-long-long: sqlite.h on FreeBSD 6.2 shows problems otherwise
+
+# compilation flags and compilers
+COMMON_COMPILE_FLAGS = \
+ -g -Wno-long-long \
+ -fstrict-aliasing \
+ -pedantic -Wall -Werror \
+ -Wunused -Wno-import \
+ -Wformat -Wformat-y2k -Wformat-nonliteral -Wformat-security -Wformat-y2k \
+ -Wswitch-enum -Wunknown-pragmas -Wfloat-equal \
+ -Wundef -Wshadow -Wpointer-arith \
+ -Wcast-qual -Wcast-align \
+ -Wwrite-strings \
+ -Wmissing-noreturn \
+ -Wno-multichar -Wparentheses -Wredundant-decls \
+ -Winline \
+ -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"
+
+# gcc 3.3, testend on OpenBSD 4.2
+ifeq "$(GCC_MINOR_VERSION)" "3"
+COMMON_COMPILE_FLAGS += \
+ -W
+endif
+
+# gcc 3.4, not tested yet
+ifeq "$(GCC_MINOR_VERSION)" "4"
+COMMON_COMPILE_FLAGS += \
+ -Wstrict-aliasing=2 -Wextra -Winit-self
+endif
+
+endif
+
+STD99_COMPILE_FLAGS = \
+ -std=c99
+
+COMPILE_FLAGS = \
+ $(COMMON_COMPILE_FLAGS) \
+ $(STD99_COMPILE_FLAGS) \
+ -Wnonnull \
+ -Wbad-function-cast -Wstrict-prototypes \
+ -Wmissing-prototypes -Wmissing-declarations \
+ -Wnested-externs
+
+# gcc 4.x
+ifeq "$(GCC_MAJOR_VERSION)" "4"
+COMPILE_FLAGS += \
+ -Wc++-compat -Wdeclaration-after-statement -Wold-style-definition \
+ -funit-at-a-time
+endif
+
+ifeq "$(GCC_MAJOR_VERSION)" "3"
+
+# gcc 3.4, not tested yet
+ifeq "$(GCC_MINOR_VERSION)" "4"
+COMPILE_FLAGS += \
+ -Wdeclaration-after-statement -Wold-style-definition \
+ -funit-at-a-time
+endif
+
+# gcc 3.3, testend on OpenBSD 4.2
+ifeq "$(GCC_MINOR_VERSION)" "3"
+#COMPILE_FLAGS += \
+# -Wdeclaration-after-statement
+endif
+
+endif
+
+CCPP_COMPILE_FLAGS = \
+ $(COMMON_COMPILE_FLAGS) \
+ -std=c++98
+
+# gcc 4.x
+ifeq "$(GCC_MAJOR_VERSION)" "4"
+CCPP_COMPILE_FLAGS += \
+ -Wno-invalid-offsetof -funit-at-a-time
+endif
+
+ifeq "$(GCC_MAJOR_VERSION)" "3"
+
+# gcc 3.4, not tested yet
+ifeq "$(GCC_MINOR_VERSION)" "4"
+CCPP_COMPILE_FLAGS += \
+ -Wno-invalid-offsetof
+endif
+
+# gcc 3.3, testend on OpenBSD 4.2
+ifeq "$(GCC_MINOR_VERSION)" "3"
+#CCPP_COMPILE_FLAGS += \
+# -Wdeclaration-after-statement
+endif
+
+endif
+
+#CC = gcc
+CCPP = g++
+
+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)
+
+%.o : %.c
+ $(CC) -c -o $@ $(CFLAGS) $<
+
+%.o : %.cpp
+ $(CCPP) -c -o $@ $(CCPPFLAGS) $<
+
+%$(EXE): %.o $(OBJS) $(TEST_OBJS)
+ $(CCPP_LINK) -o $@ $(LDFLAGS) $(OBJS) $(TEST_OBJS) $< $(LIBS)
+
+%.sho : %.c
+ $(CC) -c -o $@ $(SO_COMPILE_FLAGS) -DSHARED $(CFLAGS) $<
+
+#%$(SO) : %.sho $(OBJS)
+# $(LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $<
+
+%.sho++ : %.cpp
+ $(CCPP) -c -o $@ $(SO_COMPILE_FLAGS) -DSHARED $(CCPPFLAGS) $<
+
+#%$(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
new file mode 100644
index 0000000..eb832e7
--- /dev/null
+++ b/makefiles/gmake/depend.mk
@@ -0,0 +1,76 @@
+# provides generic rules for C/C++ dependeny generation using
+# 'makedepend', 'gcc -MM' or similar mechanisms
+#
+# requires:
+# - compilers CC and CCPP
+# - INCLUDEDIRS
+# - 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
+
+ifeq "$(COMPILER)" "gcc"
+
+%.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)" "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
new file mode 100755
index 0000000..2e4f3de
--- /dev/null
+++ b/makefiles/gmake/guess_env
@@ -0,0 +1,224 @@
+#!/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`
+
+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`
+
+ 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`
+ ;;
+
+ 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`
+ ;;
+
+ 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`
+ ;;
+
+ 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`
+ ;;
+
+ *)
+ PLATFORM=UNKNOWN
+ 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
+ ;;
+
+ *) ARCH=UNKNOWN
+ echo "Unknown architecture '$UNAME_MACHINE'"
+ exit 1
+
+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
+
+# 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
+ ;;
+
+ --os-major-version) echo $OS_MAJOR_VERSION
+ ;;
+
+ --os-minor-version) echo $OS_MINOR_VERSION
+ ;;
+
+ --arch) echo $ARCH
+ ;;
+
+ --compiler) echo $COMPILER
+ ;;
+
+ --gcc-major-version) echo $GCC_MAJOR_VERSION
+ ;;
+
+ --gcc-minor-version) echo $GCC_MINOR_VERSION
+ ;;
+
+ --tcc-major-version) echo $TCC_MAJOR_VERSION
+ ;;
+
+ --tcc-minor-version) echo $TCC_MINOR_VERSION
+ ;;
+
+ --icc-major-version) echo $ICC_MAJOR_VERSION
+ ;;
+
+ --icc-minor-version) echo $ICC_MINOR_VERSION
+ ;;
+
+ --spro-major-version) echo $SPRO_MAJOR_VERSION
+ ;;
+
+ --pcc-major-version) echo $PCC_MAJOR_VERSION
+ ;;
+
+ --pcc-minor-version) echo $PCC_MINOR_VERSION
+ ;;
+esac
+
+MAKEFILE_DIR="$3/$4"
+
+# regenerate the cache file, otherwise building is far too slow!
+if test ! -f "${MAKEFILE_DIR}/makefiles/gmake/platform.mk.vars"; then
+ cat >"${MAKEFILE_DIR}/makefiles/gmake/platform.mk.vars" <<EOF
+ARCH=$ARCH
+PLATFORM=$PLATFORM
+OS_MAJOR_VERSION=$OS_MAJOR_VERSION
+OS_MINOR_VERSION=$OS_MINOR_VERSION
+COMPILER=$COMPILER
+GCC_MAJOR_VERSION=$GCC_MAJOR_VERSION
+GCC_MINOR_VERSION=$GCC_MINOR_VERSION
+TCC_MAJOR_VERSION=$TCC_MAJOR_VERSION
+TCC_MINOR_VERSION=$TCC_MINOR_VERSION
+ICC_MAJOR_VERSION=$ICC_MAJOR_VERSION
+ICC_MINOR_VERSION=$ICC_MINOR_VERSION
+SPRO_MAJOR_VERSION=$SPRO_MAJOR_VERSION
+PCC_MAJOR_VERSION=$PCC_MAJOR_VERSION
+PCC_MINOR_VERSION=$PCC_MINOR_VERSION
+LINUX_DIST=$LINUX_DIST
+LINUX_REV=$LINUX_REV
+EOF
+fi
diff --git a/makefiles/gmake/help.mk b/makefiles/gmake/help.mk
new file mode 100644
index 0000000..fc7e321
--- /dev/null
+++ b/makefiles/gmake/help.mk
@@ -0,0 +1,15 @@
+
+Available targets:
+
+make [all] create all artifacts
+make test create test binaries and execute tests
+make doc build the documentation
+make clean clean up build artifacts
+make distclean clean up all generated artifacts
+make install install (set 'DESTDIR' and 'prefix' at will)
+make uninstall uninstall (set 'DESTDIR' and 'prefix' at will)
+make dist[-Z|-gz|-bz2] create tarball containing all sources
+make help show this very help page
+make init-po create initial version of the gettext files
+make merge-po merge the gettext files after changes
+make check-po check sanity of gettext files
diff --git a/makefiles/gmake/i18n.mk b/makefiles/gmake/i18n.mk
new file mode 100644
index 0000000..08a29e4
--- /dev/null
+++ b/makefiles/gmake/i18n.mk
@@ -0,0 +1,103 @@
+# handle localization stuff (gettext)
+# (this follows roughly the way Postgresql handles NLS)
+#
+# requires:
+# - CATALOG_NAME: name of the catalog (name of the library or program)
+# will be installed as $(CATALOG_NAME).po in the localedir
+# - GETTEXT_LANGUAGES: list of languages supported
+# - GETTEXT_FILES: list of source files that contain message strings
+# - GETTEXT_TRIGGERS: (optional) list of functions/macros that contain
+# translatable strings
+#
+# provides:
+# - target: init-po
+# - target: merge-po
+# - taget: check-po
+# - target: install_po
+# - target: uninstall_po
+
+.PHONY: init-po update-po all_po clean_po install_po uninstall_po
+
+ifeq "$(ENABLE_NLS)" "1"
+
+PO_FILES = $(addprefix po/, $(addsuffix .po, $(GETTEXT_LANGUAGES)))
+MO_FILES = $(addprefix po/, $(addsuffix .mo, $(GETTEXT_LANGUAGES)))
+
+%.mo : %.po
+ $(MSGFMT) -c -o $@ $<
+
+po/$(CATALOG_NAME).pot: $(GETTEXT_FILES)
+ $(XGETTEXT) -n -F -d $(CATALOG_NAME) -o $@ \
+ $(addprefix -k, $(GETTEXT_TRIGGERS)) --flag=_:1:pass-c-format \
+ -d $(CATALOG_NAME) -n -F $(GETTEXT_FILES)
+
+ifneq "$(GETTEXT_FILES)" ""
+init-po: po/$(CATALOG_NAME).pot
+else
+init-po:
+endif
+
+ifneq "$(GETTEXT_FILES)" ""
+merge-po: po/$(CATALOG_NAME).pot
+ @test -z "$(GETTEXT_LANGUAGES)" || \
+ for lang in $(GETTEXT_LANGUAGES)""; do ( \
+ echo "merging po/$$lang.mo and $<.." && \
+ if $(MSGMERGE) -F -o po/$$lang.po.new po/$$lang.po $<; then \
+ cp po/$$lang.po po/$$lang.po.bak && \
+ mv po/$$lang.po.new po/$$lang.po; \
+ else \
+ echo "Please check, msgmerge for po/$$lang.po failed!"; \
+ rm -f po/$$lang.po.new; \
+ fi \
+ ) done
+else
+merge-po:
+endif
+
+check-po: $(PO_FILES)
+ @test -z "$^" || \
+ for file in $^""; do ( \
+ echo "checking gettext file $$file of catalog $(CATALOG_NAME).." && \
+ $(MSGFMT) -c -v -o /dev/null $$file || exit 1 \
+ ) done
+
+clean_po:
+ @-rm -f $(MO_FILES) 2>/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
new file mode 100644
index 0000000..452c9e1
--- /dev/null
+++ b/makefiles/gmake/platform.mk
@@ -0,0 +1,235 @@
+# sets e. g. to LINUX, OS_MAJOR_VERSION to 2 and OS_MINOR_VERSION to 6
+# by calling the 'guess_env' shell script, where the actual probing happens
+# Also sets PLATFORM_COMPILE_FLAGS to be included when compiling C/C++ code
+#
+# requires:
+# - TOPDIR
+#
+# provides:
+# - PLATFORM
+# - 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
+
+-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)
+
+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
+
+# 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
new file mode 100644
index 0000000..962c63f
--- /dev/null
+++ b/makefiles/gmake/sub.mk
@@ -0,0 +1,28 @@
+# makefile for a sub package
+#
+# requires:
+# - TOPDIR
+# - SUBDIRS
+# - INCLUDE_DIRS
+#
+# provides:
+# - target: all targets
+
+-include $(TOPDIR)/makefiles/gmake/platform.mk
+-include $(TOPDIR)/makefiles/gmake/compiler.mk
+
+.PHONY: all $(SUBDIRS) local_all
+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: $(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
new file mode 100644
index 0000000..810bedc
--- /dev/null
+++ b/makefiles/gmake/top.mk
@@ -0,0 +1,74 @@
+# top-level makefile for a package
+#
+# requires:
+# - TOPDIR
+# - SUBDIRS
+#
+# provides:
+# - target 'all'
+# - target 'clean'
+# - target 'distclean'
+# - target 'test'
+# - target 'doc'
+# - target 'dist'
+# - target 'help'
+# - target 'install'
+# - target 'uninstall'
+
+-include makefiles/gmake/platform.mk
+
+.PHONY: all
+all:
+ @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \
+ (set -e; $(MAKE) -C $$d all || exit 1); done)
+
+.PHONY: clean
+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:
+ @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