#
#   Makefile for iMatix SMT Package
#
#   Generated by Otto v2.11 from buildsmt.txt on 98/02/01, 12:43:07
#   For more info see Otto documentation at http://www.imatix.com.
#   Bug reports & questions to <ewen@imatix.com>
#   ---------------------------------------------------------------
#

#   Default values for library, executable and object extensions
#   For most unix systems EXE should be empty; OS/2 (with EMX) can use this 
#   setting if gcc is given the "-Zexe" command.
#
#   For other systems ".exe" or something similar may be required.
#
LIB     = .lib
EXE     = .exe
OBJ     = .obj

#   Configuration options
#
#   The makefile is configured to use the iMatix "c" script to compile
#   link, and archive, to enhance portability.  That script contains all 
#   compile, link, and archive options.
#
C       = c
LR      = lr
MAKEDEP = makedepend

#   Libraries -- these are the ones that should always cause a relink if they
#   are updated (the executables in a makefile will also depend on any 
#   libraries that are built in that Makefile).
#
LIBRARIES = \usr\lib\libsfl$(LIB)

#   Implicit rules
# 

#   Reset the suffixes that will be considered to just our own list.
#
#   Unix make programs use the .SUFFIXES psuedo rule for this

.SUFFIXES:
.SUFFIXES: $(EXE) $(LIB) $(OBJ) .c .d .i .l

#   Objects depend on source files with the same name; and are compiled
#   with the iMatix c script without any arguments.
#
.c$(OBJ):
	$(C) $<

#   And .c files _do_not_ depend on .l files (.l files are Libero files,
#   not lex input files as the default rules think).
#
#   The semicolon is required so GNU make will accept the rule as an override.
#
#.l.c: ;
	
#   But .d and .i files do depend on .l files (these are the ones that Libero
#   will build).
#
.l.d:
	$(LR) $<

.l.i:
	$(LR) $<

#
#   Default rule -- all depends on everything.  
#   We do this so that we can define the rule at the end.
#
all: everything

#---------------------------------------------------------------------------
libsmt$(LIB)(smtlog$(OBJ)): smtlog$(OBJ)
	$(C) -r libsmt$(LIB) smtlog$(OBJ)

libsmt$(LIB)(smtmsg$(OBJ)): smtmsg$(OBJ)
	$(C) -r libsmt$(LIB) smtmsg$(OBJ)

libsmt$(LIB)(smtecho$(OBJ)): smtecho$(OBJ)
	$(C) -r libsmt$(LIB) smtecho$(OBJ)

libsmt$(LIB)(smthttp$(OBJ)): smthttp$(OBJ)
	$(C) -r libsmt$(LIB) smthttp$(OBJ)

libsmt$(LIB)(smtoper$(OBJ)): smtoper$(OBJ)
	$(C) -r libsmt$(LIB) smtoper$(OBJ)

libsmt$(LIB)(smtsock$(OBJ)): smtsock$(OBJ)
	$(C) -r libsmt$(LIB) smtsock$(OBJ)

libsmt$(LIB)(smtslot$(OBJ)): smtslot$(OBJ)
	$(C) -r libsmt$(LIB) smtslot$(OBJ)

libsmt$(LIB)(smtsimu$(OBJ)): smtsimu$(OBJ)
	$(C) -r libsmt$(LIB) smtsimu$(OBJ)

libsmt$(LIB)(smtupmd$(OBJ)): smtupmd$(OBJ)
	$(C) -r libsmt$(LIB) smtupmd$(OBJ)

libsmt$(LIB)(smtupmc$(OBJ)): smtupmc$(OBJ)
	$(C) -r libsmt$(LIB) smtupmc$(OBJ)

libsmt$(LIB)(smttran$(OBJ)): smttran$(OBJ)
	$(C) -r libsmt$(LIB) smttran$(OBJ)

libsmt$(LIB)(smttime$(OBJ)): smttime$(OBJ)
	$(C) -r libsmt$(LIB) smttime$(OBJ)

libsmt$(LIB)(smtftpc$(OBJ)): smtftpc$(OBJ)
	$(C) -r libsmt$(LIB) smtftpc$(OBJ)

libsmt$(LIB)(smtftpd$(OBJ)): smtftpd$(OBJ)
	$(C) -r libsmt$(LIB) smtftpd$(OBJ)

libsmt$(LIB)(smtlib$(OBJ)): smtlib$(OBJ)
	$(C) -r libsmt$(LIB) smtlib$(OBJ)

libsmt$(LIB)(smtrdns$(OBJ)): smtrdns$(OBJ)
	$(C) -r libsmt$(LIB) smtrdns$(OBJ)

libsmt$(LIB)(smthlog$(OBJ)): smthlog$(OBJ)
	$(C) -r libsmt$(LIB) smthlog$(OBJ)

libsmt$(LIB)(smthttpl$(OBJ)): smthttpl$(OBJ)
	$(C) -r libsmt$(LIB) smthttpl$(OBJ)

libsmt$(LIB)(smtftpl$(OBJ)): smtftpl$(OBJ)
	$(C) -r libsmt$(LIB) smtftpl$(OBJ)

libsmt$(LIB)(smtrdnsl$(OBJ)): smtrdnsl$(OBJ)
	$(C) -r libsmt$(LIB) smtrdnsl$(OBJ)

libsmt$(LIB)(xiadmin$(OBJ)): xiadmin$(OBJ)
	$(C) -r libsmt$(LIB) xiadmin$(OBJ)

libsmt$(LIB)(xiadm00$(OBJ)): xiadm00$(OBJ)
	$(C) -r libsmt$(LIB) xiadm00$(OBJ)

libsmt$(LIB)(xierror$(OBJ)): xierror$(OBJ)
	$(C) -r libsmt$(LIB) xierror$(OBJ)

libsmt$(LIB)(xilrwp$(OBJ)): xilrwp$(OBJ)
	$(C) -r libsmt$(LIB) xilrwp$(OBJ)

libsmt$(LIB)(smttst1$(OBJ)): smttst1$(OBJ)
	$(C) -r libsmt$(LIB) smttst1$(OBJ)

libsmt$(LIB)(smttst2$(OBJ)): smttst2$(OBJ)
	$(C) -r libsmt$(LIB) smttst2$(OBJ)

libsmt$(LIB)(smttst3$(OBJ)): smttst3$(OBJ)
	$(C) -r libsmt$(LIB) smttst3$(OBJ)

LIBSMT_LIST = libsmt$(LIB)(smtlog$(OBJ)) libsmt$(LIB)(smtmsg$(OBJ)) libsmt$(LIB)(smtecho$(OBJ)) libsmt$(LIB)(smthttp$(OBJ)) libsmt$(LIB)(smtoper$(OBJ)) libsmt$(LIB)(smtsock$(OBJ)) libsmt$(LIB)(smtslot$(OBJ)) libsmt$(LIB)(smtsimu$(OBJ)) libsmt$(LIB)(smtupmd$(OBJ)) libsmt$(LIB)(smtupmc$(OBJ)) libsmt$(LIB)(smttran$(OBJ)) libsmt$(LIB)(smttime$(OBJ)) libsmt$(LIB)(smtftpc$(OBJ)) libsmt$(LIB)(smtftpd$(OBJ)) libsmt$(LIB)(smtlib$(OBJ)) libsmt$(LIB)(smtrdns$(OBJ)) libsmt$(LIB)(smthlog$(OBJ)) libsmt$(LIB)(smthttpl$(OBJ)) libsmt$(LIB)(smtftpl$(OBJ)) libsmt$(LIB)(smtrdnsl$(OBJ)) libsmt$(LIB)(xiadmin$(OBJ)) libsmt$(LIB)(xiadm00$(OBJ)) libsmt$(LIB)(xierror$(OBJ)) libsmt$(LIB)(xilrwp$(OBJ)) libsmt$(LIB)(smttst1$(OBJ)) libsmt$(LIB)(smttst2$(OBJ)) libsmt$(LIB)(smttst3$(OBJ))

# Force the library to be dependant on its bits.
#
libsmt$(LIB): $(LIBSMT_LIST)

xitami$(EXE): xitami$(OBJ) $(LIBRARIES) libsmt$(LIB)
	$(C) -L xitami

xixlat$(EXE): xixlat$(OBJ) $(LIBRARIES) libsmt$(LIB)
	$(C) -L xixlat

echocli$(EXE): echocli$(OBJ) $(LIBRARIES) libsmt$(LIB)
	$(C) -L echocli

echod$(EXE): echod$(OBJ) $(LIBRARIES) libsmt$(LIB)
	$(C) -L echod

tsttime$(EXE): tsttime$(OBJ) $(LIBRARIES) libsmt$(LIB)
	$(C) -L tsttime

tstslot$(EXE): tstslot$(OBJ) $(LIBRARIES) libsmt$(LIB)
	$(C) -L tstslot

tstrdns$(EXE): tstrdns$(OBJ) $(LIBRARIES) libsmt$(LIB)
	$(C) -L tstrdns

upmc$(EXE): upmc$(OBJ) $(LIBRARIES) libsmt$(LIB)
	$(C) -L upmc

upmd$(EXE): upmd$(OBJ) $(LIBRARIES) libsmt$(LIB)
	$(C) -L upmd

everything: libsmt$(LIB) xitami$(EXE) xixlat$(EXE) echocli$(EXE) echod$(EXE) tsttime$(EXE) tstslot$(EXE) tstrdns$(EXE) upmc$(EXE) upmd$(EXE)

SRCS = smtlog.c smtmsg.c smtecho.c smthttp.c smtoper.c smtsock.c smtslot.c smtsimu.c smtupmd.c smtupmc.c smttran.c smttime.c smtftpc.c smtftpd.c smtlib.c smtrdns.c smthlog.c smthttpl.c smtftpl.c smtrdnsl.c xiadmin.c xiadm00.c xierror.c xilrwp.c smttst1.c smttst2.c smttst3.c xitami.c xixlat.c echocli.c echod.c tsttime.c tstslot.c tstrdns.c upmc.c upmd.c

# Build dependencies, using makedepend. 
#
# Yes, this rule is very ugly.  It's an attempt to be portable
# about the way that makedepend is called, including picking up
# the flags to call the compiler with for makedepend to use.
#
# See otto.fmt for details.
#
depend:
	rm -f temp1111.cmd temp1111.xxx
	echo $(MAKEDEP) -- >temp1111.xxx
	$(C) -C | perl -ne "@a = split; shift(@a); shift(@a); print join(' ', @a), qq(\\n);" >>temp1111.xxx
	echo -- $(SRCS) >>temp1111.xxx
	perl -e "while(<>) {chop; print; print ' ';} print qq(\\n);" temp1111.xxx >temp1111.cmd
	chmod +x temp1111.cmd
	sh temp1111.cmd
