##makefile for lynx

SHELL = /bin/sh

##this is the name of the directory the lynx source code is in.
##(e.g. lynx2-4, not the full path)

lynxdir= lynx2-4-2

##change the next line if you want lynx installed somewhere 
##besides /usr/local/bin

exec= /usr/local/bin

##change the next line if you want the lynx man file installed somewhere
##besides /usr/man/man1

doc= /usr/man/man1

##change the next line if you want the lynx.cfg file installed somewhere
##besides /usr/local/lib

cfg= /usr/local/lib

installbin= install -c -s -m 555
installdoc= install -c -m 444


#set the relative location of the WWW library Implementation directory, 
#from this directory
#do not set this to be an absolute path!!!
WWWINC= WWW/Library/Implementation

# !!!!!!!!!!! Alternate socket functions for SOCKS !!!!!!!!!!!!!!!!!!
# To make a SOCKSified lynx, include -DSOCKS in your SITE_LYDEFS and
# SITE_DEFS, below, and point SOCKSLIB to your SOCKS library.  Note
# that you may have problems accessing FTP servers.  Also, instead of
# SOCKSifying lynx for use behind a firewall, you are better off if
# you make it normally, and set it up to use a proxy server.  You can
# SOCKSify the proxy server, and it will handle all clients, not just
# Lynx (see the INSTALLATION file in this distribution).
#SOCKSLIB= /usr/local/lib/libsocks.a

# !!!!!!!!!!!!!  DIRECT WAIS ACCESS !!!!!!!!!!!!!!!!!!!!!!!!!!
# If you are adding direct wais access you must fill in the
# location of wais.a, client.a and the standard math library, libm.a.  
# You can pick up the freeWAIS source from sunsite.unc.edu  
# or from ftp2.cc.ukans.edu.
# Plese put an ABSOLUTE address here if you want it to work! 
#WAISLIB= ../../freeWAIS-0.202/bin/client.a ../../freeWAIS-0.202/bin/wais.a /usr/lib/libm.a

#
# if you are on one of the supported systems (see all: list below)
# you should not have to modify anything from here down!
# If you are not, then you should edit the generic: entry below.
#
# If you need ncurses, the latest version can always be found
# in ftp://ftp.netcom.com/pub/zmbenhal/ncurses/
#

all:  
	@echo
	@echo "Please run make with one of the following arguments"
	@echo "aix4       -- for RS/6000 running AIX 4.1.1"
	@echo "aix32      -- for RS/6000 running AIX 3.2"
	@echo "aix31      -- for RS/6000 running AIX 3.1 with curses bug"
	@echo "apollo     -- apollo systems (untested)"
	@echo "bsdi       -- BSD Interactive"
	@echo "bsdi-ncurses -- BSD/OS(v2.0 or later) using ncurses(v1.9.4 or later) package."
	@echo "convex     -- for Convex C-series"
	@echo "convex-ncurses -- for Convex C-series with ncurses package"
	@echo "dgux       -- for DGUX "
	@echo "freebsd    -- for FreeBSD"
	@echo "freebsd-ncurses -- for FreeBSD using ncurses package"
	@echo "generic    -- for generic UNIX"
	@echo "linux      -- for PC linux"
	@echo "linux-ncurses -- for PC linux using ncurses package"
	@echo "mips       -- for MIPS, svr3/bsd flavour (untested)"
	@echo "netbsd     -- for NetBSD"
	@echo "netbsd-ncurses -- for NetBSD using ncurses package"
	@echo "next       -- for NeXT OS"
	@echo "next-ncurses  -- for NeXT OS using ncurses package"
	@echo "osf        -- for Alpha OSF/1"
	@echo "ptx        -- for Sequent's DYNIX/ptx"
	@echo "riscos     -- Control Data Unix machine running EP/IX"
	@echo "sco        -- for SCO machines"
	@echo "sgi        -- for SGI machines"
	@echo "sun3       -- for SUN 3 OS"
	@echo "sun4       -- for SUN 4 OS"
	@echo "sun4-pure  -- for SUN 4 OS with PURIFY"
	@echo "svr4       -- for SVR4"
	@echo "snake      -- for HP-UX lt 9.01"
	@echo "snake2     -- for HP-UX gte 9.01 (untested)"
	@echo "solaris2   -- for Solaris 2.x"
	@echo "ultrix     -- for DEC Ultrix"
	@echo "unixware   -- for Novell's Unixware (untested)"
	@echo "univell    -- for Novell's Unixware (untested)"
	@echo "decstation -- for DEC Ultrix (same as ultrix above)"
	@echo "isc        -- for Interactive Machines (untested)"
	@echo "clean      -- removes all '.o' and 'core' files"
	@echo "tar        -- runs clean, removes executable, and tars the whole directory"
	@echo "compress   -- runs tar, then compresses the result"
	@echo

# Map some extra commands to existing ones
unix: generic
decstation: ultrix
univell: unixware

# Set SITE_LYDEFS to one or more of the defines for the WWW Library:
SITE_LYDEFS = # -DDIRED_SUPPORT

# Set SITE_DEFS to one or more of the defines for lynx below:
SITE_DEFS = # -DDIRED_SUPPORT

# if you are compiling on a previously unsupported system, modify
# this generic entry!!
#
# defines include:
# -DNO_CUSERID     if you don't have cuserid()
# -DNO_UTMP	   if you don't have utmp capibilities
# -Dvfork=fork     if you don't have vfork()
# -DMMDF	   if you use MMDF instead of sendmail
# -DFANCY_CURSES   enables fancy curses (bold, underline, reverse)
# -DNO_KEYPAD      if you don't have keypad() and related defines
# -DNO_SIZECHANGE  Disables window sizechange code
# -DNO_CPU_LIMIT   Disables Max CPU timeout (includes CLOCKS_PER_SECOND)
# -DNO_PUTENV      Define if you don't have a putenv call.
# -DNO_CBREAK      if you don't have cbreak() (use crmode() instead)
# -DUNDERLINE_LINKS  Define if you want links underlined instead of bold.
# -DIGNORE_CTRL_C  Define if Control-C shouldn't exit lynx.
# -DHP_TERMINAL    For DIM workaround to REVERSE problems on HP terminals.
# -DLOCALE         For LOCALE support for international characters.
# -DSOCKS	   For making a SOCKSified lynx.
#
# if you would like to include support for local file management
# you should define the following
#
# -DDIRED_SUPPORT  Define to allow local file management support
# -DOK_TAR         Define to allow use of tar in dired support code
# -DOK_GZIP        Define to allow use of gzip in dired support code
# -DOK_ZIP         Define to allow use of zip and unzip in dired support code
# -DOK_UUDECODE    Define to allow use of uudecode in dired support code
# -DOK_OVERRIDE    Define to allow keymap overrides in dired mode
#
# if you have the reverse clear screen problem of some SUN4 systems you
# should define this in MCFLAGS (SITE_DEFS)
#
# -DREVERSE_CLEAR_SCREEN_PROBLEM 
#
# if you have an SVR4 system with the "type any key" problem, try defining
# this in LYFLAGS (SITE_LYDEFS) and MCFLAGS (SITE_DEFS)
#
# -DSVR4_BSDSELECT
#
# Old Data General systems may need this in their SITE_LYDEFS
# for their inet_addr(host) calls.
#
# -DDGUX_OLD
#
# if you would like logging of client requests via syslog(), you should
# define this in MCFLAGS (SITE_DEFS)
#
# -DSYSLOG_REQUESTED_URLS
#
# if you would like to enable code to detect memory leaks define this in both
# LYFLAGS (SITE_LYDEFS) and MCFLAGS (SITE_DEFS)
#
# -DLY_FIND_LEAKS
#
# if you would like "ls -l" emulation in local directory listings define
# this in LYFLAGS (SITE_LYDEFS).
#
# -DLONG_LIST
#
# if you do not want "Up to" parent links in local directory listings define
# this in LYFLAGS (SITE_LYDEFS).
#
# -DNO_PARENT_DIR_REFERENCE
#
# for installation of local execution links, please see the file userdefs.h

#generic machines with original Berkeley curses
generic:  
	@echo "You must first compile the WWW library in WWW/Library"
	cd WWW/Library/unix; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DFANCY_CURSES -DUNIX \
		-I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/unix/libwww.a"

# Tested on C3 series under ConvexOS 10.1, CC V5.0;
# Should work on other C-series
convex:
	cd WWW/Library/convex; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -O1 \
		-D__STDC__ \
		-DNO_PUTENV -DNO_CBREAK -DNO_KEYPAD -DUSE_DIRENT -DUNIX \
		-DSTDC_HEADERS -I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/convex/libwww.a"

convex-ncurses:
	cd WWW/Library/convex; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -O1 \
		-I/usr/local/include \
		-DNCURSES -DFANCY_CURSES \
		-D__STDC__ \
		-DNO_PUTENV -DNO_CBREAK -DNO_KEYPAD -DUSE_DIRENT -DUNIX \
		-DSTDC_HEADERS -I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-L/usr/local/lib -lncurses \
		-ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/convex/libwww.a"

# Tested on DGUX ver 5.4R3.00
dgux:
	cd WWW/Library/unix; make LYFLAGS="-DDGUX $(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DFANCY_CURSES -DUNIX \
		-I../$(WWWINC) -DDGUX $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/unix/libwww.a"

mips:
	cd WWW/Library/mips; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-systype svr3 -g \
		-DFANCY_CURSES -DUNIX -I/svr3/usr/include/bsd \
		-I../$(WWWINC) -DNO_UTMP $(SITE_DEFS)" \
		LIBS="-lcurses -lnsl -lbsd $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/mips/libwww.a"

# FreeBSD doesn't have or need ranlib. (ignore the error message about that :)
freebsd:
	cd WWW/Library/freebsd; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-O -DUNIX -DNO_KEYPAD -DNO_CUSERID \
		-I../$(WWWINC) $(SITE_DEFS)"\
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/freebsd/libwww.a"

# FreeBSD doesn't have or need ranlib. (ignore the error message about that :)
freebsd-ncurses:  
	cd WWW/Library/freebsd; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-O -DFANCY_CURSES -DNCURSES -DUNIX \
		-DNO_KEYPAD -DNO_CUSERID -I../$(WWWINC) $(SITE_DEFS) \
		-I/usr/include/ncurses" LIBS="-lncurses -lcompat \
		-ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/freebsd/libwww.a"

# NetBSD doesn't have or need ranlib. (ignore the error message about that :)
netbsd:  
	cd WWW/Library/netbsd; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-O -DUNIX -DNO_KEYPAD -DNO_CUSERID \
		-I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/netbsd/libwww.a"

# NetBSD doesn't have or need ranlib. (ignore the error message about that :)
netbsd-ncurses:  
	cd WWW/Library/netbsd; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-O -DFANCY_CURSES -DNCURSES -DUNIX \
		-DNO_KEYPAD -DNO_CUSERID -I../$(WWWINC) $(SITE_DEFS) \
		-I/usr/include/ncurses" LIBS="-lncurses -lcompat \
		-ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/netbsd/libwww.a"

# Tested on DN 3500 & 4500's running Domain O/S 10.4 BSD
# -Acpu,mathchip may have to be changed on other machines - see man cpuhep
apollo:
	cd WWW/Library/apollo_m68k; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DUNIX -DNO_KEYPAD -DNO_CUSERID \
		-D_BUILTINS -W0,-opt,4 -I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/apollo_m68k/libwww.a $(MYWWWLIB)"

riscos:  
	cd WWW/Library/unix; make CC="gcc" LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="gcc" MCFLAGS="-g -DFANCY_CURSES -DUNIX \
		-DNO_GETCWD -DNO_PUTENV -Dremove=unlink \
		-I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/unix/libwww.a "

# Lynx will not compile with the "free" cc compiler supplied 
# with HP-UX.  You must use a purchased cc compiler to compile Lynx.
snake:  
	cd WWW/Library/snake; make CC="gcc" LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="gcc" MCFLAGS="-g -DFANCY_CURSES -DUNIX \
		-DSNAKE -I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/snake/libwww.a "

snake2:
	cd WWW/Library/snake; make CC="gcc" LYFLAGS="-D_INCLUDE_HPUX_SOURCE \
		-D_INCLUDE_POSIX_SOURCE -D_INCLUDE_AES_SOURCE \
		-D_INCLUDE_XOPEN_SOURCE $(SITE_LYDEFS)"
	cd src; make all CC="gcc" MCFLAGS="-g -DFANCY_CURSES -DUNIX \
		-DSNAKE -I../$(WWWINC) -D_INCLUDE_HPUX_SOURCE \
		-D_INCLUDE_POSIX_SOURCE -D_INCLUDE_AES_SOURCE \
		-D_INCLUDE_XOPEN_SOURCE $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/snake/libwww.a "

svr4:  
	cd WWW/Library/svr4; make LYFLAGS="-DSVR4_BSDSELECT $(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DFANCY_CURSES -DUNIX \
		-I../$(WWWINC) -DNO_UTMP -DSVR4 -DSVR4_BSDSELECT -DTRUE=1 \
		-DFALSE=0 $(SITE_DEFS)" \
		LIBS="-lcurses -lsocket -lnsl $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/svr4/libwww.a"

ptx:  
	cd WWW/Library/ptx; make LYFLAGS="-DNO_BCOPY -DSVR4_BSDSELECT \
		-DNO_FILIO_H $(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DFANCY_CURSES -DUNIX \
		-DNO_FILIO_H -I../$(WWWINC) -DNO_UTMP -DSVR4 $(SITE_DEFS)" \
		LIBS="-lcurses -lsocket -linet -lnsl $(WAISLIB)" \
		WWWLIB="../WWW/Library/ptx/libwww.a"

unixware:
	cd WWW/Library/svr4; make LYFLAGS="-DNO_BCOPY -DUNIXWARE $(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DFANCY_CURSES -DUNIX \
		-I../$(WWWINC) -DNO_UTMP -DSVR4 -DTRUE=1 -DFALSE=0 \
		-DNO_BCOPY -DUNIXWARE $(SITE_DEFS)" \
		LIBS="-lcurses -lsocket -lnsl $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/svr4/libwww.a"

# SCO doesn't like line continuers?  (although others have said it does :)
#     doesn't have or need ranlib. (ignore the error message about that :)
#     can build lynx with its native rcc compiler.  (if you replace "gcc"
#     with "rcc" for CC= :)
#     has a const/volatile bug in its native cc compiler. (don't use it ;)
sco:  
	cd WWW/Library/sco; make CC="gcc" LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="gcc" MCFLAGS="-g -s -DFANCY_CURSES -DUNIX -DSCO -DMMDF -I../$(WWWINC) -DNO_UTMP -DNO_SIZECHANGE $(SITE_DEFS)"  LIBS="$(WAISLIB) $(SOCKSLIB) -lcurses -lsocket -ltermcap -lmalloc"  WWWLIB="../WWW/Library/sco/libwww.a"

bsdi:  
	cd WWW/Library/Implementation; make -f BSDI_Makefile LYFLAGS="-DBSDI $(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DNO_CUSERID -DUNIX -DNO_FILIO_H \
		-I../$(WWWINC) -DNO_UTMP -DSVR4 -DNO_KEYPAD $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/svr4/libwww.a"

bsdi-ncurses:
	@echo
	@echo
	@echo "IMPORTANT: To compile you need ncurses package (version 1.9.4 or later)"
	@echo "installed on your system. You can download ncurses package from"
	@echo "ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses"
	@echo
	@echo
	@echo `sleep 5`
	cd WWW/Library/Implementation; make -f BSDI_Makefile CC="gcc" \
				       LYFLAGS="-DBSDI $(SITE_LYDEFS)"
	cd src; make all CC="gcc" MCFLAGS="-g -DNO_CUSERID -DUNIX -DNCURSES \
		-DFANCY_CURSES -DNO_KEYPAD -DBSDI -DSVR4 -I/usr/include/ncurses \
		-I../$(WWWINC) $(SITE_DEFS)" LIBS="-lncurses $(WAISLIB) \
		$(SOCKSLIB)" WWWLIB="../WWW/Library/svr4/libwww.a"

solaris2:
	cd WWW/Library/solaris2; make CC="gcc" LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="gcc" MCFLAGS="-g -DFANCY_CURSES -DUNIX -DSOLARIS2 \
		-I../$(WWWINC) -DCURS_PERFORMANCE -DNO_UTMP -DUSE_DIRENT $(SITE_DEFS)" \
		LIBS="-L/usr/ccs/lib -lcurses $(WAISLIB) $(SOCKSLIB) -lnsl -lsocket" \
		WWWLIB="../WWW/Library/solaris2/libwww.a"

osf:            
	cd WWW/Library/osf; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DFANCY_CURSES -DUNIX $(ADDFLAGS) \
		-I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/osf/libwww.a"

#for some reason loc_t isn't defined when compiling for debug on my system.
#needed for NLchar.h
dbg:   
	cd WWW/Library/osf; make CC="gcc" LYFLAGS="-DDIRED_SUPPORT \
		-DLY_FIND_LEAKS"
	cd src; make all CC="gcc" MCFLAGS="-g -Wall $(ADDFLAGS) -DFANCY_CURSES \
		-DLY_FIND_LEAKS -Dloc_t=_LC_locale_t -D_locp=__lc_locale\
		-DDIRED_SUPPORT -DOK_TAR -DOK_GZIP -DOK_OVERRIDE \
		-DUNIX -I../$(WWWINC) -DEXEC_LINKS \
		-DALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/osf/libwww.a"


sgi:
# SGI doesn't have or need ranlib. (ignore the error message about that :)
	cd WWW/Library/sgi; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -cckr -DFANCY_CURSES -DNO_CUSERID \
	-DUNIX -DSGI -Dvfork=fork -I../$(WWWINC) -DNO_UTMP $(SITE_DEFS)" \
	 LIBS="-lcurses -ltermcap -DSYSV \
	 -DPERFORMANCE $(WAISLIB) $(SOCKSLIB)" \
	 WWWLIB="../WWW/Library/sgi/libwww.a"

linux:
	cd WWW/Library/unix; make CC="gcc" LYFLAGS="-DLINUX $(SITE_LYDEFS)"
	cd src; make all CC="gcc" MCFLAGS="-g -DUNIX -DNO_KEYPAD -DNO_TTYTYPE -DLINUX -I../$(WWWINC) $(SITE_DEFS)" LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" WWWLIB="../WWW/Library/unix/libwww.a"

linux-ncurses:
	cd WWW/Library/unix; make CC="gcc" LYFLAGS="-g -DLINUX $(SITE_LYDEFS)"
	cd src; make all CC="gcc" MCFLAGS="-g -DUNIX -DNCURSES -DFANCY_CURSES -DNO_KEYPAD -DNO_TTYTYPE -DLINUX -I/usr/include/ncurses -I../$(WWWINC) $(SITE_DEFS)" LIBS="-lncurses $(WAISLIB) $(SOCKSLIB)" WWWLIB="../WWW/Library/unix/libwww.a"

aix4: 
	cd WWW/Library/rs6000; make LYFLAGS="-D_BSD=44 -DSVR4_BSDSELECT \
		$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DFANCY_CURSES -DUNIX \
		-D_BSD=44 -DSVR4_BSDSELECT -I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -lbsd $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/rs6000/libwww.a"

aix32: 
	cd WWW/Library/rs6000; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DFANCY_CURSES -DUNIX \
		-I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -lbsd $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/rs6000/libwww.a"

aix31: 
	cd WWW/Library/rs6000; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DUNIX -I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -lbsd $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/rs6000/libwww.a"

ultrix:  
	cd WWW/Library/decstation; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -Olimit 600 -DFANCY_CURSES \
		 -DUNIX -DULTRIX -I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcursesX -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/decstation/libwww.a "

sun:
	@echo "Run make again and use \"make sun3\" or \"make sun4\""

#
# add -lresolv to the last "LIBS" entry within the quotes if needed
#
sun3:    
	cd WWW/Library/sun3; make LYFLAGS="$(SITE_LYDEFS)" CC="gcc"
	cd src; make all CC="gcc" MCFLAGS="-g -DUNIX -DFANCY_CURSES \
		-I../$(WWWINC) -DSUN -DLOCALE -I/usr/5include $(SITE_DEFS)"\
		LIBS="-lcurses -ltermcap -L/usr/5lib $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/sun3/libwww.a"

#
# add -lresolv to the last "LIBS" entry within the quotes if needed
#
sun4:
	cd WWW/Library/sun4; make CC="gcc" LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="gcc" MCFLAGS="-g -DUNIX -DFANCY_CURSES \
		-I../$(WWWINC) -DSUN -DSUN4 -DLOCALE -I/usr/5include \
		$(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap -L/usr/5lib $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/sun4/libwww.a"

#
# use the holiest of holiest --- PURIFY
# add -lresolv to the last "LIBS" entry within the quotes if needed
#
sun4-pure:
	cd WWW/Library/sun4; make CC="gcc" LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="purify -cache-dir=/home/purify-cache -always-use-cache-dir=yes -optimize-save-o7=no gcc" \
		MCFLAGS="-g -DUNIX -DFANCY_CURSES \
		-I../$(WWWINC) -DSUN -DSUN4 -DLOCALE -I/usr/5include \
		$(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap -L/usr/5lib \
		-lresolv $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/sun4/libwww.a"

next: 
	cd WWW/Library/next; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DUNIX -DNEXT -DNO_CUSERID \
		-DNO_GETCWD -DNO_PUTENV -DNO_KEYPAD -I../$(WWWINC) \
		-I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/next/libwww.a"

next-ncurses:
	cd WWW/Library/next; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DUNIX -DNEXT -DNCURSES \
		-DNO_GETCWD -DNO_CUSERID -DNO_KEYPAD -DNO_TTYTYPE \
		-DFANCY_CURSES -DNO_PUTENV -I/usr/local/include \
		-I../$(WWWINC) -I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-L/usr/local/lib -lncurses \
		-ltermcap $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/next/libwww.a"

#	isc - Interactive Unix for i386 and i486 machines
#       According to Robert Salter <salter1@mster.nsbf.nasa.gov>,
#	  cc should be used instead of gcc.       
isc:
	cd WWW/Library/isc; make CC="cc" LYFLAGS="$(SITE_LYDEFS)"
	cd src; make all CC="cc" MCFLAGS="-g -DISC -DFANCY_CURSES -DUNIX \
		-DNO_UTMP -DISC -Dvfork=fork -I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap -linet -lnsl_s \
		-lcposix $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/isc/libwww.a"

traversal:
	cd WWW/Library/rs6000; make LYFLAGS="$(SITE_LYDEFS)"
	cd src; make traversal CC="cc" MCFLAGS="-g -DFANCY_CURSES -DUNIX  \
		-DTRAVERSAL -I../$(WWWINC) $(SITE_DEFS)" \
		LIBS="-lcurses -ltermcap -lbsd $(WAISLIB) $(SOCKSLIB)" \
		WWWLIB="../WWW/Library/rs6000/libwww.a"

clean:
	rm -f WWW/Library/*/*.[aob]
	rm -f WWW/Library/*/.created
	cd src; make clean
	rm -f *.b src/lynx core Lynx.leaks

tar:  clean
	rm -f lynx
	make save

turnover:	clean
	make save

zipcompress: compress zip
	echo "done!"

zip:  clean
	rm -f src/lynx
	rm -f lynx
	rm -f src/a.out
	rm -f ../$(lynxdir).zip
	cd ..; rm -f $(lynxdir).zip; zip -r $(lynxdir).zip $(lynxdir)

save:
	cd ..; rm -f $(lynxdir).tar; tar -cf - $(lynxdir) > $(lynxdir).tar

compress: tar
	cd ..; rm -f $(lynxdir).tar.Z; compress -f -v $(lynxdir).tar

install:
	-mv -f $(exec)/lynx $(exec)/lynx.old
	-mv -f $(cfg)/lynx.cfg $(cfg)/lynx.oldcfg
	$(installbin) lynx $(exec)/lynx
	$(installdoc) lynx.man $(doc)/lynx.1
	$(installdoc) lynx.cfg $(cfg)/lynx.cfg
