#
# Makefile  -  makefile for IP stack
#
# Copyright (C) 1995,1996 Gero Kuhlmann <gero@gkminix.han.de>
#
#  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
#  any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#


#
#  Include system dependent definitions:
#
include ../../config.mk


#
#  List of source and object files:
#
CSRCS	= netinit.c arp.c udp.c
ASRCS	= packet.asm utility.asm
OBJS	= netinit.obj arp.obj udp.obj packet.obj utility.obj
TARGET	= net.lib

CHDRS	= ../../headers/general.h \
	  ../public/net.h \
	  ../public/romlib.h \
	  ./netpriv.h

AHDRS	= ../../headers/asm/layout.inc \
	  ../../headers/asm/macros.inc \
	  ../../headers/asm/memory.inc


#
#  Rules to create object files from source files:
#
.SUFFIXES:	.c .asm .obj .exe

.c.obj: 
ifdef VERBOSE
	$(CC) -c $(CFLAGS) $(NETCFL) $<
else
	$(CC) -c $(CFLAGS) $(NETCFL) $<	>NUL
endif
	$(LIBP) $(TARGET:.lib=)-+$@ ; >NUL

.asm.obj:
	$(ASM) $(AFLAGS) $(NETAFL) $< ;
	$(LIBP) $(TARGET:.lib=)-+$@ ; >NUL


#
#  Target rules. Note that assembler files cannot have their dependencies
#  created automatically, and therefore have to appear here.
#
all:		$(TARGET)

$(TARGET):	$(OBJS)

netinit.obj:	netinit.c $(CHDRS) ./arp.h ./ip.h ./udp.h

arp.obj:	arp.c $(CHDRS) ./arp.h

udp.obj:	udp.c $(CHDRS) ./arp.h ./ip.h ./udp.h

packet.obj:	packet.asm $(AHDRS) ./pktpriv.inc

utility.obj:	utility.asm $(AHDRS)


#
#  Maintenance rules for cleaning up.
#
.PHONY:	clean

clean:
	-$(RM) $(TARGET)
	-$(RM) *.obj
	-$(RM) *.lst
	-$(RM) *.map
	-$(RM) *.bak


dummy:
