# $Id: Smakefile,v 1.3 1994/03/10 17:40:49 jraja Exp $
#
# Smakefile for AmiTCP/IP development tools
#
# Copyright  1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
#	           Helsinki University of Technology, Finland.
#                  All rights reserved.
#
# Created      : Fri Feb 25 21:59:47 1994 ppessi
# Last modified: Wed Mar  9 10:06:29 1994 jraja
#
# $Log: Smakefile,v $
# Revision 1.3  1994/03/10  17:40:49  jraja
# Changed rcsrev to be compiled with its own Smakefile, and made its
# compilation to be done first, since other makes depend on it.
#
# Revision 1.2  1994/03/09  08:10:02  jraja
# Added cpp and rpcgen
#
# Revision 1.1  1994/03/07  23:01:00  ppessi
# Initial revision
#
#

DEST = AmiTCP:

#
# These will be made & moved to the bin directory
# rcsrev is made first
#
CPROGS= rcsrev/rcsrev cpp/cpp rpcgen/rpcgen
	
PROGS= $(CPROGS) 

SRC_CPP= cpp/Smake.def cpp/cpp.c cpp/cpp.h cpp/cpp1.c cpp/cpp2.c cpp/cpp3.c \
	cpp/cpp4.c cpp/cpp5.c cpp/cpp6.c cpp/cppdef.h cpp/protos.h cpp/test.c \
	cpp/org/contents cpp/org/cpp.mem cpp/org/cpp.rno cpp/org/make.boot \
	cpp/org/makefile.txt cpp/org/readme cpp/org/readme.txt

SRC_RCSREV= rcsrev/Smakefile rcsrev/rcsrev.c

SRC_RPCGEN= rpcgen/ChangeLog rpcgen/Smake.def rpcgen/protos.h \
	rpcgen/rpc_clntout.c rpcgen/rpc_cout.c rpcgen/rpc_hout.c \
	rpcgen/rpc_main.c rpcgen/rpc_parse.c rpcgen/rpc_parse.h \
	rpcgen/rpc_sample.c rpcgen/rpc_scan.c rpcgen/rpc_scan.h \
	rpcgen/rpc_svcout.c rpcgen/rpc_tblout.c rpcgen/rpc_util.c \
	rpcgen/rpc_util.h rpcgen/rpcgen.c rpcgen/todo \
	rpcgen/amiga/popen.c rpcgen/amiga/popen.h

SRCS= $(SRC_CPP) $(SRC_RCSREV) $(SRC_RPCGEN)

DOCSRC= cpp/cpp.c rcsrev/rcsrev.c rpcgen/rpcgen.c

DOCS= devtools.doc

MAKELINK = makelink
MKDIR = makedir
MAKE = smake
RM   = delete
CP = copy dates
AUTODOC= autodoc -C -I -c -t8

all: Smake-in-dir $(PROGS)

install: Smake-in-dir $(PROGS) $(DOCS) $(DEST)bin $(DEST)doc
	$(CP) $(PROGS) to $(DEST)bin
	$(CP) $(DOCS) to $(DEST)doc

$(DOCS): $(DOCSRC)
	$(AUTODOC) $(DOCSRC) >$@
$(DEST)bin:
	$(MKDIR) $(DEST)bin
$(DEST)doc:
	$(MKDIR) $(DEST)doc

Smake-in-dir: Smakefile
	copy to $@ <from < 
.key WHAT/A,DEST/K,INSTALL/S,TARGET/K/F
.bra {
.ket }
echo SMaking {WHAT}
cd {WHAT}
smake -k -f netinclude:Smake.template DEST={DEST} {TARGET}  {INSTALL}
cd /
<
	protect $@ +es

cpp/cpp: $(SRC_CPP) 
	Smake-in-dir cpp

rcsrev/rcsrev: $(SRC_RCSREV) # this has own makefile
	execute < <
	echo making rcsrev
	cd rcsrev
	$(MAKE) -k  DEST=$(DEST)
	cd /
<
#	Smake-in-dir rcsrev

rpcgen/rpcgen: $(SRC_RPCGEN) 
	Smake-in-dir rpcgen

clean:
	Smake-in-dir cpp TARGET CLEAN
	Smake-in-dir rcsrev TARGET CLEAN
	Smake-in-dir rpcgen TARGET CLEAN

cleaner: clean
	-$(RM) $(CPROGS) Smake-in-dir
