1 |
ben |
1 |
DIET= |
2 |
|
|
# |
3 |
|
|
# libspoopc can be built with/without some features: |
4 |
|
|
# |
5 |
|
|
# the full libspopc: thread-safe, SSL (openssl) |
6 |
|
|
#VERSION=0.11r |
7 |
|
|
#OBJECTS=session.o queries.o parsing.o format.o objects.o libspopc.o mutex.o |
8 |
|
|
#CFLAGS= -Wall -Wextra -pedantic -pipe -fPIC -Os -DUSE_SSL -D_REENTRANT |
9 |
|
|
#LDFLAGS=-lssl -lcrypto -lrt |
10 |
|
|
# |
11 |
|
|
# the backward-compat non-reentrant libspopc with SSL (openssl) |
12 |
|
|
VERSION=0.11n |
13 |
|
|
OBJECTS=session.o queries.o parsing.o format.o objects.o libspopc.o |
14 |
|
|
CFLAGS= -Wall -Wextra -pedantic -pipe -fPIC -g -DUSE_SSL |
15 |
|
|
LDFLAGS=-lssl -lcrypto |
16 |
|
|
# |
17 |
|
|
# the backward-compat non-reentrant non-SSL libspopc |
18 |
|
|
#VERSION=0.11nossl |
19 |
|
|
#OBJECTS=session.o queries.o parsing.o format.o objects.o libspopc.o |
20 |
|
|
#CFLAGS= -Wall -Wextra -pedantic -pipe -fPIC -Os |
21 |
|
|
#LDFLAGS= |
22 |
|
|
# |
23 |
|
|
# info: strdup, snprintf.. are not in ANSI versions of stdio.h/string.h |
24 |
|
|
# this could be nice to conform to -ansi or to -std=iso9899:199409 |
25 |
|
|
# |
26 |
|
|
all : libspopc.a libspopc.so examples |
27 |
|
|
@echo "" |
28 |
|
|
@echo "read Makefile comments to build different flavours of libspopc" |
29 |
|
|
@echo "please also read the README file" |
30 |
|
|
# |
31 |
|
|
%.o : %.c libspopc.h |
32 |
|
|
$(DIET) $(CC) $(CFLAGS) -c $< |
33 |
|
|
# |
34 |
|
|
libspopc.a : $(OBJECTS) |
35 |
|
|
$(RM) libspopc*.a |
36 |
|
|
ar r libspopc-$(VERSION).a $(OBJECTS) |
37 |
|
|
ranlib libspopc-$(VERSION).a |
38 |
|
|
ln -s libspopc-$(VERSION).a libspopc.a |
39 |
|
|
# |
40 |
|
|
libspopc.so : $(OBJECTS) |
41 |
|
|
$(RM) libspopc*.so |
42 |
|
|
$(DIET) $(CC) -o libspopc-$(VERSION).so -shared $(OBJECTS) |
43 |
|
|
ln -s libspopc-$(VERSION).so libspopc.so |
44 |
|
|
# |
45 |
|
|
%: examples/%.c |
46 |
|
|
$(DIET) $(CC) -o $@ $(CFLAGS) $< -L. -lspopc $(LDFLAGS) |
47 |
|
|
# |
48 |
|
|
examples: libspopc.a poptest1 poptest2 butcher poptest3 |
49 |
|
|
@echo "" |
50 |
|
|
@echo "to use examples, export LD_LIBRARY_PATH=.:"'$$LD_LIBRARY_PATH' |
51 |
|
|
# |
52 |
|
|
uninstall : |
53 |
|
|
$(RM) $(DESTDIR)/usr/lib/libspopc*.a |
54 |
|
|
$(RM) $(DESTDIR)/usr/lib/libspopc*.so |
55 |
|
|
$(RM) $(DESTDIR)/usr/include/libspopc*.h |
56 |
|
|
# |
57 |
|
|
install : |
58 |
|
|
#strip libspopc.so |
59 |
|
|
install libspopc-$(VERSION).a $(DESTDIR)/usr/lib/ |
60 |
|
|
cd $(DESTDIR)/usr/lib/ && ln -f -s libspopc-$(VERSION).a libspopc.a |
61 |
|
|
install libspopc-$(VERSION).so $(DESTDIR)/usr/lib/ |
62 |
|
|
cd $(DESTDIR)/usr/lib/ && ln -f -s libspopc-$(VERSION).so libspopc.so |
63 |
|
|
install libspopc.h $(DESTDIR)/usr/include/ |
64 |
|
|
# |
65 |
|
|
clean : |
66 |
|
|
$(RM) *.o poptest* butcher* |
67 |
|
|
# |
68 |
|
|
distclean : clean |
69 |
|
|
$(RM) libspopc*.a libspopc*.so |
70 |
|
|
$(RM) *~ examples/*~ doc/*~ |
71 |
|
|
|