# Toplevel Makefile for NCSA Mosaic.

# You shouldn't need to touch any of the Makefiles in the various
# subdirectories if you configure this Makefile correctly.

# If you need to make serious changes to get Mosaic to compile on your
# platform, send context diffs to mosaic-x@ncsa.uiuc.edu.

# -------------------------- CUSTOMIZABLE OPTIONS ----------------------------

prereleaseflags = -DPRERELEASE

RANLIB = ranlib
CC = gcc
ldflags =
knrflag =
sysconfigflags =
syslibs =
xinc = -I/usr/athena/include
xlibs = -L/usr/athena/lib -lXm -lXmu -lXt -lXext -lX11

# ---------------------- MOSAIC ON ATHENA OPTIONS -------------------------

#### PNG SUPPORT
#### For inline PNG support, the following should be defined:
#### The libraries currently used are PNGLIB 0.81 and ZLIB 0.95

pngdir = /mit/outland
pnglibdir = $(pngdir)/lib
pngincludedir = $(pngdir)/include
pnglibs = $(pnglibdir)/libpng.a $(pnglibdir)/libz.a -lm
pngflags =  -I$(pngincludedir) -DHAVE_PNG

#### JPEG SUPPORT
#### For inline JPEG support, the following should be defined:
#### The library used is Independent JPEG Group (IJG's) 5.0a.

jpegdir = /mit/graphics
jpeglibs = $(jpegdir)/lib/libjpeg.a
jpegflags = -I$(jpegdir)/include -DHAVE_JPEG

#### KERBEROS SUPPORT
####
#### If you want Mosaic to support Kerberos authentication, set the 
#### following flags appropriately.  You can support Kerberos V4 and/or V5,
#### although it's most likely that your realm supports one or the other.
#### To enable DES-encryption of HTTP messages via Kerberos key exchange, 
#### define the KRB-ENCRYPT flag.

krb4dir   = /usr/athena
krb4libs  = $(krb4dir)/lib/libkrb.a $(krb4dir)/lib/libdes.a
krb4flags = -DKRB4 -I$(krb4dir)/include
krbflags  = $(krb4flags) $(krb5flags)
krblibs   = $(krb4libs) $(krb5libs) 


#### Customization flags:
#### . If you want Mosaic to come up with monochrome colors by default,
####   use -DMONO_DEFAULT
#### . If you want to define the default Mosaic home page, set
####   -DHOME_PAGE_DEFAULT=\\\"url\\\"
#### . If you want to define the default Mosaic documentation directory
####   (should be a URL), set -DDOCS_DIRECTORY_DEFAULT=\\\"url\\\"
#### . Other things you can define are spelled out in src/mosaic.h.
customflags =


# ---------------------- END OF CUSTOMIZABLE OPTIONS -------------------------

CFLAGS = -O $(sysconfigflags) $(prereleaseflags)

# Don't worry about these -- for development purposes only.
PURIFY = purify
QUANTIFY = quantify

default: $(dtmdirs) libwww2 libXmx libhtmlw libnut src
	@echo \*\*\* Welcome to NCSA Mosaic.
purifyd: $(dtmdirs) libwww2 libXmx libhtmlw libnnut src-purifyd
	@echo \*\*\* Welcome to Purify'd NCSA Mosaic.
quantifyd: $(dtmdirs) libwww2 libXmx libhtmlw libnut src-quantifyd
	@echo \*\*\* Welcome to Quantify'd NCSA Mosaic.

libXmx::
	@echo --- Building libXmx
	cd libXmx; $(MAKE) CC=$(CC) RANLIB=$(RANLIB) CFLAGS="$(CFLAGS) $(xinc)"

libhtmlw::
	@echo --- Building libhtmlw
	cd libhtmlw; $(MAKE) CC=$(CC) RANLIB=$(RANLIB) CFLAGS="$(CFLAGS) $(knrflag) $(xinc) -DMOTIF -DXMOSAIC"

libwww2::
	@echo --- Building libwww2
	cd libwww2; $(MAKE) CC=$(CC) RANLIB=$(RANLIB) CFLAGS="$(CFLAGS) $(knrflag) $(waisflags)  $(krbflags) $(xinc)"

libnut::
	@echo --- Building libnut
	cd libnut; $(MAKE) CC=$(CC) RANLIB=$(RANLIB) CFLAGS="$(CFLAGS) $(knrflag)"

src::
	@echo --- Building src
	cd src; $(MAKE) CC=$(CC) RANLIB=$(RANLIB) LDFLAGS="$(ldflags)" CFLAGS="$(CFLAGS) $(customflags) $(xinc) $(jpegflags) $(dtmflags) $(hdfflags) $(pngflags) $(krbflags) -I.. -I../libXmx -I../libwww2" AUX_CFLAGS=$(knrflag) X_LIBS="$(xlibs)" SYS_LIBS="$(sockslibs) $(syslibs)" DTM_LIBS="$(dtmlibs)" HDF_LIBS="$(hdflibs)" WAIS_LIBS="$(waislibs)" LIBWWW_DIR=../libwww2 JPEG_LIBS="$(jpeglibs)" PNG_LIBS="$(pnglibs)" KRB_LIBS="$(krblibs)" LIBNUT_DIR=../libnut MOSAIC="Mosaic"

src-purifyd::
	@echo --- Building Purify'd src
	cd src; $(MAKE) PURIFY=$(PURIFY) CC=$(CC) RANLIB=$(RANLIB) LDFLAGS="$(ldflags)" CFLAGS="$(CFLAGS) $(customflags) $(xinc) $(jpegflags) $(dtmflags) $(hdfflags) $(pngflags) $(krbflags) -I.. -I../libXmx -I../libwww2" AUX_CFLAGS=$(knrflag) X_LIBS="$(xlibs)" SYS_LIBS="$(sockslibs) $(syslibs)" DTM_LIBS="$(dtmlibs)" HDF_LIBS="$(hdflibs)" WAIS_LIBS="$(waislibs)" LIBWWW_DIR=../libwww2 JPEG_LIBS="$(jpeglibs)" PNG_LIBS="$(pnglibs)" KRB_LIBS="$(krblibs)" LIBNUT_DIR=../libnut MOSAIC="Mosaic-p"

src-quantifyd::
	@echo --- Building Quantify'd src
	cd src; $(MAKE) PURIFY=$(QUANTIFY) CC=$(CC) RANLIB=$(RANLIB) LDFLAGS="$(ldflags)" CFLAGS="$(CFLAGS) $(customflags) $(xinc) $(jpegflags) $(dtmflags) $(hdfflags) $(pngflags) $(krbflags) -I.. -I../libXmx -I../libwww2" AUX_CFLAGS=$(knrflag) X_LIBS="$(xlibs)" SYS_LIBS="$(sockslibs) $(syslibs)" DTM_LIBS="$(dtmlibs)" HDF_LIBS="$(hdflibs)" WAIS_LIBS="$(waislibs)" LIBWWW_DIR=../libwww2 JPEG_LIBS="$(jpeglibs)" PNG_LIBS="$(pnglibs)" KRB_LIBS="$(krblibs)" LIBNUT_DIR=../libnut MOSAIC="Mosaic-q"

libnet::
	@echo --- Building libnet
	cd libnet; $(MAKE) CC=$(CC) RANLIB=$(RANLIB) CFLAGS="$(CFLAGS) $(dtmflags)"

libdtm::
	@echo --- Building libdtm
	cd libdtm; $(MAKE) $(dtmmachtype) CC=$(CC) RANLIB=$(RANLIB) CFLAGS="$(CFLAGS) $(dtmflags)"

clean:
	cd libXmx; $(MAKE) $@
	cd libhtmlw; $(MAKE) $@
	cd libwww2; $(MAKE) $@
	cd src; $(MAKE) MOSAIC="Mosaic" $@
	cd libnet; $(MAKE) $@
	cd libdtm; $(MAKE) $@
	cd libnut; $(MAKE) $@

wclean:
	cd libhtmlw; $(MAKE) $@
	cd src; $(MAKE) MOSAIC="Mosaic" $@

commit:
	cvs commit
update:
	cvs update
countlines:
	wc libdtm/*.[ch] libnet/*.[ch] libXmx/*.[ch] libhtmlw/*.[ch] libwww2/*.[ch] libnut/*.[ch] src/*.[ch]
replicate:
	cp Makefile Makefile.sun
	cp Makefile Makefile.ibm
	cp Makefile Makefile.dec
	cp Makefile Makefile.alpha
	cp Makefile Makefile.hp
prune:
	mv Makefile.sun Makefile.sun.old
	mv Makefile.ibm Makefile.ibm.old
	mv Makefile.dec Makefile.dec.old
	mv Makefile.alpha Makefile.alpha.old
	mv Makefile.hp Makefile.hp.old
