]> code.citadel.org Git - citadel.git/blob - citadel/Makefile
Makefile: move -ldb from hardcoded to a new BACKEND_LDFLAGS
[citadel.git] / citadel / Makefile
1 # Makefile for Citadel Server
2 # Copyright (c) 1987-2023 by Art Cancro and the citadel.org team
3 #
4 # No, we are NOT using the obsolete GNU Autotools.  This configure script works
5 # well on the Linux operating system (which uses the Linux kernel) and on BSD.
6 #
7 # This program is open source software.  Use, duplication, and/or
8 # disclosure are subject to the GNU General Public License version 3.
9
10 # config.mk is generated by ./configure
11 include config.mk
12
13 all := ctdldump ctdlload citserver setup sendcommand citmail chkpw chkpwd
14 all: $(all)
15
16 SERVER_SOURCES := $(wildcard server/*.c server/modules/*/*.c)
17 SERVER_OBJECTS := $(patsubst %.c,%.o,$(SERVER_SOURCES))
18 BACKEND_SOURCES := $(wildcard server/backends/*/*.c)
19 BACKEND_OBJECTS := $(patsubst %.c,%.o,$(BACKEND_SOURCES))
20
21 BACKEND_LDFLAGS = -ldb
22
23 citserver: $(SERVER_OBJECTS) $(BACKEND_OBJECTS)
24         cc ${CFLAGS} \
25                 $(SERVER_OBJECTS) $(BACKEND_OBJECTS) \
26                 ${LDFLAGS} \
27                 -lresolv -lcitadel -lpthread -lz -lical -lldap -lcrypt -lexpat -lcurl ${BACKEND_LDFLAGS} \
28                 -o citserver
29
30 $(SERVER_SOURCES): server/*.h server/modules/*/*.h server/backends/*/*.h
31         @touch $@
32
33 $(BACKEND_SOURCES): server/*.h server/modules/*/*.h server/backends/*/*.h
34         @touch $@
35
36 %.o: %.c
37         @echo $<
38         @cc ${CFLAGS} -c $< -o $@
39
40 setup: utils/setup.c server/citadel_dirs.c utils/*.h server/*.h
41         cc ${CFLAGS} ${LDFLAGS} utils/setup.c -lcitadel -o setup
42
43 ctdlmigrate: utils/ctdlmigrate.c server/citadel_dirs.c utils/*.h server/*.h
44         cc ${CFLAGS} ${LDFLAGS} utils/ctdlmigrate.c -lcitadel -lreadline -o ctdlmigrate
45
46 sendcommand: utils/sendcommand.c server/citadel_dirs.c utils/*.h server/*.h
47         cc ${CFLAGS} ${LDFLAGS} utils/sendcommand.c -lcitadel -o sendcommand
48
49 citmail: utils/citmail.c server/citadel_dirs.c utils/*.h server/*.h
50         cc ${CFLAGS} ${LDFLAGS} utils/citmail.c -lcitadel -o citmail
51
52 chkpw: utils/chkpw.c utils/*.h server/*.h
53         cc ${CFLAGS} ${LDFLAGS} utils/chkpw.c -o chkpw
54
55 chkpwd: utils/chkpwd.c utils/auth.c utils/*.h server/*.h
56         cc ${CFLAGS} ${LDFLAGS} utils/chkpwd.c utils/auth.c -lcrypt -o chkpwd
57
58 ctdldump: utils/ctdldump.c utils/*.h server/*.h
59         cc ${CFLAGS} ${LDFLAGS} utils/ctdldump.c -lcitadel -lz ${BACKEND_LDFLAGS} -lpthread -o ctdldump
60
61 ctdlload: utils/ctdlload.c server/makeuserkey.c utils/*.h server/*.h
62         cc ${CFLAGS} ${LDFLAGS} utils/ctdlload.c server/makeuserkey.c -lcitadel -lz ${BACKEND_LDFLAGS} -lpthread -o ctdlload
63
64 config.mk: configure
65         ./configure
66
67 clean:
68         rm -vf $(all)
69         find . -name *.o | xargs rm -vf
70
71 distclean: clean
72         rm -vf config.mk
73
74 install: $(all) utils/*.sh
75         @echo Installing to ${CTDLDIR}
76         @for x in $(all) utils/*.sh ; do \
77                 install -v -C -D -t ${CTDLDIR} $$x ;\
78         done