#####################################################################
# 
# Imakefile -- Imake rules for xpts.
# Dean Collins, Tue Jun 16 09:49:26 PDT 1992
#
# Modified: Dean Collins Thu Mar 10 20:55:54 1994
# Moved customization to ../Imake.config, which each Imakefile
# will #include.  This eliminates the need to set CC within
# each one.
#
######################################################################
#
# Copyright (c) 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"


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

        PTS_TOP = ..
           SRCS = xpts.c activate.c popup.c select.c misc.c xutil.c \
			signal.c 
           OBJS = xpts.o activate.o popup.o select.o misc.o xutil.o \
			signal.o
           HDRS = activate.h copyright.h defines.h macros.h main.h \
			misc.h popup.h resources.h select.h signal.h \
			types.h xutil.h xpts.h
       PTS_LIBS = -lcloud -lzdbm -lconfig -lutil
    PTS_DEPLIBS = $(PTS_TOP)/neb_cld/libcloud.a $(PTS_TOP)/config/libconfig.a \
		  $(PTS_TOP)/zdbm/libzdbm.a $(PTS_TOP)/util/libutil.a
    PTS_LIBDIRS = -L$(PTS_TOP)/neb_cld -L$(PTS_TOP)/zdbm -L$(PTS_TOP)/config \
		  -L$(PTS_TOP)/util
LOCAL_LIBRARIES = $(PTS_LIBDIRS) $(PTS_LIBS) XawClientLibs $(MISSING_LIBS)
        DEPLIBS = $(PTS_DEPLIBS) XawClientDepLibs
       PROGRAMS = xpts
       INCLUDES = -I$(PTS_TOP) -I$(PTS_TOP)/util -I$(PTS_TOP)/zdbm \
		  -I$(PTS_TOP)/neb_cld -I$(PTS_TOP)/config -I$(PTS_TOP)
       LIBFILES = Xpts.ad xpts.help xptssysop.help
         TARCMD = tar cvf 
        TARFILE = xpts.tar
       ALLFILES = $(SRCS) $(PROGRAMS) $(LIBFILES) Imakefile Makefile \
		  xpts.xbm $(HDRS) doc
   INSTAPPFLAGS = -m 0644 -o $(OWNER)
   INSTPGMFLAGS = -m 4755 -o $(OWNER)
   INSTDATFLAGS = -m 0644 -o $(OWNER)
   INSTMANFLAGS = -m 0644 -o $(OWNER)
   XPTS_MAN_SRC = ../doc/Manual/xpts.man

all:: resources.h Xpts.ad xpts
depend:: resources.h

NormalProgramTarget(xpts,$(OBJS),$(PTSLIBS),$(LOCAL_LIBRARIES),/**/)
LintTarget()
DependTarget()
InstallProgram(xpts,$(BINDIR))

# This won't work until I define (and start to us) PTSBINDIR.
# Right now I'm over-riding BINDIR with /usr/local/pts/bin.
#install::
#	$(LN) $(PTSBINDIR)/xpts $(BINDIR)/xpts

XCOMM Manpage is installed from ../doc/Manual
install.man::

InstallNonExec(xpts.help,$(CFGDIR)/xpts.help)
InstallNonExec(xptssysop.help,$(CFGDIR)/xptssysop.help)
InstallNonExec(xpts.xbm,$(CFGDIR)/xpts.xbm)

# I've disabled this one, since it breaks on my Linux box.
# If there is an app-defaults file all the resources will be set
# to their default vaules, which is very undesirable.
# Soo....I'm skipping it.  It might actually work on your system.
#	Install Non Exec(Xpts.ad,$(X_LIB_DIR)/app-defaults/Xpts)
#


#Strip out all the underlining, bolding, etc.  From a formatted manpage
#and use to create the help page.
#
#Could also do this by setting your TERM to "unknown" or "dumb" and
#leaving out the sed filter.  That would probably be better, since
#this assumes some things about your terminal type.
xpts.help: $(XPTS_MAN_SRC)
	nroff -man $(XPTS_MAN_SRC) |sed -e '1,$$s/.\'`echo '\b'`'//g' -e '1,$$s/'`echo '\015'`'.//g' >xpts.help
#	groff -Tascii -man $(XPTS_MAN_SRC) |sed -e '1,$$s/.\'`echo '\b'`'//g' -e '1,$$s/'`echo '\015'`'.//g' >xpts.help
#	(TERM=unknown; nroff -man $(XPTS_MAN_SRC) >xpts.help)

#Since xpts_sysop.help is being replaced by xptssysop.help in this
#version (so the name is 14 or less characters long), ensure that
#the old version is is removed.
install::
	$(RM) $(LIBDIR)/xpts_sysop.help

uninstall::
	$(RM) $(LIBDIR)/xpts.help $(LIBDIR)/xptssysop.help \
		$(INCROOT)/X11/bitmaps/xpts.xbm \
		$(XAPPLOADDIR)/Xpts $(BINDIR)/xpts
	@echo "uninstall in $(CURRENT_DIR) done"


# Create an app-defaults file from the resources.h file.  This should
# not be needed by anyone other than the software development team.
# Xpts should be shipped with an Xpts.ad file that corresponds to the
# resources.h file.  Do your customizations in Xpts.ad (or, really,
# /usr/lib/X11/app-defaults/Xpts) and you'll never need this.
# If you DO change resources.h (don't!) this may or may not work.  
# It's a fairly gross hack.
#Xpts.ad: resources.h
#	sed 	-e '1,$$s/[\/][\*]/!#/g' \
#		-e '1,$$s/^"//' \
#		-e '1,$$s/",//g' \
#		-e '1,$$s/ \* /!# /g' \
#		-e '1,$$s/ \*[	]/!#	/g' \
#		-e '1,$$s/ \*$$/!# /g' \
#		-e '1,$$s/[ 	]*[*][/]$$//g' \
#		-e '1,$$s/[:cntrl:]9//g' \
#		-e '1,$$s/resources[.]h/Xpts.ad/g' resources.h | \
#	grep -v 'fallback_resources\[\]' | \
#	grep -v '^NULL' | \
#	grep -v '^} ;' | \
#	grep -v '!#$$' > Xpts.ad


Xpts.ad: Xpts.ad.src
	$(RM) $@
	sed -f ../pts.sed < $< > $@

resources.h: resources.h.src
	$(RM) $@
	sed -f ../pts.sed < $< > $@

clean::
	$(RM) resources.h Xpts.ad
