#  Make WWW under unix for a.n.other unix system (bsd)
#   Use this as a template

# For W3 distribution, machine type for subdirectories
WWW_MACH	= Implementation
WWWINC		= $(top_srcdir)/WWW/Library/Implementation

ECHO =		@DONT_ECHO_CC@
LFLAGS =

prefix		= @prefix@
exec_prefix	= @exec_prefix@
top_srcdir	= @top_srcdir@
srcdir		= @srcdir@
VPATH		= $(srcdir)

LYFLAGS		= # FIXME: set in parent makefile

CC		= @CC@
DEFS		= @DEFS@
CPPFLAGS	= @CPPFLAGS@
_O		= .o

INTLDIR_CPPFLAGS= @INTLDIR_CPPFLAGS@ -I$(top_srcdir)/intl

CPPOPTS		= $(DEFS) $(CPPFLAGS) $(LYFLAGS) \
		-I../../.. \
		-I../../../src \
		-I$(top_srcdir) \
		-I$(top_srcdir)/src \
		$(INTLDIR_CPPFLAGS) -I$(WWWINC)

LY_CFLAGS	= @CFLAGS@
CFLAGS		= $(CPPOPTS) $(LY_CFLAGS)
LINT		= @LINT@

# Directory for installed binary:
BINDIR		= @bindir@

# Where is the W3 object library to be installed (not normally done)?
#_________________ OK if normal W3 distribution
# Where is the WWW source root?
WWW = $(top_srcdir)/WWW

#  Where should temporary (object) files go?
WTMP = ../..

# (Version.make)
VC = 2.14
#______________________________________________________________________
# (originally CommonMakefile)

#  If this env var is set to something else Some makes will use that instead
SHELL = @CONFIG_SHELL@

RANLIB	= @RANLIB@

#	.h files are distributed but originally are made from the
#	self-documenting hypertext files.

.SUFFIXES: .h .html
.html.h:
#	- chmod +w $*.h
	www -w90 -na -to text/x-c $*.html > $*.h
#	chmod -w $*.h

# If this is actually run in a subdirectory,
#
# WWW = ../../..
# WWW = ../..	For [cernlib] build in this directory

CMN = $(WWW)/Library/Implementation/

# Where shall we put the objects and built library?

LOB = .

# Only needed if HTWAIS.c is to be compiled. Put into your Makefile.include
#  uncomment these and fill in WAISINC for adding direct wais access
#  to Lynx.
#HTWAIS_c = $(CMN)/HTWAIS.c
#HTWAIS_o = $(LOB)/HTWAIS$(_O)
#WAIS = YES
#WAISINC = -I../../../../freeWAIS-0.202/ir
#WAISCFLAGS = -DDIRECT_WAIS
#

# XMOsAIC hack is only for server to cope with xmosaic kludge for mmedia
#
# add -DNEW_GATEWAY here for the new gateway config stuff
CFLAGS2 = $(CFLAGS) $(LYFLAGS) $(WAISCFLAGS) -I$(CMN) -DXMOSAIC_HACK -DACCESS_AUTH

COMPILE	= $(ECHO) $(CC) $(CFLAGS2) -c

COMMON = $(LOB)/HTParse$(_O) $(LOB)/HTAccess$(_O) $(LOB)/HTTP$(_O) \
	$(LOB)/HTFile$(_O)	$(LOB)/HTBTree$(_O) $(LOB)/HTFTP$(_O) $(LOB)/HTTCP$(_O) \
	$(LOB)/SGML$(_O) $(LOB)/HTMLDTD$(_O) $(LOB)/HTChunk$(_O) \
	$(LOB)/HTPlain$(_O) \
	$(LOB)/HTMLGen$(_O) \
	$(LOB)/HTAtom$(_O) $(LOB)/HTAnchor$(_O) $(LOB)/HTStyle$(_O) \
	$(LOB)/HTList$(_O) $(LOB)/HTString$(_O) \
	$(LOB)/HTRules$(_O) $(LOB)/HTFormat$(_O)  $(LOB)/HTMIME$(_O) \
	$(LOB)/HTNews$(_O)  $(LOB)/HTGopher$(_O) \
	$(LOB)/HTTelnet$(_O) $(LOB)/HTFinger$(_O) $(LOB)/HTWSRC$(_O) $(HTWAIS_o) \
	$(LOB)/HTAAUtil$(_O) $(LOB)/HTAABrow$(_O) \
	$(LOB)/HTGroup$(_O) \
	$(LOB)/HTAAProt$(_O) \
	$(LOB)/HTAssoc$(_O)  $(LOB)/HTLex$(_O)    $(LOB)/HTUU$(_O) \
	$(LOB)/HTDOS$(_O)

CFILES = $(CMN)HTParse.c $(CMN)HTAccess.c $(CMN)HTTP.c $(CMN)HTFile.c \
	$(CMN)HTBTree.c \
	$(CMN)HTFTP.c	$(CMN)HTTCP.c	  $(CMN)SGML.c \
	$(CMN)HTMLDTD.c \
	$(CMN)HTPlain.c	\
	$(CMN)HTMLGen.c \
	$(CMN)HTChunk.c $(CMN)HTAtom.c    $(CMN)HTAnchor.c $(CMN)HTStyle.c \
	$(CMN)HTList.c  $(CMN)HTString.c  $(CMN)HTRules.c \
	$(CMN)HTFormat.c $(CMN)HTMIME.c \
	$(CMN)HTNews.c  $(CMN)HTGopher.c  $(CMN)HTTelnet.c \
	$(CMN)HTFinger.c $(HTWAIS_c)	  $(CMN)HTWSRC.c \
	$(CMN)HTAABrow.c \
	$(CMN)HTGroup.c  \
	$(CMN)HTAAProt.c \
	$(CMN)HTAssoc.c  $(CMN)HTLex.c    $(CMN)HTUU.c

HFILES = $(CMN)HTParse.h $(CMN)HTAccess.h $(CMN)HTTP.h $(CMN)HTFile.h \
	$(CMN)HTBTree.h $(CMN)HTFTP.h $(CMN)HTTCP.h \
	$(CMN)SGML.h $(CMN)HTML.h $(CMN)HTMLDTD.h $(CMN)HTChunk.h \
	$(CMN)HTPlain.h	\
	$(CMN)HTFWriter.h	$(CMN)HTMLGen.h \
	$(CMN)HTStream.h \
	$(CMN)HTAtom.h $(CMN)HTAnchor.h $(CMN)HTStyle.h \
	$(CMN)HTList.h \
	$(CMN)HTString.h $(CMN)HTRules.h \
	$(CMN)HTFormat.h $(CMN)HTInit.h \
	$(CMN)HTMIME.h $(CMN)HTNews.h \
	$(CMN)HTGopher.h \
	$(CMN)HTUtils.h $(CMN)www_tcp.h $(CMN)HText.h \
	$(CMN)HTTelnet.h $(CMN)HTFinger.h \
	$(CMN)HTWAIS.h  $(CMN)HTWSRC.h \
	$(CMN)HTAABrow.h \
	$(CMN)HTGroup.h  \
	$(CMN)HTAAProt.h \
	$(CMN)HTAssoc.h  $(CMN)HTLex.h    $(CMN)HTUU.h

all : $(LOB)/libwww.a

lint:
	$(LINT) $(LINTOPTS) $(CPPOPTS) $(srcdir)/../Implementation/*.c  > ../../../lint.libwww

.SUFFIXES: $(_O) .i .h .html

.c$(_O):
@RULE_CC@
	@ECHO_CC@$(CC) $(CPPOPTS) $(CFLAGS) -c $(srcdir)/$*.c

.c.i:
@RULE_CC@
	@ECHO_CC@$(CPP) -C $(CPPOPTS) $(srcdir)/$*.c >$@

depend :
	makedepend -fmakefile -- $(CFLAGS) -- $(CFILES)

#	Library
#
#  On SGI, ranlib is unnecessary and does not exist so we ignore errors
# for that step
$(LOB)/libwww.a : $(COMMON)
	ar r $(LOB)/libwww.a $(COMMON)
	-$(RANLIB) $(LOB)/libwww.a

#	Clean up everything generatable except final products
clean :
	rm -f core *.core *.leaks *.[oi] *.bak tags TAGS
	rm $(LOB)/*$(_O)

#			Common code
#			-----------

$(LOB)/HTList$(_O) : $(OE) $(CMN)HTList.c $(CMN)HTUtils.h $(CMN)HTList.h
	$(COMPILE) $(CMN)HTList.c

$(LOB)/HTAnchor$(_O) : $(OE) $(CMN)HTAnchor.c $(CMN)HTUtils.h $(CMN)HTList.h
	$(COMPILE) $(CMN)HTAnchor.c

$(LOB)/HTFormat$(_O) : $(OE) $(CMN)HTFormat.c $(CMN)HTUtils.h $(CMN)HTList.h
	$(COMPILE) $(CMN)HTFormat.c

$(LOB)/HTMIME$(_O) : $(OE) $(CMN)HTMIME.c $(CMN)HTUtils.h $(CMN)HTList.h
	$(COMPILE) $(CMN)HTMIME.c

$(LOB)/HTNews$(_O) : $(OE) $(CMN)HTNews.c $(CMN)HTUtils.h $(CMN)HTList.h\
	 $(CMN)HTMLDTD.h
	$(COMPILE) $(CMN)HTNews.c

$(LOB)/HTGopher$(_O) : $(OE) $(CMN)HTGopher.c $(CMN)HTUtils.h $(CMN)HTList.h \
	 $(CMN)HTMLDTD.h
	$(COMPILE) $(CMN)HTGopher.c

$(LOB)/HTTelnet$(_O) : $(OE) $(CMN)HTTelnet.c $(CMN)HTUtils.h $(CMN)HTTelnet.h $(CMN)../../../userdefs.h
	$(COMPILE) $(CMN)HTTelnet.c

$(LOB)/HTFinger$(_O) : $(OE) $(CMN)HTFinger.c $(CMN)HTUtils.h $(CMN)HTList.h \
	$(CMN)HTMLDTD.h
	$(COMPILE) $(CMN)HTFinger.c

$(LOB)/HTStyle$(_O) : $(OE) $(CMN)HTStyle.c $(CMN)HTUtils.h
	$(COMPILE) $(CMN)HTStyle.c

$(LOB)/HTAtom$(_O) : $(OE) $(CMN)HTAtom.c $(CMN)HTUtils.h $(CMN)HTList.h
	$(COMPILE) $(CMN)HTAtom.c

$(LOB)/HTChunk$(_O) : $(OE) $(CMN)HTChunk.c $(CMN)HTUtils.h
	$(COMPILE) $(CMN)HTChunk.c

$(LOB)/HTString$(_O) : $(OE) $(CMN)HTString.c $(CMN)HTUtils.h $(CMN)Version.make
	$(COMPILE) -DVC=\"$(VC)\" $(CMN)HTString.c

$(LOB)/HTRules$(_O) : $(OE) $(CMN)HTRules.c $(CMN)HTUtils.h $(CMN)Version.make \
	 $(CMN)HTAAProt.h
	$(COMPILE) -DVC=\"$(VC)\" $(CMN)HTRules.c

$(LOB)/SGML$(_O) : $(OE) $(CMN)SGML.c $(CMN)HTUtils.h $(CMN)UCAux.h
	$(COMPILE) $(CMN)SGML.c

$(LOB)/HTMLGen$(_O) : $(OE) $(CMN)HTMLGen.c $(CMN)HTUtils.h $(CMN)HTMLDTD.h
	$(COMPILE) $(CMN)HTMLGen.c

$(LOB)/HTMLDTD$(_O) : $(OE) $(CMN)HTMLDTD.c $(CMN)SGML.h
	$(COMPILE) $(CMN)HTMLDTD.c

$(LOB)/HTPlain$(_O) : $(OE) $(CMN)HTPlain.c $(CMN)HTPlain.h $(CMN)HTStream.h \
	 $(CMN)UCAux.h
	$(COMPILE) $(CMN)HTPlain.c

$(LOB)/HTWAIS$(_O) : $(OE) $(CMN)HTWAIS.c $(CMN)HTUtils.h $(CMN)HTList.h
	$(COMPILE) $(WAISINC) $(CMN)HTWAIS.c

$(LOB)/HTWSRC$(_O) : $(OE) $(CMN)HTWSRC.c $(CMN)HTUtils.h $(CMN)HTList.h
	$(COMPILE) $(CMN)HTWSRC.c

#	Access Authorization

$(LOB)/HTAAUtil$(_O) : $(OE) $(CMN)HTAAUtil.c $(CMN)HTAAUtil.h \
	 $(CMN)HTUtils.h $(CMN)HTString.h
	$(COMPILE) $(CMN)HTAAUtil.c

$(LOB)/HTGroup$(_O) : $(OE) $(CMN)HTGroup.c $(CMN)HTGroup.h \
	 $(CMN)HTAAUtil.h \
	 $(CMN)HTAssoc.h $(CMN)HTLex.h
	$(COMPILE) $(CMN)HTGroup.c

$(LOB)/HTAABrow$(_O) : $(OE) $(CMN)HTAABrow.c $(CMN)HTAABrow.h \
	 $(CMN)HTAAUtil.h $(CMN)HTUU.h \
	 $(CMN)HTUtils.h $(CMN)HTString.h \
	 $(CMN)HTParse.h $(CMN)HTList.h \
	 $(CMN)HTAssoc.h
	$(COMPILE) $(CMN)HTAABrow.c

$(LOB)/HTAAProt$(_O) : $(OE) $(CMN)HTAAProt.c $(CMN)HTAAProt.h \
	 $(CMN)HTUtils.h $(CMN)HTAAUtil.h \
	 $(CMN)HTAssoc.h $(CMN)HTLex.h
	$(COMPILE) $(CMN)HTAAProt.c

$(LOB)/HTAssoc$(_O) : $(OE) $(CMN)HTAssoc.c $(CMN)HTAssoc.h \
	$(CMN)HTUtils.h $(CMN)HTString.h $(CMN)HTList.h
	$(COMPILE) $(CMN)HTAssoc.c

$(LOB)/HTLex$(_O) : $(OE) $(CMN)HTLex.c $(CMN)HTLex.h $(CMN)HTUtils.h
	$(COMPILE) $(CMN)HTLex.c

$(LOB)/HTUU$(_O) : $(OE) $(CMN)HTUU.c $(CMN)HTUU.h $(CMN)HTUtils.h
	$(COMPILE) $(CMN)HTUU.c


#	Communications & Files

$(LOB)/HTTP$(_O) : $(OE) $(CMN)HTTP.c $(CMN)HTUtils.h $(CMN)HTAABrow.h
	$(COMPILE) $(CMN)HTTP.c

$(LOB)/HTTCP$(_O) : $(OE) $(CMN)HTTCP.c $(CMN)HTUtils.h
	$(COMPILE) $(CMN)HTTCP.c

$(LOB)/HTFile$(_O) : $(OE) $(CMN)HTFile.c $(CMN)HTUtils.h \
	 $(CMN)HTMLDTD.h
	$(COMPILE) $(CMN)HTFile.c

$(LOB)/HTBTree$(_O) : $(OE) $(CMN)HTBTree.c $(CMN)HTUtils.h
	$(COMPILE) $(CMN)HTBTree.c

$(LOB)/HTFTP$(_O) : $(OE) $(CMN)HTFTP.c $(CMN)HTUtils.h
	$(COMPILE) $(CMN)HTFTP.c

$(LOB)/HTAccess$(_O) : $(OE)  $(CMN)HTAccess.c $(CMN)HTUtils.h
	$(COMPILE) $(CMN)HTAccess.c

$(LOB)/HTParse$(_O) : $(OE) $(CMN)HTParse.c $(CMN)HTUtils.h
	$(COMPILE) $(CMN)HTParse.c

$(LOB)/HTVMS_WaisUI$(_O) : $(OE) $(CMN)HTVMS_WaisUI.c $(CMN)HTUtils.h
	$(COMPILE) $(CMN)HTVMS_WaisUI.c

$(LOB)/HTDOS$(_O) : $(OE) $(CMN)HTDOS.c $(CMN)HTUtils.h
	$(COMPILE) $(CMN)HTDOS.c

# DO NOT DELETE THIS LINE -- make depend depends on it.
