# Edit as suitable!
# Use local copy of the library...
#ACEINC=-IAceAgentSDK503/inc
#ACELIB=AceAgentSDK503/lib/`test \`uname -s\` = SunOS && echo sol || echo lnx`/libaceclnt.a
# ... or use one installed on the system...
ACEINC=-I/usr/local/AceAgentSDK503/inc
ACELIB=-L/usr/local/AceAgentSDK503/lib/`test \`uname -s\` = SunOS && echo sol || echo lnx` -laceclnt
# Use gcc.
CC=gcc
LD=gcc
# apxs is in the PATH...
APXS=apxs
# ... or the path to apxs must be given...
#APXS=/usr/local/apache/bin/apxs
# Directory where binaries should be installed
TARGETDIR=`$(APXS) -q LIBEXECDIR`
# Make a standard build...
APXSFLAGS=`test \`uname -s\` = Linux && echo -DSECURID_USE_GDBM -lgdbm` $(ACEINC) -Wc,-Wall
CFLAGS=-Wall $(ACEINC) -D_REENTRANT `test \`uname -s\` = SunOS && test \`uname -r\` = 5.6 && echo -Dsocklen_t=size_t`
# ... or one configured for debugging.
#APXSFLAGS=-DSECURID_DEBUG `test \`uname -s\` = Linux && echo -DSECURID_USE_GDBM -lgdbm` $(ACEINC) -Wc,-g -Wc,-Wall
#CFLAGS=-g -Wall $(ACEINC) -D_REENTRANT -DSECURID_DEBUG
LDFLAGS=-lpthread `test \`uname -s\` = SunOS && echo -lsocket -lnsl`

#
# Targets
#

all: mod_securid.so securid_proxy

mod_securid.so: mod_securid.c securid_client.c securid_client.h securid_conf.h securid_webid.h Makefile
	$(APXS) -c -o mod_securid.so $(APXSFLAGS) mod_securid.c securid_client.c

securid_proxy: securid_proxy.o securid_proxy_signals.o Makefile
	$(LD) $(LDFLAGS) -o $@ securid_proxy.o securid_proxy_signals.o $(ACELIB)

securid_proxy.o: securid_proxy.c Makefile

securid_proxy_signals.o: securid_proxy_signals.c Makefile

install: all
	umask 022; cp mod_securid.so "$(TARGETDIR)"
	umask 022; cp securid_proxy "$(TARGETDIR)"

clean:
	rm securid_proxy mod_securid.so *.o
