# $Id: Smakefile,v 1.19 1993/10/23 03:12:15 ppessi Exp $
#
# Smakefile for AmiTCP/IP network utilities
#
# Copyright  1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
#	           Helsinki University of Technology, Finland.
#                  All rights reserved.
#
# Created      : Fri May 14 22:23:09 1993 ppessi
# Last modified: Wed Oct 20 07:23:47 1993 ppessi
#
# $Log: Smakefile,v $
# Revision 1.19  1993/10/23  03:12:15  ppessi
# Removed SCOPTIONS files. Added new installation facilities.
#
# Revision 1.18  1993/10/14  00:04:15  ppessi
# SCOPTIONS is now created automatically from Smakefile
# Added `install' target.
#
# Revision 1.17  1993/08/12  09:26:08  jraja
# Removed unnecesary files from route.
#
# Revision 1.16  1993/08/12  06:19:13  jraja
# Updated the email-address.
#
# Revision 1.15  1993/08/10  20:49:48  jraja
# Added agnet/SCOPTIONS.
#
# Revision 1.14  1993/08/04  07:30:51  jraja
# Updated AGNET_SRC from the GNUmakefile.
# cleaner does not delete the /bin directory itself any more.
#
# Revision 1.12  1993/08/02  13:32:56  jraja
# Added netstat to the files to moved to the bin-directory.
#
# Revision 1.11  1993/07/30  13:15:55  jraja
# Added Agnet to the distribution.
#
# Revision 1.10  1993/06/18  10:47:26  jraja
# Removed route/route.txt from the route depenencies.
#
# Revision 1.9  1993/06/04  11:51:25  jraja
# Fixes for the first release.
#
# Revision 1.7  1993/05/27  18:59:36  ppessi
# Fixed strip&bin rules.
#
# Revision 1.6  1993/05/26  23:49:28  ppessi
# Added letnet to utility set.
#
# Revision 1.5  1993/05/23  18:07:40  ppessi
# Added letnet to the official distribution.
#
# Revision 1.4  1993/05/15  13:36:58  ppessi
# Added stripping.
#
# Revision 1.3  1993/05/15  12:57:25  ppessi
# Fixed silly bugs.
#
# Revision 1.2  1993/05/15  00:53:00  ppessi
# Updated online
#
# Revision 1.1  1993/05/14  23:39:48  ppessi
# Initial revision
#

DEST = amitcp:

#
# These will be made & moved to the bin directory
#
PROGS = arp/arp ifconfig/ifconfig ping/ping inetd/inetd letnet/letnet \
	online/online online/offline route/route netstat/netstat

MAKELINK = makelink
MKDIR = makedir
MAKE = smake
RM   = delete
CP = copy dates
AUTODOC= autodoc

OPTFLAGS= Optimize Stripdebug NoDebug
DEBUGFLAGS= NoOptimize DEBUG=FULLFLUSH

DEFS="DEF=RCS_ID_C=static char *rcsid" \
      DEF=AMIGA DEF=NODB
IDIRS=  IDIR=netinclude: 
SCFLAGS= STRINGMERGE STRUCTUREEQUIVALENCE \
	 NOSTACKCHECK NOMULTIPLEINCLUDES \
	 NOERRORSOURCE NOVERSION NOERRORHIGHLIGHT \
         IGNORE=224 IGNORE=92 \
	 SMALLCODE DATA=FAR \
	 MAP MAPHUNK MAPSYMBOLS MAPLIB MAPXREFERENCE \
	 LINKEROPTIONS=plain NOICONS \
	 OPTINL OPTTIME OPTCOMP=5 OPTDEP=5 OPTRDEP=5 \
	 $(IDIRS) $(DEFS)

# Minimalistic utilites:
ARP_SRC = arp/arp.c arp/Smake.def 

IFCONFIG_SRC = ifconfig/ifconfig.c ifconfig/Smake.def 

PING_SRC = ping/ping.c ping/Smake.def 

ROUTE_SRC = route/Smakefile route/keywords.h route/route.c

# Not minimalistic:
ONLINE_SRC = online/Smakefile online/online.c

NETSTAT_SRC = netstat/netstat.rexx

LETNET_SRC = letnet/Smakefile letnet/letnet.h letnet/letnet.c letnet/sender.c 

INETD_SRC = inetd/inetd.c inetd/Smakefile

SRCS= $(ARP_SRC) $(IFCONFIG_SRC) $(PING_SRC) $(ROUTE_SRC) $(ONLINE_SRC) \
      $(NETSTAT_SRC) $(LETNET_SRC) $(INETD_SRC)

UTILDOC= netutil.doc

all: $(PROGS)

install: $(PROGS) $(UTILDOC) $(DEST)bin $(DEST)doc
	$(CP) $(PROGS) to $(DEST)bin
	$(CP) $(UTILDOC) to $(DEST)doc

netutil.doc:
	$(AUTODOC) -C -I -c $(SRCS) >$@

$(DEST)bin:
	$(MKDIR) $(DEST)bin

$(DEST)doc:
	$(MKDIR) $(DEST)doc

SCOPTIONS: Smakefile
	copy to $@ <from < 
$(OPTFLAGS) $(SCFLAGS) 
<

# smake clean debug all to make a debugging version
DEBUG:
	copy to SCOPTIONS <from < 
$(DEBUGFLAGS) $(SCFLAGS) 
<

arp/arp: $(ARP_SRC) 
	execute < <
	$(RM) $@
	cd arp
	$(MAKE) -f /AMITCP.SCmk
	cd /
<

ifconfig/ifconfig: $(IFCONFIG_SRC) 
	execute < <
	$(RM) $@
	cd ifconfig
	$(MAKE) -f /AMITCP.SCmk
	cd /
<

ping/ping: $(PING_SRC) 
	execute < <
	$(RM) $@
	cd ping
	$(MAKE) -f /AMITCP.SCmk
	cd /
<

route/route: $(ROUTE_SRC) 
	execute < <
	$(RM) $@
	cd route
	$(MAKE) #-f /AMITCP.SCmk
	cd /
<

letnet/letnet: $(LETNET_SRC) 
	execute < <
	$(RM) $@
	cd letnet
	$(MAKE) 
	cd /
<

inetd/inetd: $(INETD_SRC) 
	execute < <
	$(RM) $@
	cd inetd
	$(MAKE) 
	cd /
<

online/offline: online/online

online/online: $(ONLINE_SRC) 
	execute < <
	$(RM) $@
	cd online
	$(MAKE) #-f /AMITCP.SCmk
	cd /
<

netstat/netstat: $(NETSTAT_SRC)
	type $(NETSTAT_SRC) to $@
	protect $@ +s

clean:
	-$(RM) \#?/\#?.(o|lnk|map) SCOPTIONS

cleaner: clean
	-$(RM) $(PROGS)

