- # $Header: /home/amb/wwwoffle/RCS/Makefile 2.70.1.1 2000/04/02 15:27:07 amb Exp $
- #
- # WWWOFFLE - World Wide Web Offline Explorer - Version 2.5e.
- #
- # Program Makefile.
- #
- # Written by Andrew M. Bishop
- #
- # This file Copyright 1996,97,98,99,2000 Andrew M. Bishop
- # It may be distributed under the GNU Public License, version 2, or
- # any higher version. See section COPYING of the GNU Public license
- # for conditions under which this file may be redistributed.
- #
- ########
- LOCALHOST=localhost:8080
- INSTDIR=/usr/local
- SPOOLDIR=/var/spool/wwwoffle
- CONFDIR=/var/spool/wwwoffle
- # For Cygwin (win32).
- #INSTDIR=/wwwoffle
- #SPOOLDIR=/wwwoffle/spool
- #CONFDIR=/wwwoffle
- # For German language web pages and documentation.
- #LANG=de
- # For French language web pages and documentation.
- #LANG=fr
- # For Spanish language web pages and documentation.
- #LANG=es
- # For Russian language web pages and documentation.
- #LANG=ru
- # For Polish language web pages and documentation.
- #LANG=pl
- # For Italian language web pages and documentation.
- #LANG=it
- ########
- CC=gcc
- CFLAGS=-O2 -Wall -g
- # This is used in the FreeBSD port (http://www.freebsd.org/ports/).
- #CFLAGS=-O2 -Wall
- LD=gcc
- LDFLAGS=-g
- # For HP/UX this is a good idea.
- #LDFLAGS=
- # This is used in the FreeBSD port (http://www.freebsd.org/ports/).
- #LDFLAGS=-s
- # Optimal flex options for a very fast but large HTML parser.
- LEX=flex -i -L -pp -B -F -8
- # Use this if you have flex but want a smaller but slower HTML parser.
- #LEX=flex -i -L -pp -B
- # Use this if you don't have flex.
- #LEX=lex -i -L
- ########
- INCLUDE=
- LIBRARY=
- # For Solaris you need the following instead.
- #LIBRARY=-lnsl -lsocket
- COMPILE=$(CC) -c $(CFLAGS)
- LINK=$(LD) $(LDFLAGS)
- INSTALL=install
- # For Solaris you need the following instead.
- #INSTALL=/usr/ucb/install
- ########
- all : programs html
- ########
- install : install_binary install_doc install_cache install_html install_config
- install-win32 : install_binary-win32 install_doc-win32 install_cache install_html install_config install_fixup-win32
- ########
- clean :
- -rm -f wwwoffle.conf.install wwwoffle.conf.man.install
- -rm -f wwwoffle wwwoffled wwwoffle-tools upgrade-cache endian-cache
- -rm -f core *.o *~
- -rm -f html.c htmlmodify.c messages.c xml.c vrml.c
- cd testprogs && $(MAKE) clean
- ########
- programs : wwwoffled wwwoffle wwwoffle-tools upgrade-cache endian-cache
- ########
- test-programs : programs
- cd testprogs && $(MAKE)
- ########
- DOC_PARSERS=document.o
- html.o xml.o vrml.o javaclass.o
- ####
- WWWOFFLE_OBJ=wwwoffle.o
- refresh.o messages.o parse.o spool.o
- $(DOC_PARSERS)
- config-startup.o errors.o io.o misc.o proto-none.o sockets.o md5.o
- wwwoffle : $(WWWOFFLE_OBJ)
- $(LINK) $(WWWOFFLE_OBJ) -o $@ $(LIBRARY)
- ####
- WWWOFFLED_OBJ=wwwoffled.o wwwoffles.o
- http.o ftp.o finger.o ssl.o
- $(DOC_PARSERS)
- gifmodify.o htmlmodify.o
- connect.o control.o configedit.o htdig.o index.o messages.o monitor.o parse.o purge.o refresh.o spool.o
- config.o errors.o io.o misc.o proto.o sockets.o md5.o
- wwwoffled : $(WWWOFFLED_OBJ)
- $(LINK) $(WWWOFFLED_OBJ) -o $@ $(LIBRARY)
- ####
- WWWOFFLE_TOOLS_OBJ=wwwoffle-tools.o
- spool.o
- config-startup.o errors.o io.o misc.o proto-none.o sockets.o md5.o
- wwwoffle-tools : $(WWWOFFLE_TOOLS_OBJ)
- $(LINK) $(WWWOFFLE_TOOLS_OBJ) -o $@ $(LIBRARY)
- ####
- UPGRADE_OBJ=upgrade-cache.o
- config-startup.o errors.o io.o misc.o proto-none.o sockets.o md5.o
- upgrade-cache : $(UPGRADE_OBJ)
- $(LINK) $(UPGRADE_OBJ) -o $@ $(LIBRARY)
- ENDIAN_OBJ=endian-cache.o
- spool.o
- config-startup.o errors.o io.o misc.o proto-none.o sockets.o md5.o
- endian-cache : $(ENDIAN_OBJ)
- $(LINK) $(ENDIAN_OBJ) -o $@ $(LIBRARY)
- ####
- %.o:%.c
- $(COMPILE) $< -o $@ $(INCLUDE)
- wwwoffle.o : wwwoffle.c wwwoffle.h misc.h config.h errors.h sockets.h document.h version.h
- wwwoffled.o : wwwoffled.c wwwoffle.h misc.h config.h errors.h sockets.h version.h
- wwwoffles.o : wwwoffles.c wwwoffle.h misc.h config.h errors.h sockets.h proto.h document.h
- wwwoffle-tools.o : wwwoffle-tools.c wwwoffle.h misc.h errors.h
- $(COMPILE) wwwoffle-tools.c -o $@ $(INCLUDE) -DSPOOL_DIR="$(SPOOLDIR)"
- upgrade-cache.o : upgrade-cache.c wwwoffle.h misc.h errors.h
- endian-cache.o : endian-cache.c wwwoffle.h misc.h errors.h
- http.o : http.c wwwoffle.h misc.h config.h errors.h sockets.h proto.h
- ftp.o : ftp.c wwwoffle.h misc.h config.h errors.h sockets.h proto.h
- finger.o : finger.c wwwoffle.h misc.h config.h errors.h sockets.h proto.h
- ssl.o : ssl.c wwwoffle.h misc.h config.h errors.h sockets.h proto.h
- document.o : document.c wwwoffle.h misc.h config.h errors.h proto.h document.h
- html.o : html.c wwwoffle.h misc.h config.h errors.h document.h
- xml.o : xml.c wwwoffle.h misc.h config.h errors.h document.h
- vrml.o : vrml.c wwwoffle.h misc.h config.h errors.h document.h
- javaclass.o : javaclass.c wwwoffle.h misc.h errors.h document.h
- gifmodify.o : gifmodify.c wwwoffle.h misc.h config.h errors.h document.h
- htmlmodify.o : htmlmodify.c wwwoffle.h misc.h config.h errors.h document.h
- configedit.o : configedit.c wwwoffle.h misc.h config.h errors.h
- connect.o : connect.c wwwoffle.h misc.h config.h errors.h sockets.h
- control.o : control.c wwwoffle.h misc.h config.h errors.h sockets.h
- htdig.o : htdig.c wwwoffle.h misc.h errors.h proto.h
- index.o : index.c wwwoffle.h misc.h config.h errors.h
- messages.o : messages.c wwwoffle.h misc.h config.h errors.h version.h
- monitor.o : monitor.c wwwoffle.h misc.h config.h
- parse.o : parse.c wwwoffle.h misc.h config.h errors.h proto.h
- purge.o : purge.c wwwoffle.h misc.h config.h errors.h proto.h
- refresh.o : refresh.c wwwoffle.h misc.h config.h errors.h sockets.h
- spool.o : spool.c wwwoffle.h misc.h config.h errors.h
- config.o : config.c wwwoffle.h misc.h config.h errors.h sockets.h proto.h
- $(COMPILE) config.c -o $@ $(INCLUDE) -DSPOOL_DIR="$(SPOOLDIR)" -DCONF_DIR="$(CONFDIR)"
- errors.o : errors.c config.h errors.h
- io.o : io.c wwwoffle.h misc.h errors.h
- misc.o : misc.c misc.h config.h proto.h
- proto.o : proto.c misc.h proto.h
- sockets.o : sockets.c errors.h sockets.h
- md5.o : md5.c md5.h
- config-startup.o : config.c wwwoffle.h misc.h config.h errors.h sockets.h proto.h
- $(COMPILE) config.c -o $@ $(INCLUDE) -DSPOOL_DIR="$(SPOOLDIR)" -DCONF_DIR="$(CONFDIR)" -DSTARTUP_ONLY
- proto-none.o : proto.c misc.h proto.h
- $(COMPILE) proto.c -o $@ $(INCLUDE) -DNO_PROTOCOLS
- ####
- html.c : html.l
- $(LEX) -Phtml_yy html.l
- @mv lex.html_yy.c html.c
- htmlmodify.c : htmlmodify.l
- $(LEX) -Phtmlmodify_yy htmlmodify.l
- @mv lex.htmlmodify_yy.c htmlmodify.c
- xml.c : xml.l
- $(LEX) -Pxml_yy xml.l
- @mv lex.xml_yy.c xml.c
- vrml.c : vrml.l
- $(LEX) -Pvrml_yy vrml.l
- @mv lex.vrml_yy.c vrml.c
- messages.c : messages.l
- $(LEX) -Pmsg_yy messages.l
- @mv lex.msg_yy.c messages.c
- ########
- html : html/FAQ.html
- @true
- html/FAQ.html : FAQ FAQ-html.pl
- -perl FAQ-html.pl < FAQ > FAQ.html
- -[ -f FAQ.html -a -s FAQ.html ] && mv FAQ.html html/FAQ.html
- [ ! -f FAQ.html ] || rm FAQ.html
- ########
- install_binary : programs
- [ -x $(INSTDIR)/bin ] || $(INSTALL) -d -m 755 $(INSTDIR)/bin
- $(INSTALL) -c -m 755 wwwoffle $(INSTDIR)/bin
- $(INSTALL) -c -m 755 wwwoffle-tools $(INSTDIR)/bin
- ln -sf wwwoffle-tools $(INSTDIR)/bin/wwwoffle-ls
- ln -sf wwwoffle-tools $(INSTDIR)/bin/wwwoffle-mv
- ln -sf wwwoffle-tools $(INSTDIR)/bin/wwwoffle-rm
- ln -sf wwwoffle-tools $(INSTDIR)/bin/wwwoffle-read
- ln -sf wwwoffle-tools $(INSTDIR)/bin/wwwoffle-write
- [ -x $(INSTDIR)/sbin ] || $(INSTALL) -d -m 755 $(INSTDIR)/sbin
- $(INSTALL) -c -m 755 wwwoffled $(INSTDIR)/sbin
- install_binary-win32 : programs
- [ -x $(INSTDIR)/bin ] || $(INSTALL) -d -m 755 $(INSTDIR)/bin
- $(INSTALL) -c -m 755 wwwoffle.exe $(INSTDIR)/bin
- $(INSTALL) -c -m 755 wwwoffle-tools.exe $(INSTDIR)/bin
- $(INSTALL) -c -m 755 wwwoffle-tools.exe $(INSTDIR)/bin/wwwoffle-ls.exe
- $(INSTALL) -c -m 755 wwwoffle-tools.exe $(INSTDIR)/bin/wwwoffle-mv.exe
- $(INSTALL) -c -m 755 wwwoffle-tools.exe $(INSTDIR)/bin/wwwoffle-rm.exe
- $(INSTALL) -c -m 755 wwwoffle-tools.exe $(INSTDIR)/bin/wwwoffle-read.exe
- $(INSTALL) -c -m 755 wwwoffle-tools.exe $(INSTDIR)/bin/wwwoffle-write.exe
- $(INSTALL) -c -m 755 wwwoffled.exe $(INSTDIR)/bin
- $(INSTALL) -c -m 755 upgrade-config.pl $(INSTDIR)/bin
- $(INSTALL) -c -m 755 cygwin1.dll $(INSTDIR)/bin
- install_doc :
- [ -x $(INSTDIR)/man ] || $(INSTALL) -d -m 755 $(INSTDIR)/man
- [ -x $(INSTDIR)/man/man1 ] || $(INSTALL) -d -m 755 $(INSTDIR)/man/man1
- $(INSTALL) -c -m 644 wwwoffle.man $(INSTDIR)/man/man1/wwwoffle.1
- [ -x $(INSTDIR)/man/man5 ] || $(INSTALL) -d -m 755 $(INSTDIR)/man/man5
- sed -e 's%SPOOLDIR%$(SPOOLDIR)%' -e 's%CONFDIR%$(CONFDIR)%' < wwwoffle.conf.man > wwwoffle.conf.man.install
- $(INSTALL) -c -m 644 wwwoffle.conf.man.install $(INSTDIR)/man/man5/wwwoffle.conf.5
- [ -x $(INSTDIR)/man/man8 ] || $(INSTALL) -d -m 755 $(INSTDIR)/man/man8
- $(INSTALL) -c -m 644 wwwoffled.man $(INSTDIR)/man/man8/wwwoffled.8
- [ -x $(INSTDIR)/doc/wwwoffle ] || $(INSTALL) -d -m 755 $(INSTDIR)/doc/wwwoffle
- for file in CHANGES.CONF CONVERT COPYING FAQ INSTALL NEWS README* UPGRADE ; do
- $(INSTALL) -c -m 644 $$file $(INSTDIR)/doc/wwwoffle/$$file ;
- done
- [ "x$(LANG)" = "x" ] || [ ! -d lang-$(LANG) ] || ( cd lang-$(LANG) &&
- for file in CHANGES.CONF CONVERT COPYING FAQ INSTALL NEWS README* UPGRADE ; do
- [ ! -f $$file ] || $(INSTALL) -c -m 644 $$file $(INSTDIR)/doc/wwwoffle/$$file-$(LANG) ;
- done )
- install_doc-win32 :
- [ -x $(INSTDIR)/doc ] || $(INSTALL) -d -m 755 $(INSTDIR)/doc
- for file in CHANGES.CONF COPYING FAQ INSTALL NEWS README* ; do
- $(INSTALL) -c -m 644 $$file $(INSTDIR)/doc/$$file ;
- done
- $(INSTALL) -c -m 644 README.win32 $(CONFDIR)/README.win32
- [ "x$(LANG)" = "x" ] || [ ! -d lang-$(LANG) ] || ( cd lang-$(LANG) &&
- for file in CHANGES.CONF COPYING FAQ INSTALL NEWS README* ; do
- [ ! -f $$file ] || $(INSTALL) -c -m 644 $$file $(INSTDIR)/doc/wwwoffle/$$file-$(LANG) ;
- done )
- install_cache : endian-cache
- @[ ! -d $(SPOOLDIR) -o -d $(SPOOLDIR)/http ] ||
- (echo "WWWOFFLE: " ;
- echo "WWWOFFLE: You MUST upgrade the existing cache before you can use this version." ;
- echo "WWWOFFLE: Read the file UPGRADE for details." ;
- echo "WWWOFFLE: " ;
- exit 1 )
- @([ ! -d $(SPOOLDIR) -o -d $(SPOOLDIR)/prevtime1 ] || ./endian-cache > /dev/null 2>&1 ) ||
- (echo "WWWOFFLE: " ;
- echo "WWWOFFLE: You MUST convert the existing cache to the correct endian format." ;
- echo "WWWOFFLE: Read the file CONVERT for details." ;
- echo "WWWOFFLE: " ;
- exit 0 )
- [ -x $(SPOOLDIR) ] || $(INSTALL) -d -m 750 $(SPOOLDIR)
- [ -x $(SPOOLDIR)/http ] || $(INSTALL) -d -m 750 $(SPOOLDIR)/http
- [ -x $(SPOOLDIR)/outgoing ] || $(INSTALL) -d -m 750 $(SPOOLDIR)/outgoing
- [ -x $(SPOOLDIR)/monitor ] || $(INSTALL) -d -m 750 $(SPOOLDIR)/monitor
- [ -x $(SPOOLDIR)/lasttime ] || $(INSTALL) -d -m 750 $(SPOOLDIR)/lasttime
- [ -x $(SPOOLDIR)/prevtime1 ] || $(INSTALL) -d -m 750 $(SPOOLDIR)/prevtime1
- @echo 'GET http://www.gedanken.demon.co.uk/wwwoffle/version-2.5/user.html HTTP/1.0' > $(SPOOLDIR)/outgoing/Owwwoffle-user ;
- echo 'Host: www.gedanken.demon.co.uk' >> $(SPOOLDIR)/outgoing/Owwwoffle-user ;
- echo 'Accept: */*' >> $(SPOOLDIR)/outgoing/Owwwoffle-user ;
- echo '' >> $(SPOOLDIR)/outgoing/Owwwoffle-user ;
- awk 'BEGIN{printf("http://www.gedanken.demon.co.uk/wwwoffle/version-2.5/user.html");}' > $(SPOOLDIR)/outgoing/Uwwwoffle-user < /dev/null
- @echo 'GET http://www.gedanken.demon.co.uk/wwwoffle/version-2.5/browser.html HTTP/1.0' > $(SPOOLDIR)/outgoing/Owwwoffle-browser ;
- echo 'Host: www.gedanken.demon.co.uk' >> $(SPOOLDIR)/outgoing/Owwwoffle-browser ;
- echo 'Accept: */*' >> $(SPOOLDIR)/outgoing/Owwwoffle-browser ;
- echo '' >> $(SPOOLDIR)/outgoing/Owwwoffle-browser ;
- awk 'BEGIN{printf("http://www.gedanken.demon.co.uk/wwwoffle/version-2.5/browser.html");}' > $(SPOOLDIR)/outgoing/Uwwwoffle-browser < /dev/null
- install_html : html
- @[ ! -x $(SPOOLDIR)/html.old ] ||
- (echo "WWWOFFLE: " ;
- echo "WWWOFFLE: There is already a directory $(SPOOLDIR)/html.old - remove it and re-run make" ;
- echo "WWWOFFLE: " ;
- exit 1 )
- [ ! -x $(SPOOLDIR)/html ] || mv $(SPOOLDIR)/html $(SPOOLDIR)/html.old
- [ -x $(SPOOLDIR)/html ] || mkdir $(SPOOLDIR)/html
- tar cf $(SPOOLDIR)/html.tar html && cd $(SPOOLDIR) && tar xpf html.tar && rm html.tar
- [ "x$(LANG)" = "x" ] || [ ! -d lang-$(LANG) ] || ( cd lang-$(LANG) &&
- tar cf $(SPOOLDIR)/html.tar html && cd $(SPOOLDIR) && tar xpf html.tar && rm html.tar )
- cd $(SPOOLDIR)/html && ./fixup-install.sh $(SPOOLDIR) $(LOCALHOST) && rm ./fixup-install.sh
- # Now fix the permissions that tar preserved, we needed to use 'tar xpf' to get round root's umask.
- # These two will fail unless you are root, that is OK because the owner is already you.
- -chown -R 0 $(SPOOLDIR)/html > /dev/null 2>&1
- -chgrp -R 0 $(SPOOLDIR)/html > /dev/null 2>&1
- install_config :
- sed -e 's%SPOOLDIR%$(SPOOLDIR)%' -e 's%CONFDIR%$(CONFDIR)%' < wwwoffle.conf > wwwoffle.conf.install
- [ -x $(CONFDIR) ] || $(INSTALL) -d -m 750 $(CONFDIR)
- @[ ! -f $(CONFDIR)/wwwoffle.conf ] ||
- (echo "WWWOFFLE: " ;
- echo "WWWOFFLE: There is already a configuration file $(CONFDIR)/wwwoffle.conf." ;
- echo "WWWOFFLE: Run 'perl upgrade-config.pl $(CONFDIR)/wwwoffle.conf' to upgrade it." ;
- echo "WWWOFFLE: " )
- [ ! -f $(CONFDIR)/wwwoffle.conf ] || $(INSTALL) -c -m 640 wwwoffle.conf.install $(CONFDIR)/wwwoffle.conf.install
- [ -f $(CONFDIR)/wwwoffle.conf ] || $(INSTALL) -c -m 640 wwwoffle.conf.install $(CONFDIR)/wwwoffle.conf
- install_fixup-win32:
- for file in $(INSTDIR)/doc/* $(CONFDIR)/README.win32 ; do
- [ -f $$file ] && awk '{print $$0 "r";}' < $$file > $$file.txt && rm -f $$file ;
- done
- rm -f $(SPOOLDIR)/html/index.html && ln $(SPOOLDIR)/html/Welcome.html $(SPOOLDIR)/html/index.html
- cp ./contrib-win32/*.bat $(INSTDIR)
- ########