From c96771fb9ad32b19c021491f2cb30256a937bccd Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Tue, 6 Dec 2011 16:02:12 +0200 Subject: [PATCH] move to antimake --- Makefile | 314 +++++++++++++------------------------------------- autogen.sh | 18 +-- config.mak.in | 72 +++++++----- configure.ac | 4 +- lib | 2 +- 5 files changed, 133 insertions(+), 277 deletions(-) diff --git a/Makefile b/Makefile index d310ebb..1387ca4 100644 --- a/Makefile +++ b/Makefile @@ -1,247 +1,97 @@ -# sources -SRCS = client.c loader.c objects.c pooler.c proto.c sbuf.c server.c util.c \ - admin.c stats.c takeover.c janitor.c pktbuf.c system.c main.c \ - varcache.c dnslookup.c -HDRS = client.h loader.h objects.h pooler.h proto.h sbuf.h server.h util.h \ - admin.h stats.h takeover.h janitor.h pktbuf.h system.h bouncer.h \ - varcache.h iobuf.h dnslookup.h - -# data & dirs to include in tgz -DOCS = doc/overview.txt doc/usage.txt doc/config.txt doc/todo.txt doc/faq.txt -MANPAGES = doc/pgbouncer.1 doc/pgbouncer.5 -DATA = README NEWS AUTHORS COPYRIGHT etc/pgbouncer.ini etc/userlist.txt Makefile \ - config.mak.in etc/mkauth.py \ - config.sub config.guess install-sh autogen.sh \ - configure configure.ac debian/packages debian/changelog doc/Makefile \ - test/Makefile test/asynctest.c test/conntest.sh test/ctest6000.ini \ - test/ctest7000.ini test/run-conntest.sh test/stress.py test/test.ini \ - test/test.sh test/userlist.txt etc/example.debian.init.sh doc/fixman.py \ - win32/eventmsg.mc win32/eventmsg.rc win32/MSG00001.bin \ - win32/Makefile win32/pgbevent.c \ - win32/win32support.c win32/win32support.h -DIRS = doc etc include src debian test win32 - -# keep autoconf stuff separate --include config.mak - -# fill values for unconfigured tree -srcdir ?= . -builddir ?= . - -local_hdrs = $(addprefix $(srcdir)/include/, $(HDRS)) -local_srcs = $(addprefix $(srcdir)/src/, $(SRCS)) - -USUAL_DIR = $(srcdir)/lib -USUAL_OBJDIR = $(builddir)/obj -USUAL_LOCAL_SRCS = $(local_srcs) $(local_hdrs) -include $(USUAL_DIR)/Setup.mk - -# calculate full-path values -OBJS = $(SRCS:.c=.o) -hdrs = $(local_hdrs) $(USUAL_HDRS) -srcs = $(local_srcs) -objs = $(addprefix $(builddir)/obj/, $(OBJS)) $(USUAL_OBJS) -FULL = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION) -DISTFILES = $(DIRS) $(DATA) $(DOCS) $(local_srcs) $(local_hdrs) $(MANPAGES) -exe = $(builddir)/pgbouncer$(EXT) - -CPPFLAGS := -I$(srcdir)/include $(USUAL_CPPFLAGS) $(CPPFLAGS) +include config.mak + +bin_PROGRAMS = pgbouncer + +pgbouncer_SOURCES = \ + src/admin.c \ + src/client.c \ + src/dnslookup.c \ + src/janitor.c \ + src/loader.c \ + src/main.c \ + src/objects.c \ + src/pktbuf.c \ + src/pooler.c \ + src/proto.c \ + src/sbuf.c \ + src/server.c \ + src/stats.c \ + src/system.c \ + src/takeover.c \ + src/util.c \ + src/varcache.c \ + include/admin.h \ + include/bouncer.h \ + include/client.h \ + include/dnslookup.h \ + include/iobuf.h \ + include/janitor.h \ + include/loader.h \ + include/objects.h \ + include/pktbuf.h \ + include/pooler.h \ + include/proto.h \ + include/sbuf.h \ + include/server.h \ + include/stats.h \ + include/system.h \ + include/takeover.h \ + include/util.h \ + include/varcache.h + +# docs to install as-is +dist_doc_DATA = doc/overview.txt doc/usage.txt doc/config.txt doc/todo.txt doc/faq.txt \ + README NEWS etc/pgbouncer.ini etc/userlist.txt + +# manpages +man_MANS = doc/pgbouncer.1 doc/pgbouncer.5 + +# files in tgz +EXTRA_DIST = AUTHORS COPYRIGHT Makefile \ + config.mak.in etc/mkauth.py \ + config.sub config.guess install-sh autogen.sh \ + configure configure.ac debian/packages debian/changelog doc/Makefile \ + test/Makefile test/asynctest.c test/conntest.sh test/ctest6000.ini \ + test/ctest7000.ini test/run-conntest.sh test/stress.py test/test.ini \ + test/test.sh test/userlist.txt etc/example.debian.init.sh doc/fixman.py \ + win32/Makefile ifeq ($(enable_debug),yes) CPPFLAGS += -DDBGVER="\"compiled by <$${USER}@`hostname`> at `date '+%Y-%m-%d %H:%M:%S'`\"" endif -ifeq ($(PORTNAME),win32) - -EXT = .exe - -CPPFLAGS += -I$(srcdir)/win32 -WSRCS = win32support.c -WHDRS = win32support.h -WOBJS = $(WSRCS:.c=.o) -srcs += $(srcdir)/win32/win32support.c -hdrs += $(srcdir)/win32/win32support.h -objs += $(builddir)/obj/win32support.o - -dll = $(builddir)/pgbevent.dll -dlldef = $(builddir)/obj/pgbevent.def -dllobjs = $(builddir)/obj/eventmsg.o $(builddir)/obj/pgbevent.o - -DEFFLAGS = --export-all-symbols -A - -endif - -# Quiet by default, 'make V=1' shows commands -V=0 -ifeq ($(V), 0) -Q = @ -E = @echo -else -Q = -E = @true -endif - -## actual targets now ## - -# default target -all: $(exe) $(dll) doc-all - -# final executable -$(exe): $(builddir)/config.mak $(objs) - $(E) " LD" $@ - $(Q) $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(objs) $(LIBS) -ifeq ($(enable_debug),no) - $(STRIP) $@ -endif - -# objects depend on all the headers -$(builddir)/obj/%.o: $(srcdir)/src/%.c $(builddir)/config.mak $(hdrs) - @mkdir -p $(builddir)/obj - $(E) " CC" $< - $(Q) $(CC) -c -o $@ $< $(DEFS) $(CFLAGS) $(CPPFLAGS) - -$(builddir)/obj/%.o: $(srcdir)/win32/%.c $(builddir)/config.mak $(hdrs) - @mkdir -p $(builddir)/obj - $(E) " CC" $< - $(Q) $(CC) -c -o $@ $< $(DEFS) $(CFLAGS) $(CPPFLAGS) - -$(builddir)/obj/%.o: $(USUAL_DIR)/usual/%.c $(builddir)/config.mak $(hdrs) - @mkdir -p $(builddir)/obj - $(E) " CC" $< - $(Q) $(CC) -c -o $@ $< $(DEFS) $(CFLAGS) $(CPPFLAGS) - -# install binary and other stuff -install: $(exe) doc-install - mkdir -p $(DESTDIR)$(bindir) - mkdir -p $(DESTDIR)$(docdir) - $(BININSTALL) -m 755 $(exe) $(DESTDIR)$(bindir) - $(INSTALL) -m 644 $(srcdir)/etc/pgbouncer.ini $(DESTDIR)$(docdir) -ifeq ($(PORTNAME),win32) - $(BININSTALL) -m 755 $(dll) $(DESTDIR)$(bindir) -endif - -# create tarfile -tgz: config.mak $(DISTFILES) $(MANPAGES) - rm -rf $(FULL) $(FULL).tgz - mkdir $(FULL) - (for f in $(DISTFILES) $(USUAL_DIR) $(USUAL_DIST) $(USUAL_HDRS) $(USUAL_SRCS); \ - do echo $$f; done) | cpio -pm $(FULL) - tar czf $(FULL).tgz $(FULL) - rm -rf $(FULL) - -doc/pgbouncer.1: - $(MAKE) -C doc pgbouncer.1 - -doc/pgbouncer.5: - $(MAKE) -C doc pgbouncer.5 - -# create debian package -deb: configure - yada rebuild - debuild -uc -us -b - -# clean object files -clean: doc-clean - rm -f $(objs) $(exe) $(dll) $(dlldef) $(dllobjs) - -# clean configure results -distclean: clean doc-distclean - rm -f include/config.h include/config.h.in~ config.log config.status config.mak - rm -rf obj autom4te* - -# clean autoconf results -realclean: distclean doc-realclean - rm -f aclocal* include/config.h.in configure depcomp install-sh missing - rm -f tags - -# generate configure script and config.h.in -boot: - ./autogen.sh - -# targets can depend on this to force ./configure -$(builddir)/config.mak:: - @test -f $(srcdir)/configure || { \ - echo "Please run 'make boot && ./configure' first.";exit 1;} - @test -f $@ || { echo "Please run ./configure first.";exit 1;} +# +# win32 +# -doc-all doc-install doc-clean doc-distclean doc-realclean: - @if test -d doc; then $(MAKE) -C doc $(subst doc-,,$@) DESTDIR=$(DESTDIR) ;\ - else true; fi - - -# targets can depend on this to force 'make boot' -configure:: - @test -f $@ || { echo "Please run 'make boot' first.";exit 1;} - -# create tags file -tags: $(srcs) $(hdrs) - if test -f ../libevent/event.h; then \ - ctags $(srcs) $(hdrs) ../libevent/*.[ch]; \ - else \ - ctags $(srcs) $(hdrs); \ - fi - -# run sparse over code -check: config.mak - REAL_CC="$(CC)" \ - $(MAKE) clean pgbouncer CC=cgcc - -# profiled exe -pgbouncer.pg: - $(CC) -pg $(DEFS) -g -O2 $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(srcs) $(LIBS) - -pg: pgbouncer.pg - -# asm hacks -$(builddir)/obj/%.s: $(srcdir)/src/%.c config.mak $(hdrs) - @mkdir -p $(builddir)/obj - $(E) " CC -S" $< - $(Q) $(CC) -S -fverbose-asm -o - $< $(DEFS) $(CFLAGS) $(CPPFLAGS) \ - | cleanasm > $@ -asms = $(objs:.o=.s) -asm: $(asms) +pgbouncer_LIBS := $(LIBS) +LIBS := +EXTRA_pgbouncer_SOURCES = win32/win32support.c win32/win32support.h +EXTRA_PROGRAMS = pgbevent ifeq ($(PORTNAME),win32) - -$(builddir)/obj/eventmsg.o: $(srcdir)/win32/eventmsg.rc - $(E) " WINDRES" $< - $(Q) $(WINDRES) $< -o $@ --include-dir=$(srcdir)/win32 - -$(dlldef): $(dllobjs) - $(E) " DLLTOOL" $@ - $(Q) $(DLLTOOL) $(DEFFLAGS) --output-def $@ $(dllobjs) - -# final executable -$(dll): $(builddir)/config.mak $(dllobjs) $(dlldef) - $(E) " DLLWRAP" $@ - $(Q) $(DLLWRAP) --def $(dlldef) -o $@ $(dllobjs) - $(STRIP) $@ +pgbouncer_CPPFLAGS = -I$(srcdir)/win32 +pgbouncer_SOURCES += $(EXTRA_pgbouncer_SOURCES) +bin_PROGRAMS += pgbevent endif -zip = pgbouncer-$(PACKAGE_VERSION)-win32.zip - -zip: configure - make distclean - ./configure i586-mingw32msvc --disable-debug --with-libevent=/opt/apps/win32 --enable-evdns - make -C doc html - make pgbouncer.exe pgbevent.dll - cp COPYRIGHT doc/COPYRIGHT.txt - cp AUTHORS doc/AUTHORS.txt - make packzip +pgbevent_SOURCES = win32/pgbevent.c win32/eventmsg.rc \ + win32/eventmsg.mc win32/MSG00001.bin +pgbevent_EXT = .dll +pgbevent_LINK = $(CC) -shared --export-all-symbols -o $@ $^ -packzip: pgbouncer.exe - rm -f $(zip) - zip $(zip) pgbouncer.exe pgbevent.dll doc/AUTHORS.txt doc/COPYRIGHT.txt doc/*.html etc/pgbouncer.ini etc/userlist.txt - rm -f doc/AUTHORS.txt doc/COPYRIGHT.txt +# .rc->.o +AM_LANGUAGES = RC +AM_LANG_RC_SRCEXTS = .rc +AM_LANG_RC_COMPILE = $(WINDRES) $< -o $@ --include-dir=$(srcdir)/win32 +AM_LANG_RC_LINK = false -zipupload: $(zip) - rsync $(zip) pgf:web/pgbouncer/htdocs/win32/ +# +# now load antimake +# -stripped: $(exe) $(dll) - $(STRIP) $(exe) $(dll) +USUAL_DIR = $(top_srcdir)/lib +pgbouncer_EMBED_LIBUSUAL = 1 +include $(abs_top_srcdir)/lib/mk/antimake.mk -tmp: - @echo CPPFLAGS=$(CPPFLAGS) - @echo USUAL_CPPFLAGS=$(USUAL_CPPFLAGS) - @echo USUAL_LDFLAGS=$(USUAL_LDFLAGS) diff --git a/autogen.sh b/autogen.sh index 5fd2c47..d0ff701 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,21 +1,5 @@ #! /bin/sh -# get install-sh, config.* -rm -f config.sub config.guess install-sh ltmain.sh +./lib/mk/std-autogen.sh ./lib -if libtoolize --help | grep "[-][-]install" > /dev/null; then - libtoolize --install --copy -else - libtoolize --copy -fi - -rm -f ltmain.sh - -rm -f lib/usual/config.* configure - -aclocal -I ./lib/m4 -autoheader -autoconf - -rm -rf autom4te* diff --git a/config.mak.in b/config.mak.in index 81ff93b..1cd2e80 100644 --- a/config.mak.in +++ b/config.mak.in @@ -1,45 +1,65 @@ -PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ - +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PORTNAME = @PORTNAME@ - -DEFS = @DEFS@ -LIBS = @LIBS@ +EXEEXT = @EXEEXT@ +HAVE_CC_DEPFLAG = @HAVE_CC_DEPFLAG@ CC = @CC@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CFLAGS = @CFLAGS@ @WFLAGS@ +CFLAGS = @CFLAGS@ +DEFS = @DEFS@ +WFLAGS = @WFLAGS@ +CXX = @CXX@ +CXXFLAGS = @CXXFLAGS@ +LD = @LD@ LDFLAGS = @LDFLAGS@ - -XMLTO = @XMLTO@ -ASCIIDOC = @ASCIIDOC@ -DLLWRAP = @DLLWRAP@ -DLLTOOL = @DLLTOOL@ -WINDRES = @WINDRES@ +LIBS = @LIBS@ +AR = @AR@ +ARFLAGS = @ARFLAGS@ +RANLIB = @RANLIB@ +LIBTOOL = @LIBTOOL@ +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_DATA = @INSTALL_DATA@ +MKDIR_P = @MKDIR_P@ +SED = @SED@ +AWK = @AWK@ +GREP = @GREP@ +EGREP = @EGREP@ STRIP = @STRIP@ - prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ +includedir = @includedir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ datarootdir = @datarootdir@ +datadir = @datadir@ sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ docdir = @docdir@ mandir = @mandir@ +libdir = @libdir@ +localedir = @localedir@ +pkgdatadir = @pkgdatadir@ +pkgconfigdir = @pkgconfigdir@ +abs_top_srcdir ?= @abs_top_srcdir@ +abs_top_builddir ?= @abs_top_builddir@ +nosub_top_srcdir ?= @top_srcdir@ +nosub_top_builddir ?= @top_builddir@ -top_builddir = @top_builddir@ -srcdir = @srcdir@ -abs_srcdir = @abs_srcdir@ -top_srcdir = @top_srcdir@ -abs_top_srcdir = @abs_top_srcdir@ -builddir = @builddir@ -abs_builddir = @abs_builddir@ -abs_top_builddir = @abs_top_builddir@ -# autoconf does not want to find 'install' -# if im not using automake... -INSTALL = @INSTALL@ -BININSTALL = @BININSTALL@ + + +XMLTO = @XMLTO@ +ASCIIDOC = @ASCIIDOC@ +DLLWRAP = @DLLWRAP@ +DLLTOOL = @DLLTOOL@ +WINDRES = @WINDRES@ enable_debug = @enable_debug@ have_libevent = @have_libevent@ diff --git a/configure.ac b/configure.ac index 486ee81..9d659b5 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,9 @@ AC_CONFIG_HEADER(lib/usual/config.h) AC_PREREQ([2.59]) dnl unix/win32 -AC_USUAL_PORT_CHECK +AC_USUAL_INIT + +LT_INIT dnl Checks for programs. AC_USUAL_PROGRAM_CHECK diff --git a/lib b/lib index e4a86f4..24bcc4b 160000 --- a/lib +++ b/lib @@ -1 +1 @@ -Subproject commit e4a86f4af27f958cdf8a6dcb08954ae6c745be6f +Subproject commit 24bcc4b45ebee57af523d95898e99e29a5ade369 -- 2.50.1