#
# Makefile for STREAMS modules for Solaris 2.
#
# $Id: Makefile.sol2,v 1.1 2006/12/31 09:04:25 lzl Exp $
#

include Makedefs.sol2

COPTS += -xO2 -xspace -W0,-Lt

COMP_OBJS = ppp_comp.o bsd-comp.o deflate.o zlib.o vjcompress.o \
	ppp_comp_mod.o

all:	ppp ppp_ahdl ppp_comp

ppp:	ppp.o ppp_mod.o
	$(LD) -r -o $@ ppp.o ppp_mod.o
	chmod +x $@

ppp_ahdl: ppp_ahdlc.o ppp_ahdlc_mod.o
	$(LD) -r -o $@ ppp_ahdlc.o ppp_ahdlc_mod.o
	chmod +x $@

ppp_comp: $(COMP_OBJS)
	$(LD) -r -o $@ $(COMP_OBJS)
	chmod +x $@

bsd-comp.o:	../modules/bsd-comp.c
	$(CC) $(CFLAGS) -c $?
deflate.o:	../modules/deflate.c
	$(CC) $(CFLAGS) -c $?
ppp.o:	ppp.c
	$(CC) $(CFLAGS) -c $?
ppp_mod.o:	ppp_mod.c
	$(CC) $(CFLAGS) -c $?
ppp_ahdlc_mod.o: ppp_ahdlc_mod.c
	$(CC) $(CFLAGS) -c $?
ppp_ahdlc.o: ppp_ahdlc.c
	$(CC) $(CFLAGS) -c $?
ppp_comp.o: ppp_comp.c
	$(CC) $(CFLAGS) -c $?
ppp_comp_mod.o:	ppp_comp_mod.c
	$(CC) $(CFLAGS) -c $?
vjcompress.o:	../modules/vjcompress.c
	$(CC) $(CFLAGS) -c $?
zlib.o:	../common/zlib.c
	$(CC) $(CFLAGS) -c $?

install:
	cp ppp ppp.conf /kernel/drv
	cp ppp_comp ppp_ahdl /kernel/strmod
	if grep clone:ppp /etc/minor_perm; then :; else \
	  echo clone:ppp 0644 root sys >>/etc/minor_perm; fi
	/usr/sbin/rem_drv ppp 2>/dev/null || true
	/usr/sbin/add_drv ppp

SRCS	= ppp.c ppp_mod.c ppp_ahdlc.c ppp_ahdlc_mod.c \
	ppp_comp.c ../modules/bsd-comp.c ../modules/deflate.c \
	../common/zlib.c ../modules/vjcompress.c ppp_comp_mod.c

lint:
	$(LINT32) $(SRCS)

clean:
	rm -f ppp ppp_comp ppp_ahdl *.o *~ core
	rm -f *.ln
