Move platform-specific code to common/system_*
[Samba.git] / ctdb / Makefile.in
blob3b9648dfe5055b23de3af94edd68b5645ec35e80
1 #!gmake
4 CC = @CC@
5 AR = ar
6 ARFLAGS = cru
7 RANLIB = ranlib
8 prefix = @prefix@
9 exec_prefix = @exec_prefix@
10 datarootdir = @datarootdir@
11 includedir = @includedir@
12 docdir = @docdir@
13 libdir = @libdir@
14 bindir = @bindir@
15 sbindir = @sbindir@
16 mandir = @mandir@
17 localstatedir = @localstatedir@
18 logdir = @LOGDIR@
19 VPATH = @srcdir@:@tdbdir@:@tallocdir@:@libreplacedir@:@poptdir@:@teventdir@:
20 srcdir = @srcdir@
21 etcdir = @sysconfdir@
22 builddir = @builddir@
23 DESTDIR = /
24 EXTRA_OBJ=@EXTRA_OBJ@
25 XSLTPROC = /usr/bin/xsltproc
26 INSTALLCMD = @INSTALL@
28 POPT_LIBS = @POPT_LIBS@
29 POPT_CFLAGS = @POPT_CFLAGS@
30 POPT_OBJ = @POPT_OBJ@
32 SOCKET_WRAPPER_OBJ = @SOCKET_WRAPPER_OBJS@
34 PMDA_LIBS = -lpcp -lpcp_pmda
35 PMDA_INSTALL = @CTDB_PMDA_INSTALL@
36 PMDA_DEST_DIR = /var/lib/pcp/pmdas
38 CFLAGS=-g -I$(srcdir)/include -Iinclude -Ilib -Ilib/util -I$(srcdir) \
39 -I@tallocdir@ -I@tdbdir@/include -I@libreplacedir@ \
40 -DVARDIR=\"$(localstatedir)\" -DETCDIR=\"$(etcdir)\" \
41 -DLOGDIR=\"$(logdir)\" \
42 -DUSE_MMAP=1 -DTEVENT_DEPRECATED_QUIET=1 @CFLAGS@ -Wno-format-zero-length $(POPT_CFLAGS) \
43 -fPIC
45 LDSHFLAGS=-fPIC -shared
46 #LDSHFLAGS=-fPIC -shared -Wl,-Bsymbolic -Wl,-z,relo -Wl,-Bsymbolic-funtions -Wl,--as-needed -Wl,-z,defs
47 SHLD=${CC} ${CFLAGS} ${LDSHFLAGS} -o $@
49 LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ $(POPT_LIBS) @INFINIBAND_LIBS@ @CTDB_PCAP_LDFLAGS@
51 UTIL_OBJ = lib/util/idtree.o lib/util/db_wrap.o lib/util/strlist.o lib/util/util.o \
52 lib/util/util_time.o lib/util/util_file.o lib/util/fault.o lib/util/substitute.o \
53 lib/util/signal.o
55 CTDB_COMMON_OBJ = common/ctdb_io.o common/ctdb_util.o \
56 common/ctdb_ltdb.o common/ctdb_message.o common/cmdline.o \
57 lib/util/debug.o common/rb_tree.o @CTDB_SYSTEM_OBJ@ common/system_common.o \
58 common/ctdb_logging.c
60 CTDB_LIB_OBJ = libctdb/ctdb.o libctdb/io_elem.o libctdb/local_tdb.o \
61 libctdb/messages.o libctdb/sync.o libctdb/control.o \
62 libctdb/logging.o $(SOCKET_WRAPPER_OBJ)
64 CTDB_TCP_OBJ = tcp/tcp_connect.o tcp/tcp_io.o tcp/tcp_init.o
66 CTDB_CLIENT_OBJ = client/ctdb_client.o \
67 $(CTDB_COMMON_OBJ) $(POPT_OBJ) $(UTIL_OBJ) @TALLOC_OBJ@ @TDB_OBJ@ \
68 @LIBREPLACEOBJ@ $(EXTRA_OBJ) @TEVENT_OBJ@ $(SOCKET_WRAPPER_OBJ)
70 CTDB_SERVER_OBJ = server/ctdbd.o server/ctdb_daemon.o server/ctdb_lockwait.o \
71 server/ctdb_recoverd.o server/ctdb_recover.o server/ctdb_freeze.o \
72 server/ctdb_tunables.o server/ctdb_monitor.o server/ctdb_server.o \
73 server/ctdb_control.o server/ctdb_call.o server/ctdb_ltdb_server.o \
74 server/ctdb_traverse.o server/eventscript.o server/ctdb_takeover.o \
75 server/ctdb_serverids.o server/ctdb_persistent.o \
76 server/ctdb_keepalive.o server/ctdb_logging.o server/ctdb_uptime.o \
77 server/ctdb_vacuum.o server/ctdb_banning.o server/ctdb_statistics.o \
78 $(CTDB_CLIENT_OBJ) $(CTDB_TCP_OBJ) @INFINIBAND_WRAPPER_OBJ@
80 TEST_BINS=tests/bin/ctdb_bench tests/bin/ctdb_fetch tests/bin/ctdb_fetch_one \
81 tests/bin/ctdb_fetch_lock_once \
82 tests/bin/ctdb_fetch_readonly_once tests/bin/ctdb_fetch_readonly_loop \
83 tests/bin/ctdb_store tests/bin/ctdb_trackingdb_test \
84 tests/bin/ctdb_randrec tests/bin/ctdb_persistent \
85 tests/bin/ctdb_traverse tests/bin/rb_test tests/bin/ctdb_transaction \
86 tests/bin/ctdb_takeover_tests tests/bin/ctdb_update_record \
87 @INFINIBAND_BINS@
89 BINS = bin/ctdb @CTDB_SCSI_IO@ bin/smnotify bin/ping_pong bin/ltdbtool @CTDB_PMDA@
91 SBINS = bin/ctdbd
93 DIRS = lib bin tests/bin
95 .SUFFIXES: .c .o .h .1 .1.xml .1.html
97 all: showflags dirs doc $(CTDB_SERVER_OBJ) $(CTDB_CLIENT_OBJ) $(CTDB_LIB_OBJ) $(BINS) $(SBINS) $(TEST_BINS)
99 showflags:
100 @echo 'ctdb will be compiled with flags:'
101 @echo ' CFLAGS = $(CFLAGS)'
102 @echo ' LIBS = $(LIBS)'
104 showlayout::
105 @echo "ctdb will be installed into:"
106 @echo " prefix: $(prefix)"
107 @echo " bindir: $(bindir)"
108 @echo " sbindir: $(sbindir)"
109 @echo " libdir: $(libdir)"
110 @echo " vardir: $(localstatedir)"
111 @echo " logdir: $(logdir)"
112 @echo " mandir: $(mandir)"
113 @echo " etcdir: $(etcdir)"
115 .c.o:
116 @echo Compiling $*.c
117 @mkdir -p `dirname $@`
118 @$(CC) $(CFLAGS) -c $< -o $@
120 dirs:
121 @mkdir -p $(DIRS)
123 bin/ctdbd: $(CTDB_SERVER_OBJ)
124 @echo Linking $@
125 @$(CC) $(CFLAGS) -o $@ $(CTDB_SERVER_OBJ) $(LIB_FLAGS)
127 libctdb/libctdb.a: $(CTDB_LIB_OBJ)
128 @echo Linking $@
129 -rm -f libctdb.a
130 @$(AR) $(ARFLAGS) libctdb/libctdb.a $(CTDB_LIB_OBJ)
131 @$(RANLIB) libctdb/libctdb.a
133 libctdb/libctdb.so.0: $(CTDB_LIB_OBJ)
134 @echo Linking $@
135 @$(SHLD) -Wl,-soname=libctdb.so.0 $(CTDB_LIB_OBJ)
137 libctdb/libctdb.so: libctdb/libctdb.so.0
138 @echo Creating $@
139 -@rm -f libctdb/libctdb.so
140 @ln -s libctdb.so.0 libctdb/libctdb.so
142 bin/scsi_io: $(CTDB_CLIENT_OBJ) utils/scsi_io/scsi_io.o
143 @echo Linking $@
144 @$(CC) $(CFLAGS) -o $@ utils/scsi_io/scsi_io.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
146 bin/ctdb: $(CTDB_CLIENT_OBJ) tools/ctdb.o tools/ctdb_vacuum.o libctdb/libctdb.a
147 @echo Linking $@
148 @$(CC) $(CFLAGS) -o $@ tools/ctdb.o tools/ctdb_vacuum.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS) libctdb/libctdb.a
150 bin/ltdbtool: tools/ltdbtool.o @TDB_OBJ@
151 @echo Linking $@
152 @$(CC) $(CFLAGS) -o $@ $+
154 bin/smnotify: utils/smnotify/gen_xdr.o utils/smnotify/gen_smnotify.o utils/smnotify/smnotify.o $(POPT_OBJ)
155 @echo Linking $@
156 @$(CC) $(CFLAGS) -o $@ utils/smnotify/smnotify.o utils/smnotify/gen_xdr.o utils/smnotify/gen_smnotify.o $(POPT_OBJ) $(LIB_FLAGS)
158 utils/smnotify/smnotify.o: utils/smnotify/smnotify.c utils/smnotify/smnotify.h
160 utils/smnotify/smnotify.h: utils/smnotify/smnotify.x
161 @echo Generating $@
162 rpcgen -h utils/smnotify/smnotify.x > utils/smnotify/smnotify.h
164 utils/smnotify/gen_xdr.c: utils/smnotify/smnotify.x utils/smnotify/smnotify.h
165 @echo Generating $@
166 rpcgen -c utils/smnotify/smnotify.x | grep -Ev '^[[:space:]]+register int32_t \*buf;' > utils/smnotify/gen_xdr.c
168 utils/smnotify/gen_smnotify.c: utils/smnotify/smnotify.x utils/smnotify/smnotify.h
169 @echo Generating $@
170 rpcgen -l utils/smnotify/smnotify.x > utils/smnotify/gen_smnotify.c
172 bin/ping_pong: utils/ping_pong/ping_pong.o
173 @echo Linking $@
174 @$(CC) $(CFLAGS) -o $@ utils/ping_pong/ping_pong.o
176 bin/pmdactdb: $(CTDB_CLIENT_OBJ) utils/pmda/pmda_ctdb.o
177 @echo Linking $@
178 @$(CC) $(CFLAGS) -o $@ utils/pmda/pmda_ctdb.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS) $(PMDA_LIBS)
180 tests/bin/rb_test: $(CTDB_CLIENT_OBJ) tests/src/rb_test.o
181 @echo Linking $@
182 @$(CC) $(CFLAGS) -o $@ tests/src/rb_test.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
184 tests/bin/ctdb_bench: $(CTDB_CLIENT_OBJ) tests/src/ctdb_bench.o
185 @echo Linking $@
186 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_bench.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
188 tests/bin/ctdb_fetch: $(CTDB_CLIENT_OBJ) tests/src/ctdb_fetch.o
189 @echo Linking $@
190 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
192 tests/bin/ctdb_fetch_one: $(CTDB_CLIENT_OBJ) tests/src/ctdb_fetch_one.o
193 @echo Linking $@
194 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch_one.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
196 tests/bin/ctdb_fetch_lock_once: libctdb/libctdb.a tests/src/ctdb_fetch_lock_once.o
197 @echo Linking $@
198 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch_lock_once.o @TDB_OBJ@ @POPT_OBJ@ libctdb/libctdb.a $(LIB_FLAGS)
200 tests/bin/ctdb_fetch_readonly_once: libctdb/libctdb.a tests/src/ctdb_fetch_readonly_once.o
201 @echo Linking $@
202 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch_readonly_once.o @TDB_OBJ@ @POPT_OBJ@ libctdb/libctdb.a $(LIB_FLAGS)
204 tests/bin/ctdb_fetch_readonly_loop: $(CTDB_CLIENT_OBJ) tests/src/ctdb_fetch_readonly_loop.o
205 @echo Linking $@
206 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch_readonly_loop.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
208 tests/bin/ctdb_trackingdb_test: $(CTDB_CLIENT_OBJ) tests/src/ctdb_trackingdb_test.o
209 @echo Linking $@
210 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_trackingdb_test.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
212 tests/bin/ctdb_update_record: $(CTDB_CLIENT_OBJ) tests/src/ctdb_update_record.o
213 @echo Linking $@
214 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_update_record.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
216 tests/bin/ctdb_store: $(CTDB_CLIENT_OBJ) tests/src/ctdb_store.o
217 @echo Linking $@
218 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_store.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
220 tests/bin/ctdb_traverse: $(CTDB_CLIENT_OBJ) tests/src/ctdb_traverse.o
221 @echo Linking $@
222 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_traverse.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
224 tests/bin/ctdb_randrec: $(CTDB_CLIENT_OBJ) tests/src/ctdb_randrec.o
225 @echo Linking $@
226 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_randrec.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
228 tests/bin/ctdb_persistent: $(CTDB_CLIENT_OBJ) tests/src/ctdb_persistent.o
229 @echo Linking $@
230 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_persistent.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
232 tests/bin/ctdb_transaction: $(CTDB_CLIENT_OBJ) tests/src/ctdb_transaction.o
233 @echo Linking $@
234 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_transaction.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
236 CTDB_SERVER_MOST_OBJ = $(CTDB_SERVER_OBJ:server/ctdbd.o=)
237 CTDB_TEST_C = $(CTDB_SERVER_MOST_OBJ:.o=.c) tests/src/ctdbd_test.c
238 CTDB_TEST_OBJ = @TALLOC_OBJ@ @TDB_OBJ@ \
239 @LIBREPLACEOBJ@ $(EXTRA_OBJ) @TEVENT_OBJ@ $(SOCKET_WRAPPER_OBJ)
241 CTDB_TEST_DEPENDS = $(CTDB_TEST_OBJ) $(CTDB_SERVER_MOST_C) \
242 tests/src/ctdbd_test.c
244 tests/src/ctdb_takeover_tests.o: tests/src/ctdb_takeover_tests.c $(CTDB_TEST_C)
246 tests/bin/ctdb_takeover_tests: $(CTDB_TEST_OBJ) tests/src/ctdb_takeover_tests.o
247 @echo Linking $@
248 @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_takeover_tests.o $(CTDB_TEST_OBJ) $(LIB_FLAGS)
250 tests/bin/ibwrapper_test: $(CTDB_CLIENT_OBJ) ib/ibwrapper_test.o
251 @echo Linking $@
252 @$(CC) $(CFLAGS) -o $@ ib/ibwrapper_test.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
254 .1.xml.1:
255 -test -z "$(XSLTPROC)" || $(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
257 .1.xml.1.html:
258 -test -z "$(XSLTPROC)" || $(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $<
260 doc: doc/ctdb.1 doc/ctdb.1.html \
261 doc/ctdbd.1 doc/ctdbd.1.html \
262 doc/onnode.1 doc/onnode.1.html \
263 doc/ltdbtool.1 doc/ltdbtool.1.html \
264 doc/ping_pong.1 doc/ping_pong.1.html
266 clean:
267 rm -f *.o */*.o */*.a */*/*.o */*~
268 rm -f utils/smnotify/gen_xdr.c
269 rm -f $(BINS) $(SBINS) $(TEST_BINS)
271 distclean: clean
272 rm -f *~ */*~
273 rm -rf bin
274 rm -f config.log config.status config.cache config.h
275 rm -f Makefile
277 install: all $(PMDA_INSTALL)
278 mkdir -p $(DESTDIR)$(libdir)/pkgconfig
279 mkdir -p $(DESTDIR)$(bindir)
280 mkdir -p $(DESTDIR)$(sbindir)
281 mkdir -p $(DESTDIR)$(includedir)
282 mkdir -p $(DESTDIR)$(etcdir)/ctdb
283 mkdir -p $(DESTDIR)$(etcdir)/ctdb/events.d
284 mkdir -p $(DESTDIR)$(docdir)/ctdb
285 ${INSTALLCMD} -m 644 ctdb.pc $(DESTDIR)$(libdir)/pkgconfig
286 ${INSTALLCMD} -m 755 bin/ctdb $(DESTDIR)$(bindir)
287 ${INSTALLCMD} -m 755 bin/ctdbd $(DESTDIR)$(sbindir)
288 ${INSTALLCMD} -m 755 bin/smnotify $(DESTDIR)$(bindir)
289 $(INSTALLCMD) -m 755 bin/ping_pong $(DESTDIR)$(bindir)
290 $(INSTALLCMD) -m 755 bin/ltdbtool $(DESTDIR)$(bindir)
291 $(INSTALLCMD) -m 755 libctdb/libctdb.a $(DESTDIR)$(libdir)
292 ${INSTALLCMD} -m 644 include/ctdb.h $(DESTDIR)$(includedir)
293 ${INSTALLCMD} -m 644 include/ctdb_client.h $(DESTDIR)$(includedir)
294 ${INSTALLCMD} -m 644 include/ctdb_protocol.h $(DESTDIR)$(includedir)
295 ${INSTALLCMD} -m 644 include/ctdb_private.h $(DESTDIR)$(includedir) # for samba3
296 ${INSTALLCMD} -m 644 include/ctdb_typesafe_cb.h $(DESTDIR)$(includedir)
297 ${INSTALLCMD} -m 644 config/functions $(DESTDIR)$(etcdir)/ctdb
298 ${INSTALLCMD} -m 755 config/statd-callout $(DESTDIR)$(etcdir)/ctdb
299 ${INSTALLCMD} -m 755 config/interface_modify.sh $(DESTDIR)$(etcdir)/ctdb
300 ${INSTALLCMD} -m 644 config/events.d/README $(DESTDIR)$(docdir)/ctdb/README.eventscripts
301 ${INSTALLCMD} -m 644 doc/recovery-process.txt $(DESTDIR)$(docdir)/ctdb/recovery-process.txt
302 ${INSTALLCMD} -m 755 config/events.d/00.ctdb $(DESTDIR)$(etcdir)/ctdb/events.d
303 ${INSTALLCMD} -m 755 config/events.d/01.reclock $(DESTDIR)$(etcdir)/ctdb/events.d
304 ${INSTALLCMD} -m 755 config/events.d/10.interface $(DESTDIR)$(etcdir)/ctdb/events.d
305 ${INSTALLCMD} -m 755 config/events.d/11.natgw $(DESTDIR)$(etcdir)/ctdb/events.d
306 ${INSTALLCMD} -m 755 config/events.d/11.routing $(DESTDIR)$(etcdir)/ctdb/events.d
307 ${INSTALLCMD} -m 755 config/events.d/13.per_ip_routing $(DESTDIR)$(etcdir)/ctdb/events.d
308 ${INSTALLCMD} -m 644 config/events.d/20.multipathd $(DESTDIR)$(etcdir)/ctdb/events.d
309 ${INSTALLCMD} -m 644 config/events.d/31.clamd $(DESTDIR)$(etcdir)/ctdb/events.d
310 ${INSTALLCMD} -m 755 config/events.d/40.vsftpd $(DESTDIR)$(etcdir)/ctdb/events.d
311 ${INSTALLCMD} -m 644 config/events.d/40.fs_use $(DESTDIR)$(etcdir)/ctdb/events.d
312 ${INSTALLCMD} -m 755 config/events.d/41.httpd $(DESTDIR)$(etcdir)/ctdb/events.d
313 ${INSTALLCMD} -m 755 config/events.d/50.samba $(DESTDIR)$(etcdir)/ctdb/events.d
314 ${INSTALLCMD} -m 755 config/events.d/60.nfs $(DESTDIR)$(etcdir)/ctdb/events.d
315 ${INSTALLCMD} -m 644 config/events.d/60.ganesha $(DESTDIR)$(etcdir)/ctdb/events.d
316 ${INSTALLCMD} -m 755 config/events.d/62.cnfs $(DESTDIR)$(etcdir)/ctdb/events.d
317 ${INSTALLCMD} -m 755 config/events.d/70.iscsi $(DESTDIR)$(etcdir)/ctdb/events.d
318 ${INSTALLCMD} -m 755 config/events.d/91.lvs $(DESTDIR)$(etcdir)/ctdb/events.d
319 ${INSTALLCMD} -m 755 tools/ctdb_diagnostics $(DESTDIR)$(bindir)
320 ${INSTALLCMD} -m 755 tools/onnode $(DESTDIR)$(bindir)
321 if [ -f doc/ctdb.1 ];then ${INSTALLCMD} -d $(DESTDIR)$(mandir)/man1; fi
322 if [ -f doc/ctdb.1 ];then ${INSTALLCMD} -m 644 doc/ctdb.1 $(DESTDIR)$(mandir)/man1; fi
323 if [ -f doc/ctdbd.1 ];then ${INSTALLCMD} -m 644 doc/ctdbd.1 $(DESTDIR)$(mandir)/man1; fi
324 if [ -f doc/onnode.1 ];then ${INSTALLCMD} -m 644 doc/onnode.1 $(DESTDIR)$(mandir)/man1; fi
325 if [ -f doc/ltdbtool.1 ]; then ${INSTALLCMD} -m 644 doc/ltdbtool.1 $(DESTDIR)$(mandir)/man1; fi
326 if [ -f doc/ping_pong.1 ];then ${INSTALLCMD} -m 644 doc/ping_pong.1 $(DESTDIR)$(mandir)/man1; fi
327 if [ ! -f $(DESTDIR)$(etcdir)/ctdb/notify.sh ];then ${INSTALLCMD} -m 755 config/notify.sh $(DESTDIR)$(etcdir)/ctdb; fi
328 if [ ! -f $(DESTDIR)$(etcdir)/ctdb/ctdb-crash-cleanup.sh ];then ${INSTALLCMD} -m 755 config/ctdb-crash-cleanup.sh $(DESTDIR)$(etcdir)/ctdb; fi
330 install_pmda:
331 $(INSTALLCMD) -m 755 -d $(PMDA_DEST_DIR)
332 $(INSTALLCMD) -m 755 pmda/Install pmda/Remove $(PMDA_DEST_DIR)
333 $(INSTALLCMD) -m 644 pmda/pmns pmda/domain.h pmda/help pmda/README $(PMDA_DEST_DIR)
334 $(INSTALLCMD) -m 755 bin/pmdactdb $(PMDA_DEST_DIR)
336 test: all
337 tests/run_tests.sh
339 valgrindtest: all
340 VALGRIND="valgrind -q --trace-children=yes" tests/run_tests.sh
343 realdistclean: distclean
344 rm -f configure config.h.in ctdb.pc