CC=cc
# CC=gcc

# HP-UX 10
# Flags for HP's ANSI C compiler
CFLAGS=-Ae +w1 +O4 +Oall +DAportable +ESlit -DHPUX10
# Flags for gcc
# CFLAGS=-O -ansi -D_HPUX_SOURCE -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -DHPUX10

# Linux 2
# CFLAGS=-O -ansi -D_GNU_SOURCE -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -DLINUX2

# For Tru64 Unix
# CFLAGS=-O -DTRU64 -Wall

# Solaris 2.6 (Louis LeBlanc <leblanc@mirror-image.com>)
# Flags for GCC only.
# CFLAGS=-O -Wall -Wshadow -DSUNOS
# SYSLIBS=-lxnet

# Solaris 7 w/gcc ("Phil Howard" <phil-openssh-unix-dev@ipal.net>)
# need -D__EXTENSIONS__ to define SA_RESTART
# CFLAGS=-O -ansi -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -D__EXTENSIONS__ -DSUNOS
# SYSLIBS=-lsocket -lnsl

# NeXTstep 3.3 (m68k) with cc or gcc (doesn't matter since NeXTstep cc is some
# sort of gcc 2.5.8) ("Michael Weiser" <michael@weiser.saale-net.de>)
# CFLAGS=-posix -O3 -Wall -DNEXTSTEP3
# LDFLAGS=-posix

# NeXTstep 3.3 (HPPA) with cc or gcc (doesn't matter since NeXTstep cc is some
# sort of gcc 2.5.8) ("Jacques Distler" <distler@golem.ph.utexas.edu>)
# Requires "libopenbsd-compat" from the OpenSSH-portable package.
# CFLAGS=-O3 -Wall -DNEXTSTEP3 -DNEXTSTEP3_HPPA -D_POSIX_SOURCE
# LDFLAGS=-L. -lopenbsd-compat

# IRIX 6.2 w/gcc ("Michael Weiser" <michael@weiser.saale-net.de>)
# CFLAGS=-O3 -Wall -DIRIX62

# IRIX 6.2 w/cc ("Michael Weiser" <michael@weiser.saale-net.de>)
# CFLAGS=-O3 -DIRIX62

# UNIXWARE7 w/cc ("George Walsh" <gjmwalsh@netscape.net>)
# CFLAGS=-O -DOPEN_SOURCE -DUNIXWARE7
# SYSLIBS=-lsocket -lnsl

# UNIXWARE7 w/gcc ("John Hughes" <john@Calva.COM>)
# CFLAGS=-O -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -DUNIXWARE7
# SYSLIBS=-lsocket -lnsl

# OpenServer w/gcc ("Boyd Gerber" <gerberb@zenez.COM>)
# CFLAGS=-O -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -DSCO
# SYSLIBS=-lsocket -lnsl

# AIX 4.3 w/cc ("Joerg Petersen <j.petersen@msh.de>)
# CFLAGS=-O -DAIX43
# SYSLIBS=

LIBS=$(SYSLIBS)

# Move default locations
#DEFS=-DRANDSAVENAME=\"/tmp/prngd-seed\" -DCONFIGFILE=\"/tmp/prngd.conf\"
# or
#DEFS=-DRANDSAVENAME=\"/usr/local/etc/prngd/prngd-seed\" -DCONFIGFILE=\"/usr/local/etc/prngd/prngd.conf\"
# or

COMPLETE_CPPFLAGS=-I. $(CPPFLAGS)

OBJS=prngd.o serverloop.o bsd-daemon.o seed.o rand.o conffile.o sha1.o close_on_exec.o non_blocking.o sockio.o obtain_limit.o

.c.o:
	$(CC) $(CFLAGS) $(COMPLETE_CPPFLAGS) $(DEFS) -c $<

prngd: $(OBJS)
	$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)

clean:
	rm -f prngd $(OBJS)

prngd.o: prngd.c config.h prngd.h
serverloop.o: serverloop.c config.h prngd.h
seed.o: seed.c config.h prngd.h
bsd-daemon.o: bsd-daemon.c config.h prngd.h
rand.o: rand.c config.h prngd.h
conffile.o: conffile.c config.h prngd.h
sha1.o: sha1.c config.h prngd.h
close_on_exec.o: close_on_exec.c config.h prngd.h
non_blocking.o: non_blocking.c config.h prngd.h
sockio.o: sockio.c config.h prngd.h
obtain_limit.o: obtain_limit.c config.h prngd.h
