include ../conf/dp.conf
include ../Makefile.conf

##
##  Copyright (c) 1991 Bolt Beranek and Newman, Inc.
##  All rights reserved.
##
##  Redistribution and use in source and binary forms are permitted
##  provided that: (1) source distributions retain this entire copyright
##  notice and comment, and (2) distributions including binaries display
##  the following acknowledgement:  ``This product includes software
##  developed by Bolt Beranek and Newman, Inc. and CREN/CSNET'' in the
##  documentation or other materials provided with the distribution and in
##  all advertising materials mentioning features or use of this software.
##  Neither the name of Bolt Beranek and Newman nor CREN/CSNET may be used
##  to endorse or promote products derived from this software without
##  specific prior written permission.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
##  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
##
##
##  Common make include file for Dialup IP.
##  Copyright (c) 1991 Bolt Beranek and Newman, Inc.
##  All rights reserved.
##
##  Redistribution and use in source and binary forms are permitted
##  provided that: (1) source distributions retain this entire copyright
##  notice and comment, and (2) distributions including binaries display
##  the following acknowledgement:  ``This product includes software
##  developed by Bolt Beranek and Newman, Inc. and CREN/CSNET'' in the
##  documentation or other materials provided with the distribution and in
##  all advertising materials mentioning features or use of this software.
##  Neither the name of Bolt Beranek and Newman nor CREN/CSNET may be used
##  to endorse or promote products derived from this software without
##  specific prior written permission.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
##  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
##

##  Program flags.
#	Set this to -g or -O, as appropriate.
DEBUG_OR_OPT	= -O
#	Pre-processor definitions, for use below.
include ../Makefile.hw
DEFS		= -I../h -DSTREAMS ${HWSUPPORT} `../conf/osdefs`
#	C compiler flags.
CFLAGS		= $(DEFS) $(DEBUG_OR_OPT)
#	Linker flags.
LDFLAGS		= $(DEBUG_OR_OPT)
#
LIBS=-lsocket -lnsl
#	Lint flags.
LINTFLAGS	= $(DEFS)

DSRCS	= dpd.c makecall.c readconfig.c confparse.c runscript.c		\
	  uucplock.c ppp.c dprelease.c log.c progname.c recordpid.c	\
	  strerror.c calllog.c callstat.c paths.c defpaths.c		\
	  dlpi.c sts.c
DOBJS	= dpd.o makecall.o readconfig.o confparse.o runscript.o		\
	  uucplock.o ppp.o dprelease.o log.o progname.o recordpid.o	\
	  strerror.o calllog.o callstat.o paths.o defpaths.o		\
	  dlpi.o sts.o

LSRCS	= dplogin.c readconfig.c confparse.c log.c progname.c		\
	  recordpid.c calllog.c strerror.c ppp.c callstat.c		\
	  paths.c defpaths.c dlpi.c
LOBJS	= dplogin.o readconfig.o confparse.o log.o progname.o		\
	  recordpid.o calllog.o strerror.o ppp.o callstat.o		\
	  paths.o defpaths.o dlpi.o
INST_FILES=${DPBIN_DIR}/dpd	\
	   ${DPBIN_DIR}/dplogin

SRCS=$(DSRCS) $(LSRCS)

all:		dpd dplogin

defpaths.c:	../conf/dp.conf ./mkdefpaths.sh
	./mkdefpaths.sh < ../conf/dp.conf > defpaths.c

clean:
	rm -f foo core tags lint dpd.lint dplogin.lint a.out *.o dpd dplogin Makefile.bak

install:	${INST_FILES}

${DPBIN_DIR}/dpd:	dpd
	../conf/install -u root -g staff -m 0755 -f ${DPBIN_DIR} dpd
	strip ${DPBIN_DIR}/dpd
${DPBIN_DIR}/dplogin:	dplogin
	../conf/install -u root -g staff -m 04755 -f ${DPBIN_DIR} dplogin
	strip ${DPBIN_DIR}/dplogin

lint:	dpd.lint dplogin.lint

dpd.lint:		dpd
	lint $(LINTFLAGS) $(DSRCS) | grep -v "possible pointer alignment problem" > dpd.lint

dplogin.lint:		dplogin
	lint $(LINTFLAGS) $(LSRCS) | grep -v "possible pointer alignment problem" > dplogin.lint


##
dpd:		$(DOBJS)
	$(CC) -o $@ $(LDFLAGS) $(DOBJS) $(LIBS)

dplogin:	$(LOBJS)
	$(CC) -o $@ $(LDFLAGS) $(LOBJS) $(LIBS)


include ../Makefile.depend

# DO NOT DELETE THIS LINE -- make depend uses it

# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see make depend above
