# smakefile for pager-support.library
# Copyright  1993 by Christopher A. Wichura (caw@miroc.chi.il.us)
# All rights reserved.

TARGETBASE = pager-support-debug
DEBUGVER = 1	# never use anything other than 0 or 1 for DEBUGVER!

HDR = pager-lib.gst
CFLAGS = nostkchk strmerge parms=reg gstimm utillib
LFLAGS = smallcode smalldata

TARGET = $(TARGETBASE).library
MAPFILE = $(TARGETBASE).map

OFILE = .o$(DEBUGVER)

OBJ2 = LibHandler$(OFILE) handleResource$(OFILE) log$(OFILE) lockFile$(OFILE) services$(OFILE) aliases$(OFILE) sequence$(OFILE) spool$(OFILE) config$(OFILE)
OBJS = LibHead$(OFILE) $(OBJ2)

LIBS = LIB:amiga.lib LIB:sc.lib LIB:debug.lib

# we use two default rules for compiling the c files.  this makes it easier
# to have separate compiler options for the debug and non-debug versions
# of the library.

.c.o0:
	sc $(CFLAGS) gst=$(HDR) optimize objname $*.o0 $*

.c.o1:
	Indent $*.c
	sc $(CFLAGS) gst=$(HDR) debug=symbolflush objname $*.o1 $*

$(TARGET): $(OBJS) smakefile
	slink with lib:utillib.with <with < (withfile.lnk)
FROM $(OBJS)
TO $(TARGET)
LIB $(LIBS)
$(LFLAGS)
ADDSYM
MAP $(MAPFILE) fhlsx plain
<

# build and install a release version of the library
release:
	smake pragmas
	smake
	smake install
	smake TARGETBASE=pager-support DEBUGVER=0
	smake TARGETBASE=pager-support DEBUGVER=0 install

# install the library in pager:libs.  we strip the debug info out of it when
# we do this.
install:
	slink from $(TARGET) to pager:libs/$(TARGET) stripdebug noicons
	protect pager:libs/$(TARGET) -e
	removelib $(TARGET)

# delete object files, etc.
clean:
	delete $(HDR) \#?$(OFILE) \#?.c! $(MAPFILE)

# build the pragmas file.
pragmas:
	fd2pragma pager-support_lib.fd /include/pragmas/pager-support_lib.h
	rx MakeTagcall /include/pragmas/pager-support_lib.h

# build the gst header file
$(HDR): GSTMaker.c GSTMaker.h smakefile
	sc $(CFLAGS) noobjname makegst=$(HDR) GSTMaker

# we have explicit entries for the two versions of LibHead (debug and
# non-debug) we make.  the non-debug will automatically update the
# revision number when it is called while the debug version does not
# increment the revision number

LibHead.o0: LibHead.a version.i $(OBJ2)
	UpAVersion version.i
	hx68 from $*.a to $*.o0 incdir INCLUDE: addsym debug define BUILD_DEBUG=0

LibHead.o1: LibHead.a version.i $(OBJ2)
	hx68 from $*.a to $*.o1 incdir INCLUDE: addsym debug define BUILD_DEBUG=1

# dependancies for the various source files

LibHandler$(OFILE): LibHandler.c $(HDR)

handleResource$(OFILE): handleResource.c $(HDR) memory.h

log$(OFILE): log.c $(HDR)

lockFile$(OFILE): lockFile.c $(HDR) memory.h

services$(OFILE): services.c $(HDR) memory.h

aliases$(OFILE): aliases.c $(HDR) memory.h

sequence$(OFILE): sequence.c $(HDR)

spool$(OFILE): spool.c $(HDR) memory.h

config$(OFILE): config.c $(HDR) memory.h

