3 SRCS
= client.c loader.c objects.c pooler.c proto.c sbuf.c server.c util.c \
4 admin.c stats.c takeover.c md5.c janitor.c pktbuf.c system.c main.c \
6 HDRS
= client.h loader.h objects.h pooler.h proto.h sbuf.h server.h util.h \
7 admin.h stats.h takeover.h md5.h janitor.h pktbuf.h system.h bouncer.h \
8 list.h mbuf.h varcache.h
10 # data & dirs to include in tgz
11 DOCS
= doc
/overview.txt doc
/usage.txt doc
/config.txt doc
/todo.txt
12 MANPAGES
= doc
/pgbouncer
.1 doc
/pgbouncer
.5
13 DATA
= README NEWS AUTHORS etc
/pgbouncer.ini Makefile config.mak.in config.h.in \
14 configure configure.ac debian
/packages debian
/changelog doc
/Makefile \
15 test/Makefile
test/asynctest.c
test/conntest.sh
test/ctest6000.ini \
16 test/ctest7000.ini
test/run-conntest.sh
test/stress.py
test/test.ini \
17 test/test.sh
test/userlist.txt etc
/example.debian.init.sh doc
/fixman.py
18 DIRS
= doc etc src debian
test
20 # keep autoconf stuff separate
23 ifeq ($(enable_debug
),yes
)
24 CFLAGS
+= -DDBGVER
="\"compiled by <$${USER}@`hostname`> at `date '+%Y-%m-%d %H:%M:%S'`\""
27 # calculate full-path values
29 hdrs
= $(addprefix $(srcdir)/src
/, $(HDRS
))
30 srcs
= $(addprefix $(srcdir)/src
/, $(SRCS
))
31 objs
= $(addprefix $(builddir
)/lib
/, $(OBJS
))
32 FULL
= $(PACKAGE_TARNAME
)-$(PACKAGE_VERSION
)
33 DISTFILES
= $(DIRS
) $(DATA
) $(DOCS
) $(srcs
) $(hdrs
) $(MANPAGES
)
35 # Quiet by default, 'make V=1' shows commands
45 ## actual targets now ##
48 all: pgbouncer doc-all
51 pgbouncer
: config.mak
$(objs
)
53 $(Q
) $(CC
) -o
$@
$(LDFLAGS
) $(objs
) $(LIBS
)
55 # objects depend on all the headers
56 $(builddir
)/lib
/%.o
: $(srcdir)/src
/%.c config.mak
$(hdrs
)
57 @mkdir
-p
$(builddir
)/lib
59 $(Q
) $(CC
) -c
-o
$@
$< $(DEFS
) $(CFLAGS
) $(CPPFLAGS
)
61 # install binary and other stuff
62 install: pgbouncer doc-install
63 mkdir
-p
$(DESTDIR
)$(bindir)
64 mkdir
-p
$(DESTDIR
)$(docdir
)
65 $(BININSTALL
) -m
755 pgbouncer
$(DESTDIR
)$(bindir)
66 $(INSTALL
) -m
644 $(srcdir)/etc
/pgbouncer.ini
$(DESTDIR
)$(docdir
)
69 tgz
: config.mak
$(DISTFILES
) $(MANPAGES
)
70 rm -rf
$(FULL
) $(FULL
).tgz
72 (for f in
$(DISTFILES
); do echo
$$f; done
) | cpio
-p
$(FULL
)
73 tar czf
$(FULL
).tgz
$(FULL
)
77 make
-C doc pgbouncer
.1
80 make
-C doc pgbouncer
.5
82 # create debian package
89 rm -f
*~ src
/*~
*.o src
/*.o lib
/*.o lib
/*.s pgbouncer core core.
*
92 # clean configure results
93 distclean: clean doc-distclean
94 rm -f config.h config.log config.status config.mak
97 # clean autoconf results
98 realclean: distclean doc-realclean
99 rm -f aclocal
* config.h.in configure depcomp install-sh missing
102 # generate configure script and config.h.in
105 rm -rf autom4te
* config.h.in~
107 # targets can depend on this to force ./configure
109 @
test -f configure ||
{ \
110 echo
"Please run 'make boot && ./configure' first.";exit
1;}
111 @
test -f
$@ ||
{ echo
"Please run ./configure first.";exit
1;}
113 doc-all doc-install doc-clean doc-distclean doc-realclean
:
114 $(MAKE
) -C doc
$(subst doc-
,,$@
) DESTDIR
=$(DESTDIR
)
117 # targets can depend on this to force 'make boot'
119 @
test -f
$@ ||
{ echo
"Please run 'make boot' first.";exit
1;}
122 tags: $(srcs
) $(hdrs
)
123 if
test -f ..
/libevent
/event.h
; then \
124 ctags
$(srcs
) $(hdrs
) ..
/libevent
/*.
[ch
]; \
126 ctags
$(srcs
) $(hdrs
); \
130 SPARSE_MACOS
=-D__STDC_VERSION__
=199901 -D__LP64__
=0 -DSENDFILE
=1 \
131 -I
/usr
/lib
/gcc
/i486-linux-gnu
/4.1.2/include
132 # sparse does not have any identity
133 SPARCE_FLAGS
=-D__LITTLE_ENDIAN__
-D__i386__
-D__GNUC__
=3 -D__GNUC_MINOR__
=0 \
134 -Wno-transparent-union \
135 -Wall
$(SPARSE_MACOS
) $(CPPFLAGS
) $(DEFS
)
137 # run sparse over code
139 $(E
) " CHECK" $(srcs
)
140 $(Q
) sparse
$(SPARCE_FLAGS
) $(srcs
)
143 $(CC
) -pg
$(DEFS
) -g
-O2
$(CPPFLAGS
) $(LDFLAGS
) -o
$@
$(srcs
) $(LIBS
)
147 $(builddir
)/lib
/%.s
: $(srcdir)/src
/%.c config.mak
$(hdrs
)
148 @mkdir
-p
$(builddir
)/lib
150 $(Q
) $(CC
) -S
-o
$@
$< $(DEFS
) $(CFLAGS
) $(CPPFLAGS
)