#
# NET-BASE	A collection of programs that form the base set of the
#		NET-2 Networking Distribution for the LINUX operating
#		system.
#
# Version:	@(#)Makefile	0.32	01/16/94
#
# Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
#		Copyright 1988-1993 MicroWalt Corporation
#
#		This program is free software; you can redistribute it
#		and/or  modify it under  the terms of  the GNU General
#		Public  License as  published  by  the  Free  Software
#		Foundation;  either  version 2 of the License, or  (at
#		your option) any later version.
#

RELEASE	= 0.32b-2db


.EXPORT_ALL_VARIABLES:

CC	= cc -O6 -Wall
LD	= cc

CFLAGS	= -I. -I.. -Ilib -I../lib -DLINUX #-DDEBUG
LDFLAGS	= -Llib -L../lib -N -s

LIBS	= -lsupport


PROGS	= ifconfig hostname arp netstat route slattach
SUBDIRS	= 

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


all:		config.h version.h unpack $(PROGS) subdirs

install:	all
		@sh ./Install.sh

firsttime:	all
		@sh ./Install.sh --firsttime

update:		all
		@sh ./Install.sh --nobackup

devices:
		@sh ./Install.sh --devices

clean:
		rm -f *.o config.new version.h
		@for i in lib $(SUBDIRS); do cd $$i && make clean && cd ..; done

clobber:	clean
		rm -f $(PROGS) config.h config.status
		@for i in lib $(SUBDIRS); do cd $$i && make clobber && cd ..; done

dist:
		@echo Creating net-$(RELEASE) in ..
		@tar cfvz ../net-$(RELEASE).tar.gz *

unpack:
		@echo ; sh ./Unpack.sh

config.h:	Makefile config.in
		@echo "Configuring the NET-2 Base Utilities..." ; echo
		@if [ -f config.status ]; \
			then /bin/sh ./Configure.sh <config.status; \
		   else /bin/sh ./Configure.sh <config.in; \
		 fi

version.h:	Makefile
		@echo "#define RELEASE \"NET-2 Base Utilities release $(RELEASE)\"" >version.h

ifconfig:	lib/libsupport.a ifconfig.o
		$(CC) $(LDFLAGS) -o ifconfig ifconfig.o $(LIBS)

hostname:	lib/libsupport.a hostname.o
		$(CC) $(LDFLAGS) -o hostname hostname.o $(LIBS)

route:		lib/libsupport.a route.o
		$(CC) $(LDFLAGS) -o route route.o $(LIBS)

arp:		lib/libsupport.a arp.o
		$(CC) $(LDFLAGS) -o arp arp.o $(LIBS)

slattach:	lib/libsupport.a slattach.o
		$(CC) $(LDFLAGS) -o slattach slattach.o $(LIBS)

netstat:	lib/libsupport.a netstat.o
		$(CC) $(LDFLAGS) -o netstat netstat.o $(LIBS)

subdirs:	
		@for i in $(SUBDIRS); do (cd $$i; $(MAKE)); done

lib/libsupport.a:
		@(cd lib ; $(MAKE))

netstat.o:	netstat.c
		$(CC) $(CFLAGS) -D__KERNEL__ -c $<

# End of Makefile.
