# Makefile for Smailmon. System-dependent settings are contained in a
# number of separate files, one of which gets included here. Edit the
# appropriate one of those files for your system, and set up a link to
# it with tne name "Make.os".

# Initial target checks for a Make.os file, and gives an explanatory
# message if it is absent. Unfortunately we can't then prevent Make
# from giving its own message, which is a bit untidy. Oh well, maybe
# one day I'll figure out how to do it.

all:           Make.os readspool smailmon.code

Make.os:;      @echo ""
	       @echo "*** In order to compile smailmon, you need to link one of the files"
	       @echo "*** called Make.xxx so that it is accessible by the name Make.os."
	       @echo "*** Choose the file that is appropriate to your operating system,"
	       @echo "*** and edit its contents if necessary."
	       @echo ""

# Include the system-dependent settings here

include Make.os

# Targets for auxiliary program readspool

readspool:     readspool.o
	       $(CC) -o readspool readspool.o

readspool.o:   readspool.c

# Object module list for smailmon

OBJ = regexp.o \
      StripChart.o callreadspool.o globals.o init.o log.o main.o menu.o \
      queue.o string.o strip.o text.o version.o xs.o

# Linking step; removal of version.o ensures new date each time

smailmon.code: $(OBJ)
	       $(CC) -o smailmon.code $(LFLAGS) \
                 $(OBJ) -lXaw -lXmu -lXt -lXext -lX11 $(LLIBS) -lnsl -lc 
	       chmod 755 smailmon.code
	       /bin/rm -f version.o

# Compile step for the modules

.SUFFIXES:     .o .c
.c.o:;         $(CC) -c $(CFLAGS) $(INCLUDE) $*.c

# Dependencies

StripChart.o:    StripChart.c
callreadspool.o: callreadspool.c smailmon.h
globals.o:       globals.c       smailmon.h
init.o:          init.c          smailmon.h
log.o:           log.c           smailmon.h
main.o:          main.c          smailmon.h
menu.o:          menu.c          smailmon.h
queue.o:         queue.c         smailmon.h
string.o:        string.c        smailmon.h
strip.o:         strip.c         smailmon.h
text.o:          text.c          smailmon.h
version.o:       version.c       smailmon.h
xs.o:            xs.c            smailmon.h

regexp.o:      regexp/regexp.c regexp/regexp.h regexp/regmagic.h
	       $(CC) -o regexp.o -c $(CFLAGS) $(INCLUDE) -Iregexp regexp/regexp.c
             
# Tidy-up target

clean:;        /bin/rm -f *.o

# End

