]> code.citadel.org Git - citadel.git/blobdiff - citadel/Makefile
view_mail.js: more progress on upload dialog
[citadel.git] / citadel / Makefile
index bf4b39b6e03491d3d358bbf475c5be805bbafb67..21c758592af2c68e55e39ad7300954823a1fdae5 100644 (file)
@@ -1,40 +1,82 @@
 # Makefile for Citadel Server
-# Copyright (c) 1987-2022 by Art Cancro and the citadel.org team
-# 
-# This is the new and improved version that does not use the GNU Autotools,
-# because it is The Current Year and we aren't trying to build for weird
-# obscure systems anymore.
+# Copyright (c) 1987-2023 by Art Cancro and the citadel.org team
 #
-# This program is open source software.  Use, duplication, and/or
-# disclosure are subject to the GNU General Purpose License version 3.
+# No, we are NOT using the obsolete GNU Autotools.  This configure script works
+# well on the Linux operating system (which uses the Linux kernel) and on BSD.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
+# This program is open source software.  Use, duplication, and/or
+# disclosure are subject to the GNU General Public License version 3.
 
 # config.mk is generated by ./configure
 include config.mk
 
-all: citserver setup
+all := ctdldump ctdlload citserver setup sendcommand citmail loadtest dbnothing ${CHKPW}
+all: $(all)
+
+SERVER_SOURCES := $(wildcard server/*.c server/modules/*/*.c)
+SERVER_OBJECTS := $(patsubst %.c,%.o,$(SERVER_SOURCES))
+BACKEND_SOURCES := $(wildcard server/backends/*/*.c)
+BACKEND_OBJECTS := $(patsubst %.c,%.o,$(BACKEND_SOURCES))
+
+$(SERVER_SOURCES): server/*.h server/modules/*/*.h server/backends/*/*.h
+       @touch $@
 
-citserver: server/*.c server/modules/*/*.c config.mk server/*.h
-       cc ${CFLAGS} \
-               server/*.c server/modules/*/*.c \
-               ${LDFLAGS} -lresolv -lcitadel -lpthread -lz -lical -lldap -lcrypt -lexpat -lcurl -ldb \
+$(BACKEND_SOURCES): server/*.h server/modules/*/*.h server/backends/*/*.h
+       @touch $@
+
+%.o: %.c
+       @echo $<
+       @${CC} ${CFLAGS} -c $< -o $@
+
+citserver: $(SERVER_OBJECTS) $(BACKEND_OBJECTS)
+       ${CC} ${CFLAGS} \
+               $(SERVER_OBJECTS) $(BACKEND_OBJECTS) \
+               ${LDFLAGS} \
+               -lcitadel -lpthread -lz -lical -lldap -lcrypt -lexpat -lcurl ${LRESOLV} ${BACKEND_LDFLAGS} \
                -o citserver
 
 setup: utils/setup.c server/citadel_dirs.c utils/*.h server/*.h
-       cc ${CFLAGS} utils/setup.c -lcitadel -o setup
+       ${CC} ${CFLAGS} ${LDFLAGS} utils/setup.c -lcitadel ${LINTL} -o setup
+
+ctdlmigrate: utils/ctdlmigrate.c server/citadel_dirs.c utils/*.h server/*.h
+       ${CC} ${CFLAGS} ${LDFLAGS} utils/ctdlmigrate.c -lcitadel -lreadline -o ctdlmigrate
+
+sendcommand: utils/sendcommand.c server/citadel_dirs.c utils/*.h server/*.h
+       ${CC} ${CFLAGS} ${LDFLAGS} utils/sendcommand.c -lcitadel -o sendcommand
+
+citmail: utils/citmail.c server/citadel_dirs.c utils/*.h server/*.h
+       ${CC} ${CFLAGS} ${LDFLAGS} utils/citmail.c -lcitadel -o citmail
+
+chkpw: utils/chkpw.c utils/*.h server/*.h
+       ${CC} ${CFLAGS} ${LDFLAGS} utils/chkpw.c -o chkpw
+
+chkpwd: utils/chkpwd.c utils/auth.c utils/*.h server/*.h
+       ${CC} ${CFLAGS} ${LDFLAGS} utils/chkpwd.c utils/auth.c -lcrypt -o chkpwd
+
+dbnothing: utils/dbnothing.c utils/*.h server/*.h ${BACKEND_OBJECTS}
+       ${CC} ${CFLAGS} ${LDFLAGS} utils/dbnothing.c ${BACKEND_OBJECTS} -lcitadel -lz ${BACKEND_LDFLAGS} -lpthread -o dbnothing
+
+ctdldump: utils/ctdldump.c utils/*.h server/*.h ${BACKEND_OBJECTS}
+       ${CC} ${CFLAGS} ${LDFLAGS} utils/ctdldump.c ${BACKEND_OBJECTS} -lcitadel -lz ${BACKEND_LDFLAGS} -lpthread -o ctdldump
+
+ctdlload: utils/ctdlload.c server/makeuserkey.c utils/*.h server/*.h ${BACKEND_OBJECTS}
+       ${CC} ${CFLAGS} ${LDFLAGS} utils/ctdlload.c server/makeuserkey.c ${BACKEND_OBJECTS} -lcitadel -lz ${BACKEND_LDFLAGS} -lpthread -o ctdlload
+
+loadtest: utils/loadtest.c server/citadel_dirs.c utils/*.h server/*.h
+       ${CC} ${CFLAGS} ${LDFLAGS} utils/loadtest.c -lcitadel -lpthread -o loadtest
 
 config.mk: configure
        ./configure
 
 clean:
-       rm -vf citserver
+       rm -vf $(all)
        find . -name *.o | xargs rm -vf
-       rm -vf config.mk
 
-# In conf-IG-ure, "distclean" is the same as "clean"
 distclean: clean
+       rm -vf config.mk
+
+install: $(all) utils/*.sh
+       @echo Installing to ${CTDLDIR}
+       @for x in $(all) utils/*.sh ; do \
+               install -v -C -D -t ${CTDLDIR} $$x ;\
+       done