# $Id: Smakefile,v 1.10 1993/10/18 15:45:30 ppessi Exp ppessi $
#
# Smakefile for Napsaterm
# 
# Copyright  1993 AmiTCP/IP Group, <amitcp-group@hut.fi>,
#	           Helsinki University of Technology, Finland.
#
# Created      : Mon Mar 29 06:32:31 1993 ppessi
# Last modified: Wed Nov 10 04:42:44 1993 ppessi
#
# Based on original Makefile for Niftyterm by Chris Newman and Todd Williamson
#

PROG=  napsaterm
VERS= 2

# For socket version
SRCS=  napsaterm.c niftyterm.c rcmd.c niftyprofile.c misc.c emulate.c display.c \
       amigadisplay.c beep.c clip.c keymap.c national.c 
OBJS=  napsaterm.o niftyterm.o rcmd.o niftyprofile.o misc.o emulate.o display.o \
       amigadisplay.o beep.o clip.o keymap.o national.o 
DOCS=  doc/napsaterm.doc doc/niftyterm-1.2.doc
# Uncomment dnetlibs if you are using DNET
LIBS=  #lib dnet:lib/sas_dnet.lib lib dnet:lib/sas_sup.lib 

HEADERS= display.h nifty.h amiga.h dispmacros.h niftyprofile.h 
         rlogin.h nio.h

CC=      sc
LD=      slink
MAKE=    smake
TAGS=    etags
RM=      delete quiet
MKDIR=   makedir
INSTALL= copy nopro dates all
BUMPREV= BumpRev

DEST= AmiTCP:

CONFIG= DEF=USE_FIONBIO=1 DEF=USE_SERIAL=1 DEF=USE_STDIO=1 DEF=USE_DNET=0 \
        DEF=USE_RLOGIN=1 

OPTFLAGS= Optimize Stripdebug NoDebug
DEBUGFLAGS= NoOptimize DEBUG=FULLFLUSH
CFLAGS= $(OPTFLAGS)

GST=     napsa.gst

DEFS=    $(CONFIG) "DEF=RCS_ID_C=static char *rcsid=" 
# Include directories for DNet are commented out (they are not included)
IDIRS=IDIR=netinclude: #IDIR=suplib:include/ IDIR=dnet:include/ 
SCOPTIONS= Data=Automatic NoStackCheck StringMerge StructureEquivalence \
	 GST=$(GST) NoMultipleIncludes  \
	 Map Maphunk Mapsymbols Maplib Mapxreference Noicons \
	 Noversion Noerrorhighlight Onerror=Continue Batch \
	 Optimizertime Optimizerinlinelocal \
	 Ign=161 Ign=100 Ign=88 Ign=62 \
	 $(DEFS) $(IDIRS) 

all: $(PROG) mymap

$(PROG): SCOPTIONS $(GST) $(OBJS)
	$(CC) LINK TO $@ OBJ $(OBJS) BATCH $(LIBS) $(CFLAGS)

mymap: mymap.c
	sc RESOPT LINK TO $@ BATCH NOSTARTUP STRIPDEBUG SMALLDATA NOICONS \
	STRINGMERGE DATA=FAR IGN 62,74 $<

debug:
	$(MAKE) "CFLAGS=$(DEBUGFLAGS)" "LIBS=$(DEBUGLIBS)" $(PROG)

.c.o:
	-@$(RM) $*.o  > nil:
	$(CC) $(CFLAGS) $*.c

$(PROG).o: $(SRCS) $(HEADERS)
	$(BUMPREV) $(VERS) $(PROG)_rev
	-@$(RM) $(PROG).o > nil:
	$(CC) $(CFLAGS) $ $(PROG).c

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

TAGS: $(SRCS) $(HEADERS)
	etags $(SRCS) $(HEADERS)

protos:
	$(CC) NOGST $(CFLAGS) $(SRCS) GENPROTOS

$(GST): 
	gst `cd`/$@ unload
	-@$(RM) $@ >nil:
	sc NOOBJNAME NOGST MAKEGST=$@ gst.c

#
# Destination directories 
#
DESTDIRS= $(DEST)appl/napsaterm/fonts $(DEST)bin $(DEST)devs/keymaps \
	$(DEST)doc $(DEST)db
$(DEST)appl:
	-$(MKDIR) $@
$(DEST)appl/napsaterm: $(DEST)appl
	-$(MKDIR) $@
$(DEST)appl/napsaterm/fonts: $(DEST)appl/napsaterm
	-$(MKDIR) $@
$(DEST)bin:
	-$(MKDIR) $@
$(DEST)devs:
	-$(MKDIR) $@
$(DEST)devs/keymaps: $(DEST)devs
	-$(MKDIR) $@
$(DEST)doc:
	-$(MKDIR) $@
$(DEST)db:
	-$(MKDIR) $@
#
# Install to $(DEST) (for AmiTCP/IP release archive)
# 
install: all $(DESTDIRS)
	#
	# Install napsaterm binary
	#
	$(LD) napsaterm TO $(DEST)bin/NapsaTerm  Stripdebug batch noicons
	#
	# Install mymap
	#
	$(INSTALL) mymap $(DEST)devs/keymaps/mymap
	#
	# Install fonts
	#
	$(INSTALL) fonts $(DEST)appl/napsaterm/fonts
	#
	# Install Docs
	#
	$(INSTALL) $(DOCS) $(DEST)doc
	#
	# Install miscs
	#
	$(INSTALL) napsaprefs $(DEST)db
	
clean:
	-$(RM) \#?.(o|gst|lnk|map) SCOPTIONS

#
# File dependences
#
misc.o : 	nifty.h misc.c
niftyterm.o: 	nifty.h display.h amiga.h rlogin.h niftyterm.c nio.h
rcmd.o:         nifty.h amiga.h rlogin.h rcmd.c
emulate.o: 	nifty.h display.h emulate.c
display.o: 	nifty.h display.h dispmacros.h display.c
wmdisplay.o: 	nifty.h display.h dispmacros.h wmdisplay.c
beep.o:		amiga.h beep.c
clip.o:		amiga.h clip.c
amigadisplay.o: amiga.h nifty.h display.h dispmacros.h niftyprofile.h \
	        national.h amigadisplay.c nio.h
national.o:	amiga.h nifty.h	national.h national.c
napsa.gst:      amiga.h nifty.h display.h dispmacros.h niftyprofile.h \
		national.h rlogin.h nio.h
niftyprofile.o: niftyprofile.c niftyprofile.h nifty.h

