# Solaris specific defines, passed to subdirectories.
# To use Sun CC, uncomment the CC and KFLAGS variables.
#
# $Id: Makefile.in,v 1.1.2.4 2004/10/06 01:05:32 didg Exp $


CC	= @CC@
# LD hardcoded to sun ld, GNU ld has been reported to cause some trouble with 64 bit
LD	= /usr/ccs/bin/ld

INSTALL = @INSTALL@
GREP=@GREP@


# -D_ISOC9X_SOURCE is handled by OSVERSION. basically, it's not needed
# with 2.5.1.
DEFS=	-D__svr4__ -DSOLARIS -I../../sys/generic \
	-I.. @DEFS@

# Variables
KCFLAGS=@KCFLAGS@
KLDFLAGS=@KLDFLAGS@
COMPILE_KERNEL_GCC=@COMPILE_KERNEL_GCC@
SPARC64=@COMPILE_64BIT_KMODULE@
SOLARIS_MODULE_FALSE=@SOLARIS_MODULE_FALSE@
SOLARIS_MODULE_TRUE=@SOLARIS_MODULE_TRUE@
USE_SOLARIS_TRUE=@USE_SOLARIS_TRUE@
USE_SOLARIS_FALSE=@USE_SOLARIS_FALSE@

OPTOPTS=

# Local build stuff.

SRC= linkage.c tpi.c dlpi.c ioc.c if.c aarp.c ddp.c sock.c rt.c
OBJ= linkage.o tpi.o dlpi.o ioc.o if.o aarp.o ddp.o sock.o rt.o
HEADERS= if.h ioc.h rt.h sock.h
EXTRA_DIST= ddp.conf Makefile

INCPATH=	-I../../include -I../netatalk -I../..
CFLAGS=	${DEFS} ${OPTOPTS} ${INCPATH} ${KCFLAGS}

# Not building on Solaris
@USE_SOLARIS_FALSE@all:

# No Solaris kernel module build
@USE_SOLARIS_TRUE@@SOLARIS_MODULE_FALSE@all:
@USE_SOLARIS_TRUE@@SOLARIS_MODULE_FALSE@	@echo
@USE_SOLARIS_TRUE@@SOLARIS_MODULE_FALSE@	@echo "Solaris kernel module cannot be build"
@SOLARIS_MODULE_FALSE@install:
@SOLARIS_MODULE_FALSE@
@SOLARIS_MODULE_FALSE@uninstall:

# Build Solaris kernel module
@SOLARIS_MODULE_TRUE@all :	kernel

@SOLARIS_MODULE_TRUE@kernel: ddp 

@SOLARIS_MODULE_TRUE@FRC: 

@SOLARIS_MODULE_TRUE@ddp :	${OBJ}
@SOLARIS_MODULE_TRUE@	${LD} ${KLDFLAGS} -r -o ddp ${OBJ}

@SOLARIS_MODULE_TRUE@linkage.o : linkage.c
@SOLARIS_MODULE_TRUE@	${CC} ${CFLAGS} -DVERSION=\"`cat ../../VERSION`\" -c linkage.c

@SOLARIS_MODULE_TRUE@kuninstall : FRC
@SOLARIS_MODULE_TRUE@	@if [ x"${SPARC64}" = x"yes" ] ; then \
@SOLARIS_MODULE_TRUE@		${RM} /usr/kernel/drv/sparcv9/ddp; \
@SOLARIS_MODULE_TRUE@		${RM} /usr/kernel/strmod/sparcv9/ddp; \
@SOLARIS_MODULE_TRUE@	else \
@SOLARIS_MODULE_TRUE@		${RM} /usr/kernel/drv/ddp; \
@SOLARIS_MODULE_TRUE@		${RM} /usr/kernel/strmod/ddp; \
@SOLARIS_MODULE_TRUE@	fi
@SOLARIS_MODULE_TRUE@	${RM} /usr/kernel/drv/ddp.conf
@SOLARIS_MODULE_TRUE@	-rem_drv ddp
@SOLARIS_MODULE_TRUE@	sync;sync;sync

@SOLARIS_MODULE_TRUE@kinstall : kernel kuninstall
@SOLARIS_MODULE_TRUE@	@if [ x"${SPARC64}" = x"yes" ]; then \
@SOLARIS_MODULE_TRUE@		${INSTALL} -o root -g sys -c ddp /usr/kernel/drv/sparcv9/ddp; \
@SOLARIS_MODULE_TRUE@		ln /usr/kernel/drv/sparcv9/ddp /usr/kernel/strmod/sparcv9/ddp; \
@SOLARIS_MODULE_TRUE@	else \
@SOLARIS_MODULE_TRUE@		${INSTALL} -o root -g sys -c ddp /usr/kernel/drv/ddp; \
@SOLARIS_MODULE_TRUE@		ln /usr/kernel/drv/ddp /usr/kernel/strmod/ddp; \
@SOLARIS_MODULE_TRUE@	fi
@SOLARIS_MODULE_TRUE@	${INSTALL} -o root -g sys -c ddp.conf /usr/kernel/drv/ddp.conf
@SOLARIS_MODULE_TRUE@	add_drv -m '* 0666 root sys' ddp
@SOLARIS_MODULE_TRUE@	sync;sync;sync
@SOLARIS_MODULE_TRUE@	@if ${GREP} 'ddp' /etc/netconfig; then \
@SOLARIS_MODULE_TRUE@            echo "netconfig already contains a ddp module, skipping"; \
@SOLARIS_MODULE_TRUE@        else \
@SOLARIS_MODULE_TRUE@            echo "adding ddp module to netconfig"; \
@SOLARIS_MODULE_TRUE@            echo "ddp        tpi_clts      -    appletalk ddp   /dev/ddp        -" >> /etc/netconfig; \
@SOLARIS_MODULE_TRUE@	fi
@SOLARIS_MODULE_TRUE@	@echo "Installed Solaris kernel module"


@SOLARIS_MODULE_TRUE@install:
@SOLARIS_MODULE_TRUE@	@echo
@SOLARIS_MODULE_TRUE@	@echo "To install the Solaris kernel module type 'make kinstall' as root user"

@SOLARIS_MODULE_TRUE@uninstall:
@SOLARIS_MODULE_TRUE@	@echo
@SOLARIS_MODULE_TRUE@	@echo "To uninstall the Solaris kernel module type 'make kuninstall' as root user"

distdir :

clean : sysclean

klean sysclean :
	rm -f a.out core* *.o *.bak *[Ee]rrs tags
	rm -f ddp

distclean: clean
	 -rm -f Makefile

maintainer-clean: distclean

depend :

check:

# DO NOT DELETE THIS LINE

