# 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 ----------------------------

# RANLIB = /bin/true
#### On non-SGI's, this should be ranlib.
RANLIB = ranlib

#CC = cc
#### On Sun's, this should be gcc (ANSI required).
CC = gcc


#### For a few files in the source, some compilers may need to be kicked
#### in K&R mode.  E.g., on SGI's, -cckr does this.
#knrflag = -cckr
#### On most systems, no flag is needed.
knrflag =


#### Random system configuration flags.
#### --> *** For Motif 1.2 ON ANY PLATFORM, do -DMOTIF1_2 *** <--
#### For IBM AIX 3.2, do -D_BSD
#### For NeXT, do -DNEXT
#### For HP/UX, do -Aa -D_HPUX_SOURCE
#### For Dell SVR4, do -DSVR4
#### For Solaris, do -DSVR4 
#### For Esix 4.0.4 and Solaris x86 2.1, do -DSVR4
#### For Convex whatever, do -DCONVEX
#### For SCO ODT 3.0, do -DSCO -DSVR4 -DMOTIF1_2
#### For Motorola SVR4, do -DSVR4 -DMOTOROLA -DMOTIF1_2
sysconfigflags = 

#### System libraries.
# syslibs = -lPW -lsun -lmalloc
#### For AIX 3.2
# syslibs = -lPW -lbsd
#### For most other Motif platforms:
# syslibs = -lPW
#### For Sun's and Ultrix and HP and BSD/386:
# syslibs =
#### For Sun's with no DNS:
# syslibs = -lresolv
#### For SCO ODT:
# syslibs = -lPW -lsocket -lmalloc
#### For Dell SVR4:
# syslibs = -lnsl -lsocket -lc -lucb
#### For Solaris (?)
# syslibs = -lnsl -lsocket -lgen
#### For Motorola SVR4:
# syslibs = -lnsl -lsocket -lgen


#### X include file locations -- if your platform puts the X include
#### files in a strange place, set this variable appropriately.  Else
#### don't worry about it.
#### HP X11R4 version:
# xinc = -I/usr/include/Motif1.1 -I/usr/include/X11R4
#### HP X11R5 version:
# xinc = -I/usr/include/Motif1.2 -I/usr/local/X11R5/include
#### NeXT version:
# xinc = -I/usr/include/X11
#### BSD/386
# xinc = -I/usr/X11/include

xinc = -I/usr/include/X11/Xm

#### X library locations.
# xlibs = -lXm_s -lXmu -lXt_s -lX11_s
#### For Sun's (at least running stock X/Motif as installed on our machines):
# xlibs = /usr/lib/libXm.a /usr/lib/libXmu.a /usr/lib/libXt.a /usr/lib/libXext.a /usr/lib/libX11.a -lm #### For HP-UX 8.00:
# xlibs = -L/usr/lib/Motif1.1 -lXm -L/usr/lib/X11R4 -lXmu -lXt -lX11
#### For HP-UX 9.01: The X11R5 libraries are here on our systems
# xlibs = -L/usr/lib/Motif1.2 -lXm -L/usr/lib/X11R5 -L/usr/lib/X11R4 -lXmu -lXt -lX11
#### For NeXT:
# xlibs = -L/usr/lib/X11 -lXm -lXmu -lXt -lX11
#### For Dell SVR4:
# xlibs = -L/usr/X5/lib -lXm -lXmu -lXt -lXext -lX11
#### For Solaris (?)
# xlibs = -lXm -lXmu -lXt -lXext -lX11 -lm
#### For SCO ODT 3.0 (I'm told that -lXtXm_s is *not* a typo :-):
# xlibs = -lXtXm_s -lXmu -lX11_s
#### For nearly everyone else:
# xlibs = -lXm -lXmu -lXt -lX11
#### For Linux
xlibs = /usr/X11R6/lib/libXm.a -lXmu -lXt -lX11 -lICE -lSM
#### For BSD/386:
# xlibs = -L/usr/X11/lib -lXm -lXmu -lXt -lX11
#### For Motorola SVR4:
# xlibs = -lXm -lXmu -lXt -lXext -lX11 -lm


#### DTM AND HDF SUPPORT; READ CAREFULLY

#### If you want to compile with DTM and HDF support, you should leave
#### the following lines uncommented and make sure you have a copy of
#### HDF 3.3 (r1 or later) installed and ready.  You can find HDF on
#### ftp.ncsa.uiuc.edu in /HDF.

#### If you do not want to compile with DTM and HDF support, comment
#### the following lines out.  (If you are compiling from source for
#### the first time, you should probably not bother with HDF and DTM
#### support.)

#### dtmmachtype needs to be set to one of the following:
####   sun, sgi, dec, ibm, next, cray, convex
#### If your platform is not one of the above, then either do not compile
#### with HDF/DTM support or try hacking libdtm/makefile.

#dtmmachtype = sun
#dtmdirs = libdtm libnet
#dtmlibs = ../libnet/libnet.a ../libdtm/libdtm.a
#dtmflags = -DHAVE_DTM -I.. -I../libnet
#hdfdir = /hdf/install/sun
#hdflibs = $(hdfdir)/lib/libnetcdf.a $(hdfdir)/lib/libdf.a
#hdfflags = -DHAVE_HDF -I$(hdfdir)/include

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

#jpegdir = /X11/mosaic/libjpeg/linux
#jpeglibs = $(jpegdir)/libjpeg.a
#jpegflags = -I$(jpegdir) -DHAVE_JPEG


#### DIRECT WAIS SUPPORT

#### If you want to have Mosaic be able to communicate directly with
#### WAIS servers, do set the following flags appropriately.  We
#### recommend linking with CNIDR's freeWAIS 0.1 distribution; other
#### WAIS distributions may work but we have not tested them with
#### Mosaic.  freeWAIS 0.1 can be found on sunsite.unc.edu in
#### /pub/wais.

#### If you do not wish to link to the WAIS libraries, then comment
#### the following lines out.  Mosaic will then communicate with WAIS
#### servers via a HTTP gateway.

#### -lm is required for freeWAIS 0.1, as ceil() is used.

#waisroot = /X11/mosaic/freeWAIS-0.1-sun
#waisflags = -DDIRECT_WAIS -I$(waisroot)/ir
#waislibdir = $(waisroot)/bin
#waislibs = $(waislibdir)/inv.a $(waislibdir)/wais.a $(waislibdir)/libftw.a -lm



#### PEM/PGP SUPPORT
####
#### PEM stands for Privacy Enhanced Mail.
#### PGP stands for Pretty Good Privacy.
####
#### PGP and PEM are programs to allow you and a second party to
#### communicate in a way which does not allow third parties to read
#### them, and which certify that the person who sent the message is
#### really who they claim they are. 
####
#### PGP and PEM both use RSA encryption. The U.S. government has strict
#### export controls over foreign use of this technology, so people outside
#### the U.S. may have a difficult time finding programs which perform
#### the encryption. 
####
#### If you have a way to encrypt/decrypt with PEM or PGP, and will be 
#### communicating with a server (or servers) which also uses PEM or PGP
#### you will want to set this flag when you compile.

# PEM_FLAG = -DPEM_AUTH


#### 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.
##############################################################################
#### . If you want Multi-Localization enhancement,
####   set -DL10N
#### . If you want to use Motif I18N,
####   set -DMOTIF_I18N
#### . If you use ASCII Openware Motif,
####   set -DOPENWARE
#### . If you want to use NetNews extension view,
####   set -DNEWS_SELECT
#### . If you want to read HTML3/HTML Netscape extension,
####   set -DHTML3/-DNETSCAPE_EXT
#### . If you set real access time on the global history file,
####   set -D_USE_REAL_ACCESS_DATE
#### . If you want to use Secure Socket Layer,
####   set -DUSE_SSL
#### . If you don't want to show your machine information,
####   set -DSECURE
#### . If you can't input correct password,
####   set -DNAKED_PASSWORD
#### . If you want to use current URL in Menu file,
####   set -DDOCMENU_EXTENDER and you can use keyword "[CURRENT]" in Menufile.
#### . If you want to disable (suspicious)TABLE support,
####   set -DDISABLE_TABLE
customflags = -DL10N # -DMOTIF_I18N -DNEWS_SELECT -DHTML3 -DNETSCAPE_EXT -D_USE_REAL_ACCESS_DATE -DSECURE -DDOCMENU_EXTENDER -DDISABLE_TABLE

#### MIME HEADER SUPPORT
#### . If you set -DMIME_HEAD
####   set following variables
#mmsroot =       ../libmime
#mmslibdir =     $(mmsroot)
#mmslibs =       $(mmslibdir)/libmms.a
#mmsflags =      -DMIME_HEAD

#### SSL SUPPORT
#### . If you set -DUSE_SSL
####   sert following variables
#sslflags = -I../ssl/include -DUSE_SSL
#ssllibs = -L../ssl/lib -lssl -lcrypto






#### SOCKS SUPPORT
####
#### SOCKS is a toolkit that allows Internet applications to be
#### operated on systems inside firewalls in some instances.  This
#### version of Mosaic includes support for compiling with SOCKS
#### support enabled; you will need the version of SOCKS found at:
####
####   ftp://ftp.nec.com/pub/security/socks.cstc
####
#### SOCKS and the SOCKS support code in Mosaic are NOT supported by
#### NCSA; if you choose to use SOCKS and/or Mosaic compiled with
#### SOCKS, you are on your own.  Note that DTM and WAIS have not been
#### SOCKS-ified and therefore will probably not work under SOCKS.
####
#### Normally, do not compile with SOCKS enabled; therefore, use the
#### following lines.
socksflags = 
sockslibs = 
#### To compile with SOCKS support, use the following lines:
# socksflags = -DSOCKS
# sockslibs = /usr/local/lib/libsocks.a

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

CFLAGS = -g $(sysconfigflags) $(socksflags)
#CFLAGS = -O $(sysconfigflags) $(socksflags)

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

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

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

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

libwww2::
	@echo --- Building libwww2
	cd libwww2; make CC=$(CC) RANLIB=$(RANLIB) CFLAGS="$(CFLAGS) $(customflags) $(knrflag) $(waisflags) $(PEM_FLAG) $(sslflags) $(mmsflags)"

src::
	@echo --- Building src
	cd src; make CC=$(CC) RANLIB=$(RANLIB) CFLAGS="$(CFLAGS) $(customflags) $(xinc) $(dtmflags) $(hdfflags) $(jpegflags) $(sslflags) $(PEM_FLAG) $(mmsflags) -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)" SSL_LIBS="$(ssllibs)" MML_LIBS="$(mmslibs)"

src-purifyd::
	@echo --- Building Purify'd src
	cd src; make PURIFY=$(PURIFY) CC=$(CC) RANLIB=$(RANLIB) CFLAGS="$(CFLAGS) $(customflags) $(xinc) $(dtmflags) $(hdfflags) $(jpegflags) $(sslflags) $(PEM_FLAG) $(mmsflags) -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)" SSL_LIBS="$(ssllibs)" MML_LIBS="$(mmslibs)"

src-quantifyd::
	@echo --- Building Quantify'd src
	cd src; make PURIFY=$(QUANTIFY) CC=$(CC) RANLIB=$(RANLIB) CFLAGS="$(CFLAGS) $(customflags) $(xinc) $(dtmflags) $(hdfflags) $(jpegflags) $(sslflags) $(PEM_FLAG) $(mmsflags) -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)" SSL_LIBS="$(ssllibs)" MML_LIBS="$(mmslibs)"

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

libdtm::
	@echo --- Building libdtm
	cd libdtm; make $(dtmmachtype)

clean:
	cd libXmx; make $@
	cd libhtmlw; make $@
	cd libwww2; make $@
	cd src; make $@
	cd libnet; make $@
	cd libdtm; make $@

wclean:
	cd libhtmlw; make $@
	cd src; make $@

commit:
	cvs commit
update:
	cvs update
countlines:
	wc libdtm/*.[ch] libnet/*.[ch] libXmx/*.[ch] libhtmlw/*.[ch] libwww2/*.[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
