head	1.9;
access;
symbols
	JSERV_00_09_09:1.9;
locks; strict;
comment	@# @;


1.9
date	98.01.20.19.32.56;	author jonbolt;	state Exp;
branches;
next	1.8;

1.8
date	98.01.20.08.06.31;	author jonbolt;	state Exp;
branches;
next	1.7;

1.7
date	98.01.20.07.00.48;	author jonbolt;	state Exp;
branches;
next	1.6;

1.6
date	98.01.20.05.07.30;	author ian;	state Exp;
branches;
next	1.5;

1.5
date	98.01.20.03.26.41;	author ian;	state Exp;
branches;
next	1.4;

1.4
date	98.01.17.09.55.05;	author ian;	state Exp;
branches;
next	1.3;

1.3
date	98.01.17.04.56.12;	author francis;	state Exp;
branches;
next	1.2;

1.2
date	98.01.17.04.55.11;	author francis;	state Exp;
branches;
next	1.1;

1.1
date	98.01.17.03.05.50;	author francis;	state Exp;
branches;
next	;


desc
@@


1.9
log
@added a comment for installing as /usr/ucb/install for solaris
@
text
@############ START of System Configuration ###############

###### Installation Tree
## General installation tree
PREFIX=/usr/local/java-lib/jserv

## Where is the site CLASSPATH
CLASSES_DIR=$(PREFIX)/classes

## Where servlets should be installed
SERVLETS_DIR=$(CLASSES_DIR)

## Where are Java wrapper executable
BIN_DIR=$(PREFIX)/bin

## Where site documentation is stored.
DOC_DIR=$(PREFIX)/api

## If you want to set the classpath manually, uncoment next line
## and make sure that it includes the jdk and jsdk classes
#CLASSPATH=/usr/local/java-lib/JSDK1.0.1/lib/classes.zip:/usr/local/jdk/lib/classes.zip

##### Program Configuration
JAVAC=javac
JCFLAGS=-deprecation
OPTIM=-O
JAVACC=javacc
JCCFLAGS=
JJTREE=jjtree
JTTFLAGS=
JAVADOC=javadoc
JDFLAGS=-author -version #-noindex -notree
ZIP=zip

## Solaris: Make sure your path is using /usr/ucb/install
INSTALL=install

### END of System configuration ####

################## Start of Package Configuration ###########
## This is where the Application Developper 
## configures the the dependencies required to build the 
## package.

## To comply with JLS this should be the reverse FQDN  
## of the organization responsiable for the package.
PACKAGE_PREFIX := org.apache

## This is the top package that contains all others.
PACKAGE := jserv

## A list of subpackages.
SUB_PACKAGES := test

###### Classes Configuration
## List of classes to compile. You can only list the classes that aren't 
## referenced from anywhere for javac compiles automatically depending
## classes.
CLASSES=JServConnection.class JServServletManager.class JServHandler.class   \
	JServClassLoader.class JServContext.class JServLock.class \
	JServSendError.class JServSignals.class \
	SSIServlet.class  \
	BadClassTest.class ClassLoaderTest.class ServletMonitor.class \
	LoadClassTest.class

## Classes that are servlets and that shouldn't be installed in
## in the classpath.
SERVLETS=

###### Resource Configuration
## List of resource files that should be installed in the 
## classpath.
RESOURCES=

###### Templates configuration
## The name of the templates package
TEMPLATES_NAME=

## List of resource files that should be installed with 
## the servlet.
SERVLET_RESOURCES=

###### Grammar Configuration
## List source files that are generated by JavaCC
PARSER=

## List grammar file that are generated by JJTree
GRAMMARS=

###### Distribution Configuration
## If this variable is set, it will produce a zip file containing all
## the classes. This file can be placed in a classpath.
CLASSES_ZIP=

## If this variable is set, it will produce a zip containing all
## the servlets. This file could then be in a servlet repository.
SERVLET_ZIP=

## Name of the Tar file distribution to make.
TAR_DIST=$(PACKAGE).tar.gz

## Name of the Zip file distribution to make.
ZIP_DIST=$(PACKAGE).zip

###### Scripts Configuration
## List of script that wraps around java exectuable classes.
SCRIPTS=

############# END of Package configuration #######################

## Set required flags on compilers.
ifneq "$(strip $(SERVLETS))" ""
JCFLAGS += -classpath classes:servlets:src:$(CLASSPATH)
JDFLAGS += -d doc -classpath classes:servlets:src:$(CLASSPATH)
else
JCFLAGS += $(OPTIM) -classpath src:$(CLASSPATH)
JDFLAGS += -d doc -classpath classes:src:$(CLASSPATH)
endif

## Compute the FQDN of all included packages.
ifneq "$(strip $(PACKAGE_PREFIX) )" ""
  fqdn = $(PACKAGE_PREFIX).$(PACKAGE)
else
  fqdn = $(PACKAGE)
endif

fqdn_name = $(fqdn).$(package)
fqdn_packages := $(fqdn) $(foreach package,$(SUB_PACKAGES),$(fqdn_name))

## Compute the path of all package relative to classes/ and src/
packages_path := $(foreach path,$(fqdn_packages),$(subst .,/,$(path)))

## Compute the list of directory to search
ifneq "$(strip $(SERVLETS))" ""
VPATH := $(addprefix src/,$(packages_path)) \
	 $(addprefix classes/,$(packages_path)) \
	 $(addprefix servlets/,$(packages_path)) \
	bin
else
VPATH := $(addprefix src/,$(packages_path)) \
	 $(addprefix classes/,$(packages_path)) \
	bin
endif 

## Function that find various files
compiled_classes=$(subst $$,\$$,$(shell find classes -name \*.class -print))

resources=$(subst $$,\$$,$(shell find classes -name \*.properties -print))

javadoc_files=$(subst $$,\$$,$(shell find doc -name \*$(fqdn)\*.html -print))

template_files=$(shell find templates -name \*tmpl -print)

installed_doc=$(subst $$,\$$,$(shell find $(DOC_DIR) -name \*$(fqdn)\*.html -print))

source_files=$(subst $$,\$$,$(shell find src -path CVS -prune -o -print) ) 

everything=$(subst $$,\$$,$(shell find . -name CVS -prune -o -print) ) 

ifneq "$(strip $(SERVLETS))" ""
compiled_servlets=$(subst $$,\$$,$(shell find servlets -name \*.class -print))

servlet_resources=$(subst $$,\$$,$(shell find servlets -name \*.properties -print))

SERVLETS_DEP=$(SERVLETS) $(SERVLETS_ZIP) $(SERVLET_RESOURCES)
else 
SERVLETS_DEP=
endif

## Name of the working directory
dir_name := $(notdir $(shell pwd))

## Start of rules.
all :	classes $(CLASSES) $(RESOURCES) $(CLASSES_ZIP) $(SERVLETS_DEP) mod-jserv

classes :
	mkdir classes

mod-jserv : 
	@@echo "To make mod_jserv, copy mod_jserv.c to your Apache src "
	@@echo "directory. Add the following line to the Configuration file"
	@@echo
	@@echo "Module jserv_module mod_jserv.o"
	@@echo
	@@echo "Run Configure to create a new Makefile, then recompile Apache."

## Generic rule to make everything
$(CLASSES) : %.class : %.java
	$(JAVAC) $(JCFLAGS) -d classes $<

$(SERVLETS) : %.class : %.java
	$(JAVAC) $(JCFLAGS) -d servlets $<

$(PARSER) : %.java : %.jj
	cd $(dir $<); $(JAVACC) $(JCCFLAG) $(notdir $<)

$(GRAMMARS) : %.jj : %.jjt
	cd $(dir $<); $(JJTREE) $(JTTFLAGS) $(notdir $<)

$(RESOURCES) : %.properties : %.rsrc
	$(INSTALL) -d classes/`expr $(dir $<) : 'src/\(.*\)'`
	$(INSTALL) $< classes/`expr $(dir $<) : 'src/\(.*\)'`$(notdir $(basename $<)).properties

$(SERVLET_RESOURCES) : %.properties : %.rsrc
	$(INSTALL) -d servlets/`expr $(dir $<) : 'src/\(.*\)'`
	$(INSTALL) $< servlets/`expr $(dir $<) : 'src/\(.*\)'`$(notdir $(basename $<)).properties

$(SERVLETS_ZIP) : $(SERVLETS) $(SERVLET_RESOURCES)
	cd servlets; zip -0 ../bin/$(@@F) \
	$(foreach file,$(compiled_servlets) $(SERVLET_RESOURCES),\
		$(patsubst servlets/%, %, $(file)))

$(CLASSES_ZIP) : $(CLASSES) $(RESOURCES)
	cd classes; zip -0 ../bin/$(@@F) \
	$(foreach file,$(compiled_classes) $(RESOURCES),\
		$(patsubst classes/%, %, $(file)))

.PHONY: doc \
	dist dist-clean dist-tar dist-zip \
	install install-doc install-classes install-servlets \
	install-templates install-zip \
	uninstall clean

## Creates JavaDoc documentation
doc:
	if [ ! -d doc ]; then mkdir doc; fi
	$(JAVADOC) $(JDFLAGS) $(fqdn_packages)

## Install classes in site classpath
install: all install-bin install-doc install-classes \
	install-servlets install-templates

install-bin: $(SCRIPTS) $(CLASSES_ZIP)
ifneq "$(strip $(SCRIPTS))" ""
	[ -d $(BIN_DIR) ] || mkdir $(BIN_DIR)
	$(INSTALL) $^ $(BIN_DIR)
else
	@@echo Nothing to be done for bin
endif
ifneq "$(strip $(CLASSES_ZIP))" ""
	[ -d $(BIN_DIR) ] || mkdir $(BIN_DIR)
	$(INSTALL) -m 644 $^ $(BIN_DIR)
endif

install-classes: $(CLASSES)
ifneq "$(strip $(CLASSES))" ""
	[ -d $(CLASSES_DIR) ] || mkdir $(CLASSES_DIR)
	for p in $(packages_path); do \
		tmpdir=$(CLASSES_DIR); \
		for i in `echo $$p | sed 's/\// /g'`; \
		do \
			tmpdir=$$tmpdir/$$i; \
			[ -d $$tmpdir ] || mkdir $$tmpdir || exit $$?; \
		done; \
		$(INSTALL) -d $(CLASSES_DIR)/$$p; \
	done
	for f in $(compiled_classes) $(resources); do\
		d=`dirname $$f`;\
		cdir=`expr $$d : 'classes/\(.*\)'`; \
		tmpdir=$(CLASSES_DIR); \
		for i in `echo $$cdir | sed 's/\// /g'`; \
		do \
			tmpdir=$$tmpdir/$$i; \
			[ -d $$tmpdir ] || mkdir $$tmpdir || exit $$?; \
		done; \
		$(INSTALL) -m 644 $$f $(CLASSES_DIR)/$$cdir; \
	done
else
	@@echo Nothing to be done for classes
endif

install-servlets: $(SERVLETS)
ifneq "$(strip $(SERVLETS))" ""
	[ -d $(SERVLETS_DIR) ] || mkdir $(SERVLETS_DIR)
	for p in $(packages_path); do \
		[ -d $(SERVLETS_DIR)/$$p ] || mkdir $(SERVLETS_DIR)/$$p \
		$(INSTALL) -d $(SERVLETS_DIR)/$$p ; \
	done
	for f in $(compiled_servlets) $(servlet_resources); do\
		d=`dirname $$f`;\
		$(INSTALL) -m 644 $$f $(SERVLETS_DIR)/`expr $$d : 'servlets/\(.*\)'`;\
	done
else
	@@echo Nothing to be done for servlets
endif

install-templates: 
ifneq "$(strip $(TEMPLATES_NAME))" ""
	[ -d $(TEMPLATES_DIR) ] || mkdir $(TEMPLATES_DIR)
	for d in $(TEMPLATES_NAME); do\
		[ -d $(TEMPLATES_DIR)/$$d ] || mkdir $(TEMPLATES_DIR)/$$d; \
		$(INSTALL) -d $(TEMPLATES_DIR)/$$d;\
	done
	for f in $(template_files); do\
		d=`dirname $$f`;\
		$(INSTALL) -m 644 $$f $(TEMPLATES_DIR)/`expr $$d : 'templates/\(.*\)'`;\
	done
endif

## Install documentation in site documentation tree.
install-doc:
ifneq "$(javadoc_file)" ""
	[ -d $(DOC_DIR) ] || mkdir $(DOC_DIR)
	$(INSTALL) -m 644 $(javadoc_files) $(DOC_DIR)
endif

## Make distribution
dist : dist-clean dist-tar dist-zip

dist-tar: 
	cd ..; \
	files=`find $(dir_name) -name CVS -prune -o -type f -print`; \
	tar -czvf $(TAR_DIST) $${files}

dist-zip: 
	cd ..; \
	files=`find $(dir_name) -name CVS -prune -o -type f -print`; \
	zip $(ZIP_DIST) $${files}

## Uninstall
uninstall:
	rm -fr $(CLASSES_DIR)/$(subst .,/,$(fqdn))
	rm -fr $(installed_doc)
ifneq "$(strip $(SCRIPTS))" ""
	for p in $(SCRIPTS); do\
	rm -fr $(BIN_DIR)/$$p;\
	done
endif
ifneq "$(strip $(CLASSES_ZIP))" ""
	rm -fr $(BIN_DIR)/$(CLASSES_ZIP)
endif
ifneq "$(strip $(SERVLETS))" ""
	rm -fr $(SERVLETS_DIR)/$(subst .,/,$(fqdn))
endif
ifneq "$(strip $(TEMPLATES_NAME))" ""
	for d in $(TEMPLATES_NAME); do\
		rm -fr $(TEMPLATES_DIR)/$$d;\
	done
endif

## Clean directory
dist-clean:
	rm -fr $(TAR_DIST) $(ZIP_DIST)
	find . -name \*.orig -exec rm -f {} \;
	find . -name \*~ -exec rm -f {} \;

clean: dist-clean
	rm -f $(compiled_classes)
	rm -f $(resources)
	rm -f $(javadoc_files)
ifneq "$(strip $(SERVLETS))" ""
	rm -f $(compiled_servlets)
	rm -f $(servlet_resources)
endif

@


1.8
log
@added ability to javac -O...improved JDFLAGS to be cleaner...
@
text
@a32 1
INSTALL=/usr/ucb/install
d34 3
@


1.7
log
@Added full path to /usr/ucb/install
@
text
@d26 1
d32 1
a32 1
JDFLAGS=-author -version
d112 1
a112 1
JDFLAGS += -d doc -classpath classes:servlets:src:$(CLASSPATH) -noindex -notree
d114 2
a115 2
JCFLAGS += -classpath classes:src:$(CLASSPATH)
JDFLAGS += -d doc -classpath classes:src:$(CLASSPATH) -noindex -notree
d178 1
a178 1
	@@echo "To make mod_jserv, copy mod_jserv.c to your apache src "
@


1.6
log
@fix "find" command line in "make clean"
@
text
@d32 1
a32 1
INSTALL=install
@


1.5
log
@Fix: "install" needed a dependency on "all"
@
text
@d341 2
a342 2
	find -name \*.orig -exec rm -f {} \;
	find -name \*~ -exec rm -f {} \;
@


1.4
log
@Another shot at getting a clean "make install".  This creates subdirectories
if they're not already there.
@
text
@d227 1
a227 1
install: install-bin install-doc install-classes \
@


1.3
log
@Turn-off setting of classpath in Makefile.
@
text
@d232 1
d238 1
d244 1
d246 6
d256 8
a263 1
		$(INSTALL) -m 644 $$f $(CLASSES_DIR)/`expr $$d : 'classes/\(.*\)'`;\
d271 1
d273 1
d286 1
d288 1
d300 1
@


1.2
log
@JServContext now delegates servlets related method to JServServletManager
\-> this means that we don't need to synchronize on the Hashtable anymore,
but can
rely on synchronization at the method level in JServServletManager.

JServServletManager now also restarts itself when its property configuration
file is changed.
@
text
@d21 1
a21 1
CLASSPATH=/usr/local/java-lib/JSDK1.0.1/lib/classes.zip:/usr/local/jdk/lib/classes.zip
@


1.1
log
@Moved Makefile to top of module and made more generic and useful:
- Make doc and install
- Make all classes
@
text
@d21 1
a21 1
#CLASSPATH=/usr/local/java-lib/JSDK1.0.1/lib/classes.zip:/usr/local/jdk/lib/classes.zip
@


