1 |
# |
2 |
# Makefile for the smsd. |
3 |
# |
4 |
# Copyright (C) 1999 Hugh Blemings & Pavel Janík ml. |
5 |
# 1999-2005 Jan Derfinak |
6 |
# 2000 Karel Zak |
7 |
# $Id: Makefile,v 1.39 2007/07/09 16:46:15 pkot Exp $ |
8 |
# |
9 |
|
10 |
#GLIBCFLAGS = glib-config --cflags |
11 |
#GLIBLDLIBS = glib-config --libs |
12 |
|
13 |
# Comment out above lines and uncomment below lines if you want compile smsd |
14 |
# with glib2 instead of glib1. |
15 |
# |
16 |
GLIBCFLAGS = pkg-config --cflags glib-2.0 |
17 |
GLIBLDLIBS = pkg-config --libs glib-2.0 |
18 |
|
19 |
TOPDIR=.. |
20 |
include $(TOPDIR)/Makefile.global |
21 |
|
22 |
pkglibdir = ${libdir}/smsd |
23 |
|
24 |
SMSD_MAN=man/smsd.8 |
25 |
|
26 |
CFLAGS += -DMODULES_DIR=\"${pkglibdir}\" $(PTHREAD_CFLAGS) \ |
27 |
$(shell $(GLIBCFLAGS)) |
28 |
|
29 |
LDLIBS += $(PTHREAD_LIBS) \ |
30 |
$(shell $(GLIBLDLIBS)) |
31 |
|
32 |
LDLIBS += -rdynamic $(TOPDIR)/common/libgnokii.la -ldl |
33 |
# Some systems, eg. FreeBSD don't have libdl. Use this: |
34 |
# LDLIBS += -s -rdynamic -L$(TOPDIR)/common -lgnokii -pthread -L../getopt -lgetopt |
35 |
|
36 |
OBJS = smsd.lo \ |
37 |
lowlevel.lo |
38 |
DB_OBJS = pq.lo mysql.lo file.lo |
39 |
|
40 |
# A list of database modules to build. |
41 |
# FIXME: detect which ones to build in configure |
42 |
DB_LIBS = libfile.la libpq.la libmysql.la |
43 |
#DB_LIBS := libfile.la |
44 |
|
45 |
all: smsd |
46 |
|
47 |
|
48 |
smsd: $(OBJS) $(TOPDIR)/common/libgnokii.la $(DB_LIBS) |
49 |
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@ |
50 |
|
51 |
|
52 |
### DB Modules |
53 |
utils.lo: utils.h utils.c |
54 |
$(LIBTOOL) --mode=compile $(CC) -o utils.lo $(CFLAGS) $(CPPFLAGS) \ |
55 |
-I../include -c utils.c |
56 |
|
57 |
|
58 |
# PostgreSQL support |
59 |
pq.lo: smsd.h utils.h pq.c |
60 |
$(LIBTOOL) --mode=compile $(CC) -o pq.lo $(CFLAGS) $(CPPFLAGS) \ |
61 |
-I../include -I$(shell pg_config --includedir) -c pq.c |
62 |
|
63 |
libpq.la: pq.lo utils.lo |
64 |
$(LIBTOOL) --mode=link $(CC) -o libpq.la pq.lo utils.lo \ |
65 |
$(shell $(GLIBLDLIBS)) -L$(shell pg_config --libdir) -lpq \ |
66 |
-export-dynamic -avoid-version -rpath ${pkglibdir} |
67 |
|
68 |
# MySQL support |
69 |
mysql.lo: smsd.h utils.h mysql.c |
70 |
$(LIBTOOL) --mode=compile $(CC) -o mysql.lo $(CFLAGS) $(CPPFLAGS) \ |
71 |
-I../include $(shell mysql_config --cflags) -c mysql.c |
72 |
|
73 |
libmysql.la: mysql.lo utils.lo |
74 |
$(LIBTOOL) --mode=link $(CC) -o libmysql.la mysql.lo utils.lo \ |
75 |
$(shell $(GLIBLDLIBS)) $(shell mysql_config --libs) \ |
76 |
-export-dynamic -avoid-version -rpath ${pkglibdir} |
77 |
|
78 |
# File support |
79 |
file.lo: smsd.h utils.h file.c |
80 |
$(LIBTOOL) --mode=compile $(CC) -o file.lo $(CFLAGS) $(CPPFLAGS) \ |
81 |
-I../include -c file.c |
82 |
|
83 |
libfile.la: file.lo utils.lo |
84 |
$(LIBTOOL) --mode=link $(CC) -o libfile.la file.lo utils.lo \ |
85 |
$(shell $(GLIBLDLIBS)) \ |
86 |
-export-dynamic -avoid-version -rpath ${pkglibdir} |
87 |
|
88 |
libfile.so: file.c |
89 |
$(LIBTOOL) --mode=link $(CC) -shared -o libfile.so $(CFLAGS) file.c -rdynamic \ |
90 |
$(shell $(GLIBLDLIBS)) |
91 |
|
92 |
### End of DB Modules |
93 |
|
94 |
$(TOPDIR)/common/libgnokii.la: |
95 |
$(MAKE) -C $(TOPDIR)/common libgnokii.la |
96 |
|
97 |
clean: |
98 |
$(LIBTOOL) --mode=clean $(RM) smsd $(DB_LIBS) $(OBJS) $(DB_OBJS) |
99 |
$(RM) -r *~ depend core* .libs |
100 |
|
101 |
install: all |
102 |
$(INSTALL) -d $(DESTDIR)$(sbindir) |
103 |
$(LIBTOOL) --mode=install $(INSTALL) -m 755 smsd $(DESTDIR)$(sbindir) |
104 |
$(INSTALL) -d $(DESTDIR)${pkglibdir} |
105 |
for f in $(DB_LIBS) ; do \ |
106 |
$(LIBTOOL) --mode=install $(INSTALL) $$f $(DESTDIR)${pkglibdir} ; \ |
107 |
done |
108 |
$(LIBTOOL) --mode=finish ${pkglibdir} |
109 |
$(INSTALL) -d $(DESTDIR)$(man8dir) |
110 |
$(INSTALL_DATA) $(SMSD_MAN) $(DESTDIR)$(man8dir) |
111 |
|
112 |
depend dep: |
113 |
$(CC) $(CFLAGS) -MM *.c >depend |
114 |
|
115 |
ifeq (depend,$(wildcard depend)) |
116 |
include depend |
117 |
endif |
118 |
|
119 |
|
120 |
.PHONY: all install clean dep depend |