LIBS = -lc 
SPECLIBS =
SPECPROGS = 
MYSQLCLIENT = libmysqlclient.a
LDAP_SPECLIBS = 
LDAPLIB1 = libldap.a
LDAPLIB2 = liblber.a
CFLAGS= -w -Dunix  

# CFLAGS normally redefined in config.i below
include ../config.i

# LDAPAUTH_OBJ = ld_sha.c ld_safe.c ld_auth.c ld_dflts.c ld_ini.c ld_log.c ld_vers.c

LDAPAUTH_OBJ = ld_sha.c ld_auth.c

PAMAUTH_OBJ = ld_auth.c 

MYSQLAUTH_OBJ = auth.o snprintf.o ssnprintf.o

SYSAUTH_OBJ = sysauth.o flock.o

POPFETCH_OBJ = pf_safe.o popfetch.o pf_all.o pf_conf.o pf_lib.o pf_log.o pf_smtpsend.o snprintf.o pf_tcplib2.o pf_ras.o

DNAUTH_OBJ = dnauth.o

TELLPOP_OBJ = ../mailid/mailid.o lang.o bull.o snprintf.o ssnprintf.o encrypt.o noprof.o wild.o dpstats.o dpkeys.o ini.o vdomain.o lib.o noauthchan.o nolog.o tellpop.o ../dm_conf/dm_conf.o \
			fileops.o getdates.o longlong.o splay.o statistics.o


DPOP_OBJ = ../mailid/mailid.o newhash.o authchan.o snprintf.o ssnprintf.o dotlock.o bull.o bins.o cmd.o dpkeys.o dplib.o dpop.o dpop_ini.o encrypt.o \
           flock.o folders.o from.o ini.o keys.o lang.o lib.o lib_spawn.o log.o manager.o \
           mdrop.o passwd.o pchan.o prof.o quit.o retr.o tcp.o userpass.o \
           uinfo.o nbins.o users.o vdomain.o version.o wild.o stats.o slavechan.o recent.o ../dm_conf/dm_conf.o

SETUP_OBJ = ../mailid/mailid.o lang.o newconf.o snprintf.o ssnprintf.o encrypt.o noprof.o dpop_setup.o lib.o version.o wild.o nolog.o ../dm_conf/dm_conf.o

AUTHENT_OBJ = authent.o

DPSTATS_OBJ = lang.o noprof.o dpstats.o nolog.o lib.o wild.o

DSLAVE_OBJ = ../mailid/mailid.o lang.o newhash.o wild.o snprintf.o ssnprintf.o bull.o mintcp.o encrypt.o dplib.o \
			dpop_ini.o dslave.o flock.o from.o ini.o lib.o mdrop.o dotlock.o \
             nbins.o noauthchan.o noprof.o pchan.o slvlog.o vdomain.o \
			 passwd.o ../dm_conf/dm_conf.o parsedate.c uinfo.c


#Temp testing ones

# rules to build  
# not building wadduser any more - DHGB
all: dpop nwauth tellpop setup  dslave dnauth $(SPECPROGS)
	echo "Done!"

../mailid/mailid.o:
	$(CC) -c ../mailid/mailid.c -o ../mailid/mailid.o $(CFLAGS)

../dm_conf/dm_conf.o: ../dm_conf/dm_conf.c
	$(CC) -c ../dm_conf/dm_conf.c -o ../dm_conf/dm_conf.o $(CFLAGS)


ldapauth: $(LDAPAUTH_OBJ)
	$(CC) -o ldapauth $(CFLAGS) -DLDAPAUTH $(LDAPAUTH_OBJ) $(LDAP_SPECLIBS)

pamauth: $(PAMAUTH_OBJ)
	$(CC) -o pamauth $(CFLAGS) -DPAMAUTH $(PAMAUTH_OBJ) 

mysqlauth: $(MYSQLAUTH_OBJ)
	cp $(MYSQLCLIENT) libmysqlclient.a
	$(CC) -o mysqlauth $(CFLAGS) $(MYSQLAUTH_OBJ) $(SPECLIBS)

sysauth: $(SYSAUTH_OBJ)
	$(CC) -o unixauth $(CFLAGS) $(SYSAUTH_OBJ) $(LIBS)

popfetch: $(POPFETCH_OBJ)
	$(CC) -o popfetch $(CFLAGS) $(POPFETCH_OBJ) $(LIBS)

dnauth: $(DNAUTH_OBJ)
	$(CC) -o dnauth $(CFLAGS) $(DNAUTH_OBJ) $(LIBS)

nwauth: flock.o nwauth.o ld_sha.o  
	$(CC) -o nwauth $(CFLAGS) nwauth.o flock.o ld_sha.o $(LIBS)

nwauth2.o: nwauth2.c
	$(CC) -c -DNOAUTHMAIN nwauth2.c

wadduser.cgi: wadduser.o nwauth2.o 
	$(CC) -o wadduser.cgi $(CFLAGS) wadduser.o nwauth2.o $(LIBS)

dmulti: $(DMULTI_OBJ)
	$(CC) -o dmulti $(CFLAGS) $(DMULTI_OBJ) $(LIBS) 

dslave: $(DSLAVE_OBJ)
	$(CC) -o dslave $(CFLAGS) $(DSLAVE_OBJ) $(LIBS) 

dpop: $(DPOP_OBJ)
	$(CC) -o dpop $(CFLAGS) $(DPOP_OBJ) $(LIBS) 

dpstats: $(DPSTATS_OBJ)
	$(CC) -o dpstats $(CFLAGS) $(DPSTATS_OBJ) $(LIBS) 

setup: $(SETUP_OBJ)
	$(CC) -o dmsetup $(CFLAGS) $(SETUP_OBJ) $(LIBS)
 
authent: $(AUTHENT_OBJ)
	$(CC) -o authent $(CFLAGS) $(AUTHENT_OBJ) $(LIBS) 

authtest: $(AUTHTEST_OBJ)
	$(CC) -o authtest $(CFLAGS) $(AUTHTEST_OBJ) $(LIBS) 

tellpop: $(TELLPOP_OBJ)
	$(CC) -o tellpop $(CFLAGS) $(TELLPOP_OBJ) $(LIBS) 

testdrop: $(TESTDROP_OBJ)
	$(CC) -o testdrop $(CFLAGS) $(TESTDROP_OBJ) $(LIBS) 

lock: $(LOCK_OBJ)
	$(CC) -o lock $(CFLAGS) $(LOCK_OBJ) $(LIBS) 

test: $(TEST_OBJ)
	$(CC) -o test $(CFLAGS) $(TEST_OBJ) $(LIBS) 

clean:
	rm -f *.o *~ 
