`ctdl3264` is back and it's DRY
[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 Purpose License version 3.
9
10
11 # config.mk is generated by ./configure
12 include config.mk
13
14 all := citserver setup ctdlmigrate sendcommand citmail chkpw chkpwd ctdl3264
15 all: $(all)
16
17 citserver: server/*.c server/modules/*/*.c config.mk server/*.h
18         cc ${CFLAGS} \
19                 server/*.c server/modules/*/*.c \
20                 ${LDFLAGS} -lresolv -lcitadel -lpthread -lz -lical -lldap -lcrypt -lexpat -lcurl -ldb \
21                 -o citserver
22
23 setup: utils/setup.c server/citadel_dirs.c utils/*.h server/*.h
24         cc ${CFLAGS} ${LDFLAGS} utils/setup.c -lcitadel -o setup
25
26 ctdlmigrate: utils/ctdlmigrate.c server/citadel_dirs.c utils/*.h server/*.h
27         cc ${CFLAGS} ${LDFLAGS} utils/ctdlmigrate.c -lcitadel -lreadline -o ctdlmigrate
28
29 sendcommand: utils/sendcommand.c server/citadel_dirs.c utils/*.h server/*.h
30         cc ${CFLAGS} ${LDFLAGS} utils/sendcommand.c -lcitadel -o sendcommand
31
32 citmail: utils/citmail.c server/citadel_dirs.c utils/*.h server/*.h
33         cc ${CFLAGS} ${LDFLAGS} utils/citmail.c -lcitadel -o citmail
34
35 chkpw: utils/chkpw.c utils/*.h server/*.h
36         cc ${CFLAGS} ${LDFLAGS} utils/chkpw.c -o chkpw
37
38 chkpwd: utils/chkpwd.c utils/auth.c utils/*.h server/*.h
39         cc ${CFLAGS} ${LDFLAGS} utils/chkpwd.c utils/auth.c -lcrypt -o chkpwd
40
41 # The `ctdl3264` utility is being kept on hold for now, as it may be resurrected someday.
42 # Add `ctdl3264` to the `all` target if we do that.
43 ctdl3264: utils/ctdl3264.c utils/*.h server/*.h utils/ctdl3264_structs.h
44         cc ${CFLAGS} ${LDFLAGS} utils/ctdl3264.c -lcitadel -lz -ldb -o ctdl3264
45 utils/ctdl3264_structs.h: server/server.h utils/ctdl3264_prep.sh
46         utils/ctdl3264_prep.sh
47
48 config.mk: configure
49         ./configure
50
51 clean:
52         rm -vf $(all)
53         find . -name *.o | xargs rm -vf
54
55 distclean: clean
56         rm -vf config.mk
57
58 install: $(all) utils/*.sh
59         #
60         # Installing to ${CTDLDIR}
61         #
62         @for x in $(all) utils/*.sh ; do \
63                 install -v -C -D -t ${CTDLDIR} $$x ;\
64         done