#include <psf_pre.imake>
#include <env_variables.imake>
#include <psf_prototype.imake>
#include <psf_exits.imake>
#include <psf_fopen.imake>
#include <psf_malloc.imake>
#include <psf_standards.imake>

DEFINES = -DDEFPSFBINDIR=\"$(PSFBINDIR)/\" $(PSF_INC_DEFINES)

#ifndef LinuxArchitecture
LDLIBS = -ll
#else
XCOMM make flex lex compatible
LFLAGS = -l $(LFLAGS)
#endif

BUGDIR = /usr/titools/psf/doc/bugs/unsolved

OBJ = main.o args.o auxfunc.o check.o imports.o itil.o libs.o mtil.o set.o \
	split.o til.o tsort.o wait.o
HDR = defaults.h psf.h version.h prototypes.h

OBJS = $(OBJ) scan.o $(PSF_INC_OBJ)

SRC = $(OBJ:.o=.c)
SRCS = $(OBJS:.o=.c)
SOURCE = $(SRC) scan.l

depend:: scan.c

ComplexProgramTarget(psf)

psf.man: psf.man.tmpl
	sed -e s+@DEFPSFBINDIR@+$(BINDIR)+g				  \
	-e s+@BUGDIR@+$(BUGDIR)+g					  \
	-e s+@BUGS@+`if [ -d $(BUGDIR) ]; then echo 1; else echo 0; fi`+g \
	    	< psf.man.tmpl > psf.man

scan.c: scan.l
		$(LEX) -t scan.l >scan.c

clean::
	$(RM) scan.c psf.man

ARCHIVE = Imakefile $(HDR) $(SOURCE) psf.man.tmpl psfDOT.c psfGP.c psfdaV.c

rcsdiff:
	rcsdiff -c $(ARCHIVE) > src.diffs

rcsci:
	ci -f -m"." -t/dev/null $(ARCHIVE)

rcsco:
	co -l $(ARCHIVE)

#include <psf_post.imake>
