# linked in only when needed. This Makefile is called from the main make file,
# after cd'ing to the auths subdirectory. When the relevant AUTH_ macros are
# defined, the equivalent modules herein is not included in the final binary.
+#
+# Copyright (c) The Exim Maintainers 2024
-OBJ = auth-spa.o call_pam.o call_pwcheck.o \
- call_radius.o check_serv_cond.o cram_md5.o cyrus_sasl.o dovecot.o \
- external.o get_data.o get_no64_data.o gsasl_exim.o heimdal_gssapi.o \
- plaintext.o pwcheck.o \
- spa.o tls.o xtextdecode.o xtextencode.o
-
-auths.a: $(OBJ)
- @$(RM_COMMAND) -f auths.a
- @echo "$(AR) auths.a"
- $(FE)$(AR) auths.a $(OBJ)
- $(RANLIB) $@
-
-.SUFFIXES: .o .c
-.c.o:; @echo "$(CC) $*.c"
- $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) $*.c
-
-auth-spa.o: $(HDRS) auth-spa.c
-call_pam.o: $(HDRS) call_pam.c
-call_pwcheck.o: $(HDRS) call_pwcheck.c pwcheck.h
-call_radius.o: $(HDRS) call_radius.c
-check_serv_cond.o: $(HDRS) check_serv_cond.c
-get_data.o: $(HDRS) get_data.c
-get_no64_data.o: $(HDRS) get_no64_data.c
-pwcheck.o: $(HDRS) pwcheck.c pwcheck.h
-xtextdecode.o: $(HDRS) xtextdecode.c
-xtextencode.o: $(HDRS) xtextencode.c
-
-cram_md5.o: $(HDRS) cram_md5.c cram_md5.h
-cyrus_sasl.o: $(HDRS) cyrus_sasl.c cyrus_sasl.h
-dovecot.o: $(HDRS) dovecot.c dovecot.h
-external.o: $(HDRS) external.c external.h
-gsasl_exim.o: $(HDRS) gsasl_exim.c gsasl_exim.h
-heimdal_gssapi.o: $(HDRS) heimdal_gssapi.c heimdal_gssapi.h
-plaintext.o: $(HDRS) plaintext.c plaintext.h
-spa.o: $(HDRS) spa.c spa.h
-tls.o: $(HDRS) tls.c tls.h
+# nb: at build time, the version of this file used will have had some
+# extra variable definitions and prepended to it and module build rules
+# interpolated below. This is done by scripts/drivers-Makefile with
+# definitions from scripts/Configure-Makefile
+
+# MAGIC-TAG-MODS-OBJ-RULES-GO-HERE
+
+OBJ += auth-spa.o call_pam.o call_pwcheck.o call_radius.o check_serv_cond.o \
+ get_data.o get_no64_data.o pwcheck.o
+
+all: auths.a $(MODS)
+
+auths.a: $(OBJ)
+ @$(RM_COMMAND) -f auths.a
+ @echo "$(AR) auths.a"
+ $(FE)$(AR) auths.a $(OBJ)
+ $(RANLIB) $@
+
+.SUFFIXES: .o .c .so
+.c.o:; @echo "$(CC) $*.c"
+ $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) $*.c
+
+SO_FLAGS = -DDYNLOOKUP $(CFLAGS_DYNAMIC) $(CFLAGS) $(INCLUDE) $(DLFLAGS)
+.c.so:; @echo "$(CC) -shared $*.c"
+ $(FE)$(CC) $(SO_FLAGS) $(AUTH_$*_INCLUDE) $(AUTH_$*_LIBS) \
+ $*.c -o $@
+
+
+$(OBJ) $(MOD): $(HDRS)
+
+auth-spa.o: auth-spa.c
+call_pam.o: call_pam.c
+call_pwcheck.o: call_pwcheck.c pwcheck.h
+call_radius.o: call_radius.c
+check_serv_cond.o: check_serv_cond.c
+get_data.o: get_data.c
+get_no64_data.o: get_no64_data.c
+pwcheck.o: pwcheck.c pwcheck.h
+
+cram_md5.o: cram_md5.c cram_md5.h
+cyrus_sasl.o: cyrus_sasl.c cyrus_sasl.h
+dovecot.o: dovecot.c dovecot.h
+external.o: external.c external.h
+gsasl.o: gsasl.c gsasl.h
+heimdal_gssapi.o: heimdal_gssapi.c heimdal_gssapi.h
+plaintext.o: plaintext.c plaintext.h
+spa.o: spa.c spa.h
+tls.o: tls.c tls.h
+
+# These depend on more than one .c source
+
+spa.so: spa.c auth-spa.c spa.h
+ $(FE)$(CC) $(SO_FLAGS) spa.c auth-spa.c -o $@
# End