######################################################################
# 
# Imakefile -- Imake rules for the WAIS/HTML portion of PTS.
# Dean Collins, Thu Jul 30 08:33:47 PDT 1995
#
######################################################################
#
# Copyright (c) 1995,1994 Dean Collins.
# Copyright (c) 1992 University of Idaho, Moscow, Idaho.
# 
# Permission to use, copy, modify, and distribute this software and its
# documentation free of charge for any purpose is hereby granted without
# fee, provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of the University of Idaho
# not be used in advertising or publicity pertaining to distribution of
# the software without specific, written prior permission.  The University
# of Idaho makes no representations about the suitability of this software
# for any purpose.  It is provided "as is" without express or implied warranty.
# 
# THE UNIVERSITY OF IDAHO DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
# IN NO EVENT SHALL THE UNIVERSITY OF IDAHO BE LIABLE FOR ANY SPECIAL,
# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
######################################################################

######################################################################
#  YOU SHOULDN'T NEED TO MODIFY ANYTHING IN THIS FILE.
#  All customization is now done in ../Imake.config.
######################################################################


#include "../Imake.config"

#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'

SUBDIRS = images

MakeSubdirs($(SUBDIRS))
/*DependSubdirs($(SUBDIRS))*/
CleanSubdirs($(SUBDIRS))
/*LintSubdirs($(SUBDIRS))*/


#----------------------------------------------------------------------

#CCOPTIONS = -DBSD -UXPTS $(INCLUDES)

           SRCS = web.c pts-post.c pts-report.c util.c pts-repagain.c pts-repagain2.c pts-append.c pts-append2.c html.c fmtprobhtml.c
           OBJS = web.o pts-post.o pts-report.o util.o pts-repagain.o pts-repagain2.o pts-append.o pts-append2.o html.o fmtprobhtml.o
           HDRS = 
       PROGRAMS = web pts-post pts-report pts-repagain pts-repagain2 pts-append pts-append2
       INCLUDES = -I.. -I../util -I../zdbm -I../neb_cld -I../config -I..
LOCAL_LIBRARIES = -L../neb_cld -lcloud -L../config -lconfig  \
		  -L../zdbm -lzdbm -L../util -lutil $(MISSING_LIBS)
        PTSLIBS = ../neb_cld/libcloud.a ../config/libconfig.a \
		  ../zdbm/libzdbm.a ../util/libutil.a

#This is 0755 rather than 4755 since we don't want ALL of them set-uid.
#We can set specific ones later...
   INSTPGMFLAGS = -m 0755 -o $(OWNER)
   INSTBINFLAGS = -m 0755 -o $(OWNER)
   INSTDATFLAGS = -m 0644 -o $(OWNER)


AllTarget($(PROGRAMS))
/*ComplexProgramTarget(web)*/
NormalProgramTarget(web,web.o util.o html.o fmtprobhtml.o,$(PTSLIBS),$(LOCAL_LIBRARIES),/**/)
NormalProgramTarget(pts-post,pts-post.o util.o html.o,$(PTSLIBS),$(LOCAL_LIBRARIES),/**/)
NormalProgramTarget(pts-report,pts-report.o util.o html.o,$(PTSLIBS),$(LOCAL_LIBRARIES),/**/)
NormalProgramTarget(pts-repagain,pts-repagain.o util.o html.o,$(PTSLIBS),$(LOCAL_LIBRARIES),/**/)
NormalProgramTarget(pts-repagain2,pts-repagain2.o util.o html.o,$(PTSLIBS),$(LOCAL_LIBRARIES),/**/)
NormalProgramTarget(pts-append,pts-append.o util.o html.o,$(PTSLIBS),$(LOCAL_LIBRARIES),/**/)
NormalProgramTarget(pts-append2,pts-append2.o util.o html.o,$(PTSLIBS),$(LOCAL_LIBRARIES),/**/)
LintTarget()


DependTarget()
InstallProgram(web,$(BINDIR))
InstallProgram(pts-post,$(CGIBIN_DIR))
InstallProgram(pts-report,$(CGIBIN_DIR))
InstallProgram(pts-repagain,$(CGIBIN_DIR))
InstallProgram(pts-repagain2,$(CGIBIN_DIR))
InstallProgram(pts-append,$(CGIBIN_DIR))
InstallProgram(pts-append2,$(CGIBIN_DIR))
InstallScript(pts-wais.pl,$(CGIBIN_DIR))
InstallNonExec(pts.html,$(HTDOCS_DIR)/pts.html)

install::
	chmod 4755 $(CGIBIN_DIR)/pts-report \
		$(CGIBIN_DIR)/pts-repagain2 \
		$(CGIBIN_DIR)/pts-append2


uninstall::
	$(RM) $(BINDIR)/web
	$(RM) $(CGIBIN_DIR)/pts-post
	$(RM) $(CGIBIN_DIR)/pts-report
	$(RM) $(CGIBIN_DIR)/pts-repagain
	$(RM) $(CGIBIN_DIR)/pts-repagain2
	$(RM) $(CGIBIN_DIR)/pts-append
	$(RM) $(CGIBIN_DIR)/pts-append2
	$(RM) $(CGIBIN_DIR)/pts-wais.pl
	$(RM) $(HTDOCS_DIR)/pts.html
	@echo "uninstall in $(CURRENT_DIR) done"

# pts-post.pl is not currently used
pts-post.pl: pts-post.pl.src
	sed -f ../pts.sed < $< > $@

all::pts-wais.pl.script
pts-wais.pl.script: pts-wais.pl.src 
	sed -f ../pts.sed < $< > $@

all::pts.html
pts.html: pts.html.src 
	sed -f ../pts.sed < $< > $@

all::build_web
build_web: build_web.src 
	sed -f ../pts.sed < $< > $@

clean:: 
	$(RM) pts-post.pl pts.html pts-wais.pl.script build_web
