summaryrefslogtreecommitdiff
path: root/source4/lib/tdb/Makefile.in
blob: e45fa3cf79f47965b199de204bc838515042002d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!gmake
#
# Makefile for tdb directory
#

CC = @CC@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
VPATH = @srcdir@:@libreplacedir@
srcdir = @srcdir@
builddir = @builddir@
CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -Iinclude 
CFLAGS = $(CPPFLAGS) @CFLAGS@
LDFLAGS = @LDFLAGS@
EXEEXT = @EXEEXT@
SHLD = @SHLD@
SHLD_FLAGS = @SHLD_FLAGS@
PACKAGE_VERSION = @PACKAGE_VERSION@
PICFLAG = @PICFLAG@
SHLIBEXT = @SHLIBEXT@
SWIG = swig

.PHONY: test

PROGS = bin/tdbtool$(EXEEXT) bin/tdbdump$(EXEEXT) bin/tdbbackup$(EXEEXT)
PROGS_NOINSTALL = bin/tdbtest$(EXEEXT) bin/tdbtorture$(EXEEXT)
ALL_PROGS = $(PROGS) $(PROGS_NOINSTALL)

TDB_OBJ = @TDB_OBJ@ @LIBREPLACEOBJ@

DIRS = bin common tools

SONAME = libtdb.$(SHLIBEXT).1
SOLIB = libtdb.$(SHLIBEXT).$(PACKAGE_VERSION)

all: showflags dirs $(PROGS) $(SOLIB) libtdb.a

showflags:
	@echo 'tdb will be compiled with flags:'
	@echo '  CFLAGS = $(CFLAGS)'
	@echo '  CPPFLAGS = $(CPPFLAGS)'
	@echo '  LDFLAGS = $(LDFLAGS)'
	@echo '  LIBS = $(LIBS)'

.SUFFIXES: .c .o

.c.o:
	@echo Compiling $*.c
	@mkdir -p `dirname $@`
	@$(CC) $(PICFLAG) $(CFLAGS) -c $< -o $@

dirs:
	@mkdir -p $(DIRS)

install: all
	mkdir -p $(DESTDIR)$(bindir)
	mkdir -p $(DESTDIR)$(includedir)
	mkdir -p $(DESTDIR)$(libdir) 
	mkdir -p $(DESTDIR)$(libdir)/pkgconfig
	cp $(PROGS) $(DESTDIR)$(bindir)
	cp $(srcdir)/include/tdb.h $(DESTDIR)$(includedir)
	cp tdb.pc $(DESTDIR)$(libdir)/pkgconfig
	cp libtdb.a $(SOLIB) $(DESTDIR)$(libdir)

libtdb.a: $(TDB_OBJ)
	ar -rv libtdb.a $(TDB_OBJ)

libtdb.$(SHLIBEXT): $(SOLIB)
	ln -fs $< $@

$(SONAME): $(SOLIB)
	ln -fs $< $@

$(SOLIB): $(TDB_OBJ)
	$(SHLD) $(SHLD_FLAGS) -o $@ $(TDB_OBJ) @SONAMEFLAG@$(SONAME)

TDB_LIB = libtdb.a

bin/tdbtest$(EXEEXT): tools/tdbtest.o $(TDB_LIB)
	$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtest tools/tdbtest.o -L. -ltdb -lgdbm

bin/tdbtool$(EXEEXT): tools/tdbtool.o $(TDB_LIB)
	$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtool tools/tdbtool.o -L. -ltdb

bin/tdbtorture$(EXEEXT): tools/tdbtorture.o $(TDB_LIB)
	$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtorture tools/tdbtorture.o -L. -ltdb

bin/tdbdump$(EXEEXT): tools/tdbdump.o $(TDB_LIB)
	$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbdump tools/tdbdump.o -L. -ltdb

bin/tdbbackup$(EXEEXT): tools/tdbbackup.o $(TDB_LIB)
	$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbbackup tools/tdbbackup.o -L. -ltdb

test: bin/tdbtorture$(EXEEXT)
	bin/tdbtorture$(EXEEXT)

installcheck: test install

clean:
	rm -f $(ALL_PROGS) *.o *.a common/*.o tools/*.o tdb.pc
	rm -f test.db test.tdb torture.tdb test.gdbm
	rm -f $(SONAME) $(SOLIB) libtdb.a libtdb.$(SHLIBEXT)

distclean: clean
	rm -f *~ */*~
	rm -f config.log config.status include/config.h config.cache
	rm -f Makefile

realdistclean: distclean
	rm -f configure include/config.h.in

tdb_wrap.c tdb.py: tdb.i
	$(SWIG) -python -keyword tdb.i

build-python: libtdb.$(SHLIBEXT) tdb_wrap.c tdb.py
	./setup.py build

install-python:
	./setup.py install --prefix=$(prefix)

check-python: build-python
	# FIXME: Should be more portable:
	LD_LIBRARY_PATH=. PYTHONPATH=.:build/lib.linux-i686-2.4 trial python/tests/simple.py

install-swig:
	mkdir -p $(DESTDIR)`$(SWIG) -swiglib`
	cp tdb.i $(DESTDIR)`$(SWIG) -swiglib`

clean-python:
	./setup.py clean