#
# Imakefile for xarchie : X11 Browser interface to Archie
#
# George Ferguson, ferguson@cs.rochester.edu, 12 Sep 1991.
#

# Where do you want this stuff? Uncomment and adjust these to change the
# destinations of "make install" and "make install.man" if the defaults
# are not satisfactory.
#BINDIR = bin
#LIBDIR = lib
#MANDIR = man/man1
##undef ManSuffix
##define ManSuffix 1

# Where is the app-defaults to C converter?
# Only needed if you change the app-defaults file Xarchie.ad and want the
# changes compiled into the program. If you don't have ad2c you should
# remove the extra clean target for Xarchie.ad.h below. If you lose
# Xarchie.ad.h and can't remake it, create it to be an empty file. Of course
# then you'll have to use the resource file at run time.
# If your ad2c came from this xarchie distribution, then use the following
# target, otherwise change it to reflect where you put ad2c.
AD2C = Ad2c/ad2c.script

# Where is the EzMenu widget package?
# You should have received a copy of the EzMenu package with this
# xarchie distribution.
EZMENUDIR = EzMenu
EZMENULIB = ezMenu$(TARGET_MACH)

# How excited are you about debugging? This can be -g, -O, or nothing.
CDEBUGFLAGS = -g

# To enable Prospero tracing (controlled by the -debug option), uncomment this
#PDEBUG = -DDEBUG

# Does your system have re_comp() and re_exec(), or regcmp() and regex()
# [in the case of A/UX]? If not, uncomment the following definitions.
#REGEXC = regex.c
#REGEXO = regex.o

##############################################################################
# Nothing to change below here...

SUBDIRS = Ad2c EzMenu
#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
MakeSubdirs($(SUBDIRS))

ASRCS = aquery.c atalloc.c dirsend.c get_pauth.c get_vdir.c \
	perrmesg.c ptalloc.c stcopy.c support.c vl_comp.c vlalloc.c
XSRCS = xarchie.c db.c actions.c types.c classnames.c procquery.c settings.c \
	ftp.c alert.c confirm.c dialog.c

AOBJS = aquery.o atalloc.o dirsend.o get_pauth.o get_vdir.o \
	perrmesg.o ptalloc.o stcopy.o support.o vl_comp.o vlalloc.o
XOBJS = xarchie.o db.o actions.o types.o classnames.o procquery.o settings.o \
	ftp.o alert.o confirm.o dialog.o

SRCS = $(ASRCS) $(XSRCS) $(REGEXC)
OBJS = $(AOBJS) $(XOBJS) $(REGEXO)

DEFINES =		-DARCHIE -DXARCHIE $(PDEBUG) -DDONT_CATCH_ERRORS
INCLUDES =		-I. -I$(EZMENUDIR)

DEPLIBS =		$(EZMENULIB) XawClientDepLibs
LOCAL_LIBRARIES =	-L$(EZMENUDIR) -l$(EZMENULIB) XawClientLibs

ComplexProgramTarget(xarchie)
InstallAppDefaults(Xarchie)

# This target allows you to install only xarchie, its resource file, and
# its man page, without installing in the SUBDIRS.
install.xarchie: xarchie Xarchie.ad xarchie.man
	$(INSTALL) -c $(INSTPGMFLAGS) xarchie $(BINDIR)
	$(INSTALL) -c $(INSTAPPFLAGS) Xarchie.ad $(XAPPLOADDIR)/Xarchie
	$(INSTALL) -c $(INSTMANFLAGS) xarchie.man $(MANDIR)/xarchie.1

# Need to tell make how to make the EzMenu library
$(EZMENULIB):
	(cd $(EZMENUDIR); echo "making all in $(CURRENT_DIR)/EzMenu..."; \
	$(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all);

#
# Make C code for fallback resources from application resource file
#
Xarchie.ad.h: Xarchie.ad
	$(AD2C) Xarchie.ad >Xarchie.ad.h

clean::
	rm -f Xarchie.ad.h

#
# Other targets for archiving purposes. Note that makekit needs the
# directory names in the MANIFEST, but tar will duplicate them if asked
# to archive both the directory and its contents, hence the awk pattern.
#
kit:
	makekit -iMANIFEST -oMANIFEST -h2

tar:
	tar cvf - `cat MANIFEST | awk 'NR>2 && $$1 != "Ad2c" \
		    	    	    	    && $$1 != "EzMenu" {print $$1}'` |\
	compress >xarchie.tar.Z
