diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2009-12-07 20:08:54 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2009-12-07 20:08:54 +0100 |
commit | dd574ba3eabee4f9f8661ea21619b6352cb9a935 (patch) | |
tree | 73e78a88d17b6070afe8a99b856efd9ff4789b0c | |
parent | 7de22b92399504daf951c830b3b0d7d7cffc3d9f (diff) | |
download | crawler-dd574ba3eabee4f9f8661ea21619b6352cb9a935.tar.gz crawler-dd574ba3eabee4f9f8661ea21619b6352cb9a935.tar.bz2 |
fixed postgres tests, synched makefile system with the one from sqlite3xx
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | COPYING | 165 | ||||
-rw-r--r-- | GNUmakefile | 5 | ||||
-rwxr-xr-x | configure | 11 | ||||
-rw-r--r-- | docs/LINKS (renamed from doc/LINKS) | 0 | ||||
-rw-r--r-- | docs/mercator.pdf (renamed from doc/mercator.pdf) | bin | 104401 -> 104401 bytes | |||
-rw-r--r-- | docs/smallwolf.png (renamed from doc/smallwolf.png) | bin | 4345 -> 4345 bytes | |||
-rw-r--r-- | makefiles/gmake/clean.mk | 32 | ||||
-rw-r--r-- | makefiles/gmake/compiler.mk | 240 | ||||
-rw-r--r-- | makefiles/gmake/depend.mk | 56 | ||||
-rw-r--r-- | makefiles/gmake/dist.mk | 40 | ||||
-rwxr-xr-x | makefiles/gmake/guess_env | 180 | ||||
-rw-r--r-- | makefiles/gmake/help.mk | 15 | ||||
-rw-r--r-- | makefiles/gmake/i18n.mk | 103 | ||||
-rw-r--r-- | makefiles/gmake/install.mk | 64 | ||||
-rw-r--r-- | makefiles/gmake/libs.mk | 53 | ||||
-rw-r--r-- | makefiles/gmake/platform.mk | 219 | ||||
-rw-r--r-- | makefiles/gmake/sub.mk | 7 | ||||
-rw-r--r-- | makefiles/gmake/top.mk | 48 | ||||
-rw-r--r-- | tests/GNUmakefile | 4 | ||||
-rw-r--r-- | tests/curl/GNUmakefile | 2 | ||||
-rw-r--r-- | tests/psql/GNUmakefile | 18 | ||||
-rwxr-xr-x | tests/psql/exec_test | 21 | ||||
-rw-r--r-- | tests/psql/test1.MUST | 1005 | ||||
-rw-r--r-- | tests/psql/test1.cpp | 1 | ||||
-rw-r--r-- | tests/psql/test2.MUST | 1001 |
26 files changed, 3189 insertions, 102 deletions
@@ -0,0 +1 @@ +Andreas Baumann <abaumann at yahoo dot com> @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/GNUmakefile b/GNUmakefile index 51119b6..92ad403 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -2,4 +2,7 @@ TOPDIR = . SUBDIRS = tests --include $(TOPDIR)/makefiles/top.mk +PACKAGE_NAME = CrawlingWolf +PACKAGE_VERSION = 0.0.1 + +-include $(TOPDIR)/makefiles/gmake/top.mk diff --git a/configure b/configure new file mode 100755 index 0000000..0a64dcb --- /dev/null +++ b/configure @@ -0,0 +1,11 @@ +#!/bin/sh + +cat <<EOF +No way, Jose. + +Use 'make help' to see what you can do. + +Use the make of your platform, be it 'make', 'gmake', 'bmake', 'nmake', ... +...whatever... + +EOF diff --git a/doc/mercator.pdf b/docs/mercator.pdf Binary files differindex f4cb9b0..f4cb9b0 100644 --- a/doc/mercator.pdf +++ b/docs/mercator.pdf diff --git a/doc/smallwolf.png b/docs/smallwolf.png Binary files differindex 24114cc..24114cc 100644 --- a/doc/smallwolf.png +++ b/docs/smallwolf.png 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 <<EOF -ARCH = $ARCH -PLATFORM = $PLATFORM -OS_MAJOR_VERSION = $OS_MAJOR_VERSION -OS_MINOR_VERSION = $OS_MINOR_VERSION -LIBS_DL = $LIBS_DL -LIBS_SSL = $LIBS_SSL -GCC_MAJOR_VERSION = $GCC_MAJOR_VERSION -GCC_MINOR_VERSION = $GCC_MINOR_VERSION -EOF + + --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 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 diff --git a/tests/GNUmakefile b/tests/GNUmakefile index 838ea49..934e454 100644 --- a/tests/GNUmakefile +++ b/tests/GNUmakefile @@ -1,8 +1,8 @@ TOPDIR = .. -SUBDIRS = curl psql +SUBDIRS = curl psql sqlite --include $(TOPDIR)/makefiles/sub.mk +-include $(TOPDIR)/makefiles/gmake/sub.mk local_all: diff --git a/tests/curl/GNUmakefile b/tests/curl/GNUmakefile index deb408b..7d56906 100644 --- a/tests/curl/GNUmakefile +++ b/tests/curl/GNUmakefile @@ -14,7 +14,7 @@ CPP_BINS = \ OBJS = --include $(TOPDIR)/makefiles/sub.mk +-include $(TOPDIR)/makefiles/gmake/sub.mk local_all: diff --git a/tests/psql/GNUmakefile b/tests/psql/GNUmakefile index 8ba71a0..3e3e1ea 100644 --- a/tests/psql/GNUmakefile +++ b/tests/psql/GNUmakefile @@ -4,27 +4,27 @@ SUBDIRS = INCLUDE_DIRS = -I. -I$(TOPDIR) -I/usr/include/pqxx -LDFLAGS_DIR = \ - -L/usr/lib +INCLUDE_LDFLAGS = -LIBS_DIR = \ +INCLUDE_LIBS = \ -lpqxx -lpq -CPP_BINS = \ +TEST_CPP_BINS = \ test1$(EXE) \ test2$(EXE) OBJS = --include $(TOPDIR)/makefiles/sub.mk +-include $(TOPDIR)/makefiles/gmake/sub.mk local_all: local_clean: + -@rm -f *.db *.db-journal 2>/dev/null + -@rm -f *.RES *.DIFF local_distclean: -local_test: $(CPP_BINS) - @echo "libpqxx simple test.." - ./test1 -
\ No newline at end of file +local_test: + @./exec_test test1 "libpqxx simple test" "$(PLATFORM)" "$(LINUX_DIST)" "$(LINUX_REV)" + @./exec_test test2 "prepared statements" "$(PLATFORM)" "$(LINUX_DIST)" "$(LINUX_REV)" diff --git a/tests/psql/exec_test b/tests/psql/exec_test new file mode 100755 index 0000000..b49999b --- /dev/null +++ b/tests/psql/exec_test @@ -0,0 +1,21 @@ +#!/bin/sh + +BINARY=$1 +TITLE=$2 +PLATFORM=$3 +LINUX_DIST=$4 +LINUX_REV=$5 + +if test "x${PLATFORM}" = "xLINUX"; then +SPECIAL="${PLATFORM}_${LINUX_DIST}_${LINUX_REV}" +else +SPECIAL="${PLATFORM}" +fi + +printf "$BINARY: $TITLE .. " +./$BINARY | sed 's/\(time: .* ms\)//g' >$BINARY.RES 2>&1 +if test -f $BINARY.MUST.$SPECIAL; then + diff $BINARY.MUST.$SPECIAL $BINARY.RES > $BINARY.DIFF && printf "OK\n" || printf "ERROR\n" +else + diff $BINARY.MUST $BINARY.RES > $BINARY.DIFF && printf "OK\n" || printf "ERROR\n" +fi diff --git a/tests/psql/test1.MUST b/tests/psql/test1.MUST new file mode 100644 index 0000000..70b5308 --- /dev/null +++ b/tests/psql/test1.MUST @@ -0,0 +1,1005 @@ +Conntected to database. +Backend protocol version: 80401 +Protocol version: 3 +Prepared Statements: 1 +a b +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +21 21 +22 22 +23 23 +24 24 +25 25 +26 26 +27 27 +28 28 +29 29 +30 30 +31 31 +32 32 +33 33 +34 34 +35 35 +36 36 +37 37 +38 38 +39 39 +40 40 +41 41 +42 42 +43 43 +44 44 +45 45 +46 46 +47 47 +48 48 +49 49 +50 50 +51 51 +52 52 +53 53 +54 54 +55 55 +56 56 +57 57 +58 58 +59 59 +60 60 +61 61 +62 62 +63 63 +64 64 +65 65 +66 66 +67 67 +68 68 +69 69 +70 70 +71 71 +72 72 +73 73 +74 74 +75 75 +76 76 +77 77 +78 78 +79 79 +80 80 +81 81 +82 82 +83 83 +84 84 +85 85 +86 86 +87 87 +88 88 +89 89 +90 90 +91 91 +92 92 +93 93 +94 94 +95 95 +96 96 +97 97 +98 98 +99 99 +100 100 +101 101 +102 102 +103 103 +104 104 +105 105 +106 106 +107 107 +108 108 +109 109 +110 110 +111 111 +112 112 +113 113 +114 114 +115 115 +116 116 +117 117 +118 118 +119 119 +120 120 +121 121 +122 122 +123 123 +124 124 +125 125 +126 126 +127 127 +128 128 +129 129 +130 130 +131 131 +132 132 +133 133 +134 134 +135 135 +136 136 +137 137 +138 138 +139 139 +140 140 +141 141 +142 142 +143 143 +144 144 +145 145 +146 146 +147 147 +148 148 +149 149 +150 150 +151 151 +152 152 +153 153 +154 154 +155 155 +156 156 +157 157 +158 158 +159 159 +160 160 +161 161 +162 162 +163 163 +164 164 +165 165 +166 166 +167 167 +168 168 +169 169 +170 170 +171 171 +172 172 +173 173 +174 174 +175 175 +176 176 +177 177 +178 178 +179 179 +180 180 +181 181 +182 182 +183 183 +184 184 +185 185 +186 186 +187 187 +188 188 +189 189 +190 190 +191 191 +192 192 +193 193 +194 194 +195 195 +196 196 +197 197 +198 198 +199 199 +200 200 +201 201 +202 202 +203 203 +204 204 +205 205 +206 206 +207 207 +208 208 +209 209 +210 210 +211 211 +212 212 +213 213 +214 214 +215 215 +216 216 +217 217 +218 218 +219 219 +220 220 +221 221 +222 222 +223 223 +224 224 +225 225 +226 226 +227 227 +228 228 +229 229 +230 230 +231 231 +232 232 +233 233 +234 234 +235 235 +236 236 +237 237 +238 238 +239 239 +240 240 +241 241 +242 242 +243 243 +244 244 +245 245 +246 246 +247 247 +248 248 +249 249 +250 250 +251 251 +252 252 +253 253 +254 254 +255 255 +256 256 +257 257 +258 258 +259 259 +260 260 +261 261 +262 262 +263 263 +264 264 +265 265 +266 266 +267 267 +268 268 +269 269 +270 270 +271 271 +272 272 +273 273 +274 274 +275 275 +276 276 +277 277 +278 278 +279 279 +280 280 +281 281 +282 282 +283 283 +284 284 +285 285 +286 286 +287 287 +288 288 +289 289 +290 290 +291 291 +292 292 +293 293 +294 294 +295 295 +296 296 +297 297 +298 298 +299 299 +300 300 +301 301 +302 302 +303 303 +304 304 +305 305 +306 306 +307 307 +308 308 +309 309 +310 310 +311 311 +312 312 +313 313 +314 314 +315 315 +316 316 +317 317 +318 318 +319 319 +320 320 +321 321 +322 322 +323 323 +324 324 +325 325 +326 326 +327 327 +328 328 +329 329 +330 330 +331 331 +332 332 +333 333 +334 334 +335 335 +336 336 +337 337 +338 338 +339 339 +340 340 +341 341 +342 342 +343 343 +344 344 +345 345 +346 346 +347 347 +348 348 +349 349 +350 350 +351 351 +352 352 +353 353 +354 354 +355 355 +356 356 +357 357 +358 358 +359 359 +360 360 +361 361 +362 362 +363 363 +364 364 +365 365 +366 366 +367 367 +368 368 +369 369 +370 370 +371 371 +372 372 +373 373 +374 374 +375 375 +376 376 +377 377 +378 378 +379 379 +380 380 +381 381 +382 382 +383 383 +384 384 +385 385 +386 386 +387 387 +388 388 +389 389 +390 390 +391 391 +392 392 +393 393 +394 394 +395 395 +396 396 +397 397 +398 398 +399 399 +400 400 +401 401 +402 402 +403 403 +404 404 +405 405 +406 406 +407 407 +408 408 +409 409 +410 410 +411 411 +412 412 +413 413 +414 414 +415 415 +416 416 +417 417 +418 418 +419 419 +420 420 +421 421 +422 422 +423 423 +424 424 +425 425 +426 426 +427 427 +428 428 +429 429 +430 430 +431 431 +432 432 +433 433 +434 434 +435 435 +436 436 +437 437 +438 438 +439 439 +440 440 +441 441 +442 442 +443 443 +444 444 +445 445 +446 446 +447 447 +448 448 +449 449 +450 450 +451 451 +452 452 +453 453 +454 454 +455 455 +456 456 +457 457 +458 458 +459 459 +460 460 +461 461 +462 462 +463 463 +464 464 +465 465 +466 466 +467 467 +468 468 +469 469 +470 470 +471 471 +472 472 +473 473 +474 474 +475 475 +476 476 +477 477 +478 478 +479 479 +480 480 +481 481 +482 482 +483 483 +484 484 +485 485 +486 486 +487 487 +488 488 +489 489 +490 490 +491 491 +492 492 +493 493 +494 494 +495 495 +496 496 +497 497 +498 498 +499 499 +500 500 +501 501 +502 502 +503 503 +504 504 +505 505 +506 506 +507 507 +508 508 +509 509 +510 510 +511 511 +512 512 +513 513 +514 514 +515 515 +516 516 +517 517 +518 518 +519 519 +520 520 +521 521 +522 522 +523 523 +524 524 +525 525 +526 526 +527 527 +528 528 +529 529 +530 530 +531 531 +532 532 +533 533 +534 534 +535 535 +536 536 +537 537 +538 538 +539 539 +540 540 +541 541 +542 542 +543 543 +544 544 +545 545 +546 546 +547 547 +548 548 +549 549 +550 550 +551 551 +552 552 +553 553 +554 554 +555 555 +556 556 +557 557 +558 558 +559 559 +560 560 +561 561 +562 562 +563 563 +564 564 +565 565 +566 566 +567 567 +568 568 +569 569 +570 570 +571 571 +572 572 +573 573 +574 574 +575 575 +576 576 +577 577 +578 578 +579 579 +580 580 +581 581 +582 582 +583 583 +584 584 +585 585 +586 586 +587 587 +588 588 +589 589 +590 590 +591 591 +592 592 +593 593 +594 594 +595 595 +596 596 +597 597 +598 598 +599 599 +600 600 +601 601 +602 602 +603 603 +604 604 +605 605 +606 606 +607 607 +608 608 +609 609 +610 610 +611 611 +612 612 +613 613 +614 614 +615 615 +616 616 +617 617 +618 618 +619 619 +620 620 +621 621 +622 622 +623 623 +624 624 +625 625 +626 626 +627 627 +628 628 +629 629 +630 630 +631 631 +632 632 +633 633 +634 634 +635 635 +636 636 +637 637 +638 638 +639 639 +640 640 +641 641 +642 642 +643 643 +644 644 +645 645 +646 646 +647 647 +648 648 +649 649 +650 650 +651 651 +652 652 +653 653 +654 654 +655 655 +656 656 +657 657 +658 658 +659 659 +660 660 +661 661 +662 662 +663 663 +664 664 +665 665 +666 666 +667 667 +668 668 +669 669 +670 670 +671 671 +672 672 +673 673 +674 674 +675 675 +676 676 +677 677 +678 678 +679 679 +680 680 +681 681 +682 682 +683 683 +684 684 +685 685 +686 686 +687 687 +688 688 +689 689 +690 690 +691 691 +692 692 +693 693 +694 694 +695 695 +696 696 +697 697 +698 698 +699 699 +700 700 +701 701 +702 702 +703 703 +704 704 +705 705 +706 706 +707 707 +708 708 +709 709 +710 710 +711 711 +712 712 +713 713 +714 714 +715 715 +716 716 +717 717 +718 718 +719 719 +720 720 +721 721 +722 722 +723 723 +724 724 +725 725 +726 726 +727 727 +728 728 +729 729 +730 730 +731 731 +732 732 +733 733 +734 734 +735 735 +736 736 +737 737 +738 738 +739 739 +740 740 +741 741 +742 742 +743 743 +744 744 +745 745 +746 746 +747 747 +748 748 +749 749 +750 750 +751 751 +752 752 +753 753 +754 754 +755 755 +756 756 +757 757 +758 758 +759 759 +760 760 +761 761 +762 762 +763 763 +764 764 +765 765 +766 766 +767 767 +768 768 +769 769 +770 770 +771 771 +772 772 +773 773 +774 774 +775 775 +776 776 +777 777 +778 778 +779 779 +780 780 +781 781 +782 782 +783 783 +784 784 +785 785 +786 786 +787 787 +788 788 +789 789 +790 790 +791 791 +792 792 +793 793 +794 794 +795 795 +796 796 +797 797 +798 798 +799 799 +800 800 +801 801 +802 802 +803 803 +804 804 +805 805 +806 806 +807 807 +808 808 +809 809 +810 810 +811 811 +812 812 +813 813 +814 814 +815 815 +816 816 +817 817 +818 818 +819 819 +820 820 +821 821 +822 822 +823 823 +824 824 +825 825 +826 826 +827 827 +828 828 +829 829 +830 830 +831 831 +832 832 +833 833 +834 834 +835 835 +836 836 +837 837 +838 838 +839 839 +840 840 +841 841 +842 842 +843 843 +844 844 +845 845 +846 846 +847 847 +848 848 +849 849 +850 850 +851 851 +852 852 +853 853 +854 854 +855 855 +856 856 +857 857 +858 858 +859 859 +860 860 +861 861 +862 862 +863 863 +864 864 +865 865 +866 866 +867 867 +868 868 +869 869 +870 870 +871 871 +872 872 +873 873 +874 874 +875 875 +876 876 +877 877 +878 878 +879 879 +880 880 +881 881 +882 882 +883 883 +884 884 +885 885 +886 886 +887 887 +888 888 +889 889 +890 890 +891 891 +892 892 +893 893 +894 894 +895 895 +896 896 +897 897 +898 898 +899 899 +900 900 +901 901 +902 902 +903 903 +904 904 +905 905 +906 906 +907 907 +908 908 +909 909 +910 910 +911 911 +912 912 +913 913 +914 914 +915 915 +916 916 +917 917 +918 918 +919 919 +920 920 +921 921 +922 922 +923 923 +924 924 +925 925 +926 926 +927 927 +928 928 +929 929 +930 930 +931 931 +932 932 +933 933 +934 934 +935 935 +936 936 +937 937 +938 938 +939 939 +940 940 +941 941 +942 942 +943 943 +944 944 +945 945 +946 946 +947 947 +948 948 +949 949 +950 950 +951 951 +952 952 +953 953 +954 954 +955 955 +956 956 +957 957 +958 958 +959 959 +960 960 +961 961 +962 962 +963 963 +964 964 +965 965 +966 966 +967 967 +968 968 +969 969 +970 970 +971 971 +972 972 +973 973 +974 974 +975 975 +976 976 +977 977 +978 978 +979 979 +980 980 +981 981 +982 982 +983 983 +984 984 +985 985 +986 986 +987 987 +988 988 +989 989 +990 990 +991 991 +992 992 +993 993 +994 994 +995 995 +996 996 +997 997 +998 998 +999 999 diff --git a/tests/psql/test1.cpp b/tests/psql/test1.cpp index 5d4e06f..fd5de3d 100644 --- a/tests/psql/test1.cpp +++ b/tests/psql/test1.cpp @@ -16,7 +16,6 @@ int main( ) { cout << "Conntected to database." << endl << "Backend protocol version: " << c.server_version( ) << endl << "Protocol version: " << c.protocol_version( ) << endl - << "Server PID: " << c.backendpid( ) << endl << "Prepared Statements: " << c.supports( c.cap_prepared_statements ) << endl; work t( c, "test transaction" ); diff --git a/tests/psql/test2.MUST b/tests/psql/test2.MUST new file mode 100644 index 0000000..08d9be2 --- /dev/null +++ b/tests/psql/test2.MUST @@ -0,0 +1,1001 @@ +a b +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +21 21 +22 22 +23 23 +24 24 +25 25 +26 26 +27 27 +28 28 +29 29 +30 30 +31 31 +32 32 +33 33 +34 34 +35 35 +36 36 +37 37 +38 38 +39 39 +40 40 +41 41 +42 42 +43 43 +44 44 +45 45 +46 46 +47 47 +48 48 +49 49 +50 50 +51 51 +52 52 +53 53 +54 54 +55 55 +56 56 +57 57 +58 58 +59 59 +60 60 +61 61 +62 62 +63 63 +64 64 +65 65 +66 66 +67 67 +68 68 +69 69 +70 70 +71 71 +72 72 +73 73 +74 74 +75 75 +76 76 +77 77 +78 78 +79 79 +80 80 +81 81 +82 82 +83 83 +84 84 +85 85 +86 86 +87 87 +88 88 +89 89 +90 90 +91 91 +92 92 +93 93 +94 94 +95 95 +96 96 +97 97 +98 98 +99 99 +100 100 +101 101 +102 102 +103 103 +104 104 +105 105 +106 106 +107 107 +108 108 +109 109 +110 110 +111 111 +112 112 +113 113 +114 114 +115 115 +116 116 +117 117 +118 118 +119 119 +120 120 +121 121 +122 122 +123 123 +124 124 +125 125 +126 126 +127 127 +128 128 +129 129 +130 130 +131 131 +132 132 +133 133 +134 134 +135 135 +136 136 +137 137 +138 138 +139 139 +140 140 +141 141 +142 142 +143 143 +144 144 +145 145 +146 146 +147 147 +148 148 +149 149 +150 150 +151 151 +152 152 +153 153 +154 154 +155 155 +156 156 +157 157 +158 158 +159 159 +160 160 +161 161 +162 162 +163 163 +164 164 +165 165 +166 166 +167 167 +168 168 +169 169 +170 170 +171 171 +172 172 +173 173 +174 174 +175 175 +176 176 +177 177 +178 178 +179 179 +180 180 +181 181 +182 182 +183 183 +184 184 +185 185 +186 186 +187 187 +188 188 +189 189 +190 190 +191 191 +192 192 +193 193 +194 194 +195 195 +196 196 +197 197 +198 198 +199 199 +200 200 +201 201 +202 202 +203 203 +204 204 +205 205 +206 206 +207 207 +208 208 +209 209 +210 210 +211 211 +212 212 +213 213 +214 214 +215 215 +216 216 +217 217 +218 218 +219 219 +220 220 +221 221 +222 222 +223 223 +224 224 +225 225 +226 226 +227 227 +228 228 +229 229 +230 230 +231 231 +232 232 +233 233 +234 234 +235 235 +236 236 +237 237 +238 238 +239 239 +240 240 +241 241 +242 242 +243 243 +244 244 +245 245 +246 246 +247 247 +248 248 +249 249 +250 250 +251 251 +252 252 +253 253 +254 254 +255 255 +256 256 +257 257 +258 258 +259 259 +260 260 +261 261 +262 262 +263 263 +264 264 +265 265 +266 266 +267 267 +268 268 +269 269 +270 270 +271 271 +272 272 +273 273 +274 274 +275 275 +276 276 +277 277 +278 278 +279 279 +280 280 +281 281 +282 282 +283 283 +284 284 +285 285 +286 286 +287 287 +288 288 +289 289 +290 290 +291 291 +292 292 +293 293 +294 294 +295 295 +296 296 +297 297 +298 298 +299 299 +300 300 +301 301 +302 302 +303 303 +304 304 +305 305 +306 306 +307 307 +308 308 +309 309 +310 310 +311 311 +312 312 +313 313 +314 314 +315 315 +316 316 +317 317 +318 318 +319 319 +320 320 +321 321 +322 322 +323 323 +324 324 +325 325 +326 326 +327 327 +328 328 +329 329 +330 330 +331 331 +332 332 +333 333 +334 334 +335 335 +336 336 +337 337 +338 338 +339 339 +340 340 +341 341 +342 342 +343 343 +344 344 +345 345 +346 346 +347 347 +348 348 +349 349 +350 350 +351 351 +352 352 +353 353 +354 354 +355 355 +356 356 +357 357 +358 358 +359 359 +360 360 +361 361 +362 362 +363 363 +364 364 +365 365 +366 366 +367 367 +368 368 +369 369 +370 370 +371 371 +372 372 +373 373 +374 374 +375 375 +376 376 +377 377 +378 378 +379 379 +380 380 +381 381 +382 382 +383 383 +384 384 +385 385 +386 386 +387 387 +388 388 +389 389 +390 390 +391 391 +392 392 +393 393 +394 394 +395 395 +396 396 +397 397 +398 398 +399 399 +400 400 +401 401 +402 402 +403 403 +404 404 +405 405 +406 406 +407 407 +408 408 +409 409 +410 410 +411 411 +412 412 +413 413 +414 414 +415 415 +416 416 +417 417 +418 418 +419 419 +420 420 +421 421 +422 422 +423 423 +424 424 +425 425 +426 426 +427 427 +428 428 +429 429 +430 430 +431 431 +432 432 +433 433 +434 434 +435 435 +436 436 +437 437 +438 438 +439 439 +440 440 +441 441 +442 442 +443 443 +444 444 +445 445 +446 446 +447 447 +448 448 +449 449 +450 450 +451 451 +452 452 +453 453 +454 454 +455 455 +456 456 +457 457 +458 458 +459 459 +460 460 +461 461 +462 462 +463 463 +464 464 +465 465 +466 466 +467 467 +468 468 +469 469 +470 470 +471 471 +472 472 +473 473 +474 474 +475 475 +476 476 +477 477 +478 478 +479 479 +480 480 +481 481 +482 482 +483 483 +484 484 +485 485 +486 486 +487 487 +488 488 +489 489 +490 490 +491 491 +492 492 +493 493 +494 494 +495 495 +496 496 +497 497 +498 498 +499 499 +500 500 +501 501 +502 502 +503 503 +504 504 +505 505 +506 506 +507 507 +508 508 +509 509 +510 510 +511 511 +512 512 +513 513 +514 514 +515 515 +516 516 +517 517 +518 518 +519 519 +520 520 +521 521 +522 522 +523 523 +524 524 +525 525 +526 526 +527 527 +528 528 +529 529 +530 530 +531 531 +532 532 +533 533 +534 534 +535 535 +536 536 +537 537 +538 538 +539 539 +540 540 +541 541 +542 542 +543 543 +544 544 +545 545 +546 546 +547 547 +548 548 +549 549 +550 550 +551 551 +552 552 +553 553 +554 554 +555 555 +556 556 +557 557 +558 558 +559 559 +560 560 +561 561 +562 562 +563 563 +564 564 +565 565 +566 566 +567 567 +568 568 +569 569 +570 570 +571 571 +572 572 +573 573 +574 574 +575 575 +576 576 +577 577 +578 578 +579 579 +580 580 +581 581 +582 582 +583 583 +584 584 +585 585 +586 586 +587 587 +588 588 +589 589 +590 590 +591 591 +592 592 +593 593 +594 594 +595 595 +596 596 +597 597 +598 598 +599 599 +600 600 +601 601 +602 602 +603 603 +604 604 +605 605 +606 606 +607 607 +608 608 +609 609 +610 610 +611 611 +612 612 +613 613 +614 614 +615 615 +616 616 +617 617 +618 618 +619 619 +620 620 +621 621 +622 622 +623 623 +624 624 +625 625 +626 626 +627 627 +628 628 +629 629 +630 630 +631 631 +632 632 +633 633 +634 634 +635 635 +636 636 +637 637 +638 638 +639 639 +640 640 +641 641 +642 642 +643 643 +644 644 +645 645 +646 646 +647 647 +648 648 +649 649 +650 650 +651 651 +652 652 +653 653 +654 654 +655 655 +656 656 +657 657 +658 658 +659 659 +660 660 +661 661 +662 662 +663 663 +664 664 +665 665 +666 666 +667 667 +668 668 +669 669 +670 670 +671 671 +672 672 +673 673 +674 674 +675 675 +676 676 +677 677 +678 678 +679 679 +680 680 +681 681 +682 682 +683 683 +684 684 +685 685 +686 686 +687 687 +688 688 +689 689 +690 690 +691 691 +692 692 +693 693 +694 694 +695 695 +696 696 +697 697 +698 698 +699 699 +700 700 +701 701 +702 702 +703 703 +704 704 +705 705 +706 706 +707 707 +708 708 +709 709 +710 710 +711 711 +712 712 +713 713 +714 714 +715 715 +716 716 +717 717 +718 718 +719 719 +720 720 +721 721 +722 722 +723 723 +724 724 +725 725 +726 726 +727 727 +728 728 +729 729 +730 730 +731 731 +732 732 +733 733 +734 734 +735 735 +736 736 +737 737 +738 738 +739 739 +740 740 +741 741 +742 742 +743 743 +744 744 +745 745 +746 746 +747 747 +748 748 +749 749 +750 750 +751 751 +752 752 +753 753 +754 754 +755 755 +756 756 +757 757 +758 758 +759 759 +760 760 +761 761 +762 762 +763 763 +764 764 +765 765 +766 766 +767 767 +768 768 +769 769 +770 770 +771 771 +772 772 +773 773 +774 774 +775 775 +776 776 +777 777 +778 778 +779 779 +780 780 +781 781 +782 782 +783 783 +784 784 +785 785 +786 786 +787 787 +788 788 +789 789 +790 790 +791 791 +792 792 +793 793 +794 794 +795 795 +796 796 +797 797 +798 798 +799 799 +800 800 +801 801 +802 802 +803 803 +804 804 +805 805 +806 806 +807 807 +808 808 +809 809 +810 810 +811 811 +812 812 +813 813 +814 814 +815 815 +816 816 +817 817 +818 818 +819 819 +820 820 +821 821 +822 822 +823 823 +824 824 +825 825 +826 826 +827 827 +828 828 +829 829 +830 830 +831 831 +832 832 +833 833 +834 834 +835 835 +836 836 +837 837 +838 838 +839 839 +840 840 +841 841 +842 842 +843 843 +844 844 +845 845 +846 846 +847 847 +848 848 +849 849 +850 850 +851 851 +852 852 +853 853 +854 854 +855 855 +856 856 +857 857 +858 858 +859 859 +860 860 +861 861 +862 862 +863 863 +864 864 +865 865 +866 866 +867 867 +868 868 +869 869 +870 870 +871 871 +872 872 +873 873 +874 874 +875 875 +876 876 +877 877 +878 878 +879 879 +880 880 +881 881 +882 882 +883 883 +884 884 +885 885 +886 886 +887 887 +888 888 +889 889 +890 890 +891 891 +892 892 +893 893 +894 894 +895 895 +896 896 +897 897 +898 898 +899 899 +900 900 +901 901 +902 902 +903 903 +904 904 +905 905 +906 906 +907 907 +908 908 +909 909 +910 910 +911 911 +912 912 +913 913 +914 914 +915 915 +916 916 +917 917 +918 918 +919 919 +920 920 +921 921 +922 922 +923 923 +924 924 +925 925 +926 926 +927 927 +928 928 +929 929 +930 930 +931 931 +932 932 +933 933 +934 934 +935 935 +936 936 +937 937 +938 938 +939 939 +940 940 +941 941 +942 942 +943 943 +944 944 +945 945 +946 946 +947 947 +948 948 +949 949 +950 950 +951 951 +952 952 +953 953 +954 954 +955 955 +956 956 +957 957 +958 958 +959 959 +960 960 +961 961 +962 962 +963 963 +964 964 +965 965 +966 966 +967 967 +968 968 +969 969 +970 970 +971 971 +972 972 +973 973 +974 974 +975 975 +976 976 +977 977 +978 978 +979 979 +980 980 +981 981 +982 982 +983 983 +984 984 +985 985 +986 986 +987 987 +988 988 +989 989 +990 990 +991 991 +992 992 +993 993 +994 994 +995 995 +996 996 +997 997 +998 998 +999 999 |