Makefile for adding servlets

I recently went through the exercise of taking the stock Jigsaw 2.0
beta 1 distribution and adding servlet support to it.  Since I had to
do this a few times before I got it right, I made a Unix Makefile to
do the needful.  In the hopes that it helps someone else avoid the
mistakes I made, I'm enclosing the Makefile.  Note that this Makefile
assumes you have brought over
	jigsaw_2.0beta1.tar (from ftp.w3c.org)
	servlet.zip (from <bmahe@w3.org>'s recent message to this list)
	jsdk20-solaris2-sparc.tar (from Javasoft)
and have them in the same directory as the Makefile.  Also note that
the Makefile assumes tar and zip files, not compressed or gziped
files.  Good luck.



# $Id: Makefile,v 1.7 1998/05/27 19:59:10 dorab Exp $
# Makefile for a servlet Jigsaw.
# ftp://ftp.w3c.org/pub/jigsaw/jigsaw_2.0beta1.tar.gz
# Make sure you also have servlet.zip and jsdk20-solaris2-sparc.tar

jsdk = JSDK2.0/lib/jsdk.jar

srcdir = Jigsaw/src/classes
mkdir = Jigsaw/src/makefiles
instdir = Jigsaw/classes

sfile1 = $(srcdir)/org/w3c/jigsaw/Makefile
sfile2 = $(srcdir)/org/w3c/jigsaw/ssi/commands/DefaultCommandRegistry.java
sfile3 = $(srcdir)/org/w3c/jigsaw/ssi/Makefile

mfile1 = $(srcdir)/Makefile

default :
	@echo You should have the following in the current directory
	@echo '    ' jigsaw_2.0beta1.tar servlet.zip jsdk20-solaris2-sparc.tar
	@echo \`make setup\' to untar jigsaw, untar jsdk, and unzip servlet
	@echo \`make servletmods\' to make changes for servlets
	@echo \`make fixmake\' to fix $(mfile1)
	@echo \`make jigsaw.zip\' to compile everything
	@echo \`make install\' to install jigsaw.zip

setup : jigsaw_2.0beta1.tar servlet.zip jsdk20-solaris2-sparc.tar
	$(MAKE) realclean
	tar xf jsdk20-solaris2-sparc.tar
	tar xf jigsaw_2.0beta1.tar
	(cd Jigsaw/src/classes && unzip -ou ../../../servlet.zip)

fixmake : $(mfile1).orig

$(mfile1).orig : $(mfile1)
	@echo 'Fixing $(mfile1) if necessary...'
	@if test ! -r $@ ; \
	then \
		mv $(mfile1) $@ ; \
		sed -e 's|w3c|org|g' < $@ > $(mfile1) ; \
	fi

servletmods : $(sfile1).orig $(sfile2).orig $(sfile3).orig

$(sfile1).orig : $(sfile1)
	@echo 'Fixing $(sfile1) if necessary...'
	@if test ! -r $@ ; \
	then \
		mv $(sfile1) $@ ; \
		sed -e 's/^#	servlet/	servlet/' < $@ > $(sfile1) ; \
	fi

$(sfile2).orig : $(sfile2)
	@echo 'Fixing $(sfile2) if necessary...'
	@if test ! -r $@ ; \
	then \
		mv $(sfile2) $@ ; \
		sed -e '/^\/\/[ 	]*new .*ServletCommand/s|^//|  |' \
			< $@ > $(sfile2) ; \
	fi

$(sfile3).orig : $(sfile3)
	@echo 'Fixing $(sfile3) if necessary...'
	@if test ! -r $@ ; \
	then \
		mv $(sfile3) $@ ; \
		sed -e 's/^#	servlet/	servlet/' < $@ > $(sfile3) ; \
	fi

jigsaw.zip : 
	rm -rf org && mkdir org
	rm -f jigsaw.zip
	p=`pwd` && cd $(srcdir) && \
	CLASSPATH=$$p/$(jsdk):$$p/$(srcdir) \
	$(MAKE) \
		MAKEDIR=$$p/$(mkdir) \
		TARGET=$$p

install :
	rm -f $(dest)$(instdir)/jigsaw.zip
	cp jigsaw.zip $(dest)$(instdir)

clean :
	-(cd $(srcdir) && $(MAKE) $@)
	rm -rf org

realclean : clean
	rm -rf Jigsaw

Received on Thursday, 28 May 1998 18:11:45 UTC