makefile
上传用户:huihesys
上传日期:2007-01-04
资源大小:3877k
文件大小:13k
- # CVS ID: $Id: makefile,v 1.6 2000/04/06 08:02:01 wastl Exp $
- # Makefile for JWebMail
- #
- # Copyright (C) 2000 Sebastian Schaffert
- #
- # This program is free software; you can redistribute it and/or
- # modify it under the terms of the GNU General Public License
- # as published by the Free Software Foundation; either version 2
- # of the License, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- .PHONY: compile compile-fast clean contrib dist dist-bin dist-src jar-fast jar
- .PHONY: run doc parser readme xml
- SHELL=/bin/bash
- SUBDIRS_JAR_COMMON=ui ui/html ui/xml server server/http debug config misc/ storage storage/simple xml/
- SUBDIRS_JAR_STANDALONE=standalone
- SUBDIRS_JAR_SERVLET=servlet
- FILES_JAR_POP3=dog/mail/util/*.class dog/mail/pop3/*.class META-INF/
- FILES_JAR_MBOX=dog/mail/util/*.class dog/mail/mbox/*.class META-INF/
- FILES_JAR_NNTP=dog/mail/nntp/*.class dog/util/*.class dog/mail/util/*.class META-INF/
- SUBDIRS_DISTCLEAN=standalone/
- # Make those before compiling
- SUBDIRS_PARSER=standalone/
- # Make those after compiling
- SUBDIRS_DATA=
- LANGUAGES=en
- DEFAULT_LANG=en
- THEMES=default
- TAR=/bin/tar
- UNZIP=unzip
- ZIP=zip
- # BSD compatible install utility
- INSTALL=install
- BASEDIR:=$(shell cd .. && pwd)
- CONTRIBDIR:=$(shell cd ../contrib && pwd)
- LIBDIR:=$(shell cd ../lib && pwd)
- DATADIR:=$(shell cd ../data && pwd)
- PKGDIR="net/wastl/webmail"
- VERSION=$(shell grep "String VERSION" net/wastl/webmail/server/WebMailServer.java | cut --delimiter=""" -f 2)
- # Usage of javac is default now
- #JAVAC="javac"
- # Warning: jikes seems to produce some weird code on Solaris :-(
- JAVAC=jikes
- # Which java interpreter to use
- JAVA=java
- # Generate debugging information
- JFLAGS=-g
- # Show deprecated API usage
- #JFLAGS="-deprecation"
- # Enable to do optimization
- #JFLAGS="-O"
- # Use JDK's jar, tool
- #JAR=jar
- # or try fastjar (http://fastjar.sourceforge.net)
- #JAR=fastjar
- JAR=/usr/lib/jdk1.2.2/bin/jar
- JAVACUP="$(JAVA) -classpath $(CONTRIBDIR)/compile/JavaCUP.jar:${CLASSPATH} java_cup.Main -nowarn"
- JFLEX="$(JAVA) -classpath $(CONTRIBDIR)/compile/JFlex.jar:${CLASSPATH} JFlex.Main -q"
- XSLT=$(JAVA) -classpath $(CONTRIBDIR)/xalan.jar:$(CONTRIBDIR)/xerces.jar:${CLASSPATH} org.apache.xalan.xslt.Process
- all: install
- compile:
- @if [ "${JAVAC}" = "jikes" ]; then ( echo "*** Warning: jikes seems to produce some weird code. Please use javac. ***" ) fi;
- @echo ================================================================ ;
- echo === Compiling all java files for WebMail ${VERSION} ;
- echo ================================================================
- @find . -name "*.java" | xargs ${JAVAC} -classpath .:$(CONTRIBDIR)/servlet-2.0.jar:$(LIBDIR)/mail.jar:$(LIBDIR)/ssl/itissl.jar:$(LIBDIR)/activation.jar:$(LIBDIR)/gnu-regexp-1.0.8.jar:$(LIBDIR)/java_cup.jar:$(PKGDIR)/authenticators/:$(PKGDIR)/plugins/:$(LIBDIR)/mm.mysql.jar:$(LIBDIR)/xalan.jar:$(LIBDIR)/xerces.jar:$$CLASSPATH ${JFLAGS}
- parser:
- @for i in ${SUBDIRS_PARSER}; do
- (
- echo "make[1]: Entering directory `$(PKGDIR)/$$i'" ;
- cd $(PKGDIR)/$$i ;
- JAVACUP=${JAVACUP} JFLEX=${JFLEX} make parser;
- echo "make[1]: Leaving directory `$(PKGDIR)/$$i'" ;
- ) ;
- done
- contrib:
- @echo ================================================================ ;
- echo === Unpacking libraries and support files for WebMail ${VERSION} ;
- echo ================================================================
- @echo "- unzipping JavaMail API (v1.1.3) ..."
- -@rm -f $(LIBDIR)/mail.jar
- @${UNZIP} -j -q -d $(LIBDIR) $(CONTRIBDIR)/javamail113.zip ./javamail-1.1.3/mail.jar
- @${UNZIP} -j -q -d $(BASEDIR) $(CONTRIBDIR)/javamail113.zip ./javamail-1.1.3/LICENSE.txt
- @mv $(BASEDIR)/LICENSE.txt $(BASEDIR)/LICENSE.javamail
- @echo "- unzipping JavaBeans Activation Framework (v1.0.1) ..."
- -@rm -f $(LIBDIR)/activation.jar
- @${UNZIP} -j -q -d $(LIBDIR) $(CONTRIBDIR)/jaf101.zip ./jaf-1.0.1/activation.jar
- @${UNZIP} -j -q -d $(BASEDIR) $(CONTRIBDIR)/jaf101.zip ./jaf-1.0.1/LICENSE.txt
- @mv $(BASEDIR)/LICENSE.txt $(BASEDIR)/LICENSE.jaf
- @echo "- creating lib/ and lib/ssl/ directories..."
- @$(INSTALL) -d -m 0755 $(LIBDIR)
- @$(INSTALL) -d -m 0755 $(LIBDIR)/ssl
- @echo "- copying ITI-SSL library..."
- @$(INSTALL) -m 0644 $(CONTRIBDIR)/itissl.jar $(LIBDIR)/ssl/
- @echo "- copying JSDK library..."
- @$(INSTALL) -m 0644 $(CONTRIBDIR)/servlet-2.0.jar $(LIBDIR)/
- @echo "- copying Xerces XML parser..."
- @$(INSTALL) -m 0644 $(CONTRIBDIR)/xerces.jar $(LIBDIR)/
- @echo "- copying Xalan XSL Processor..."
- @$(INSTALL) -m 0644 $(CONTRIBDIR)/xalan.jar $(LIBDIR)/
- @echo "- copying GNU RegExp package..."
- @$(INSTALL) -m 0644 $(CONTRIBDIR)/gnu-regexp-1.0.8.jar $(LIBDIR)
- @echo "- copying JavaCUP parser generator support classes..."
- @$(INSTALL) -m 0644 $(CONTRIBDIR)/java_cup.jar $(LIBDIR)
- @echo "- copying MySQL library classes..."
- @$(INSTALL) -m 0644 $(CONTRIBDIR)/mm.mysql*.jar $(LIBDIR)
- @echo "- copying mime.types ..."
- @$(INSTALL) -m 0644 $(CONTRIBDIR)/mime.types $(LIBDIR)
- install: clean contrib parser install-fast
-
- jar-fast: compile
- @echo "Creating lib/ directory ... ";
- $(INSTALL) -d -m 0755 $(LIBDIR)
- @echo "Creating WebMail distribution (JAR) in `$(BASEDIR)' ..." ;
- -@rm -f $(LIBDIR)/webmail*.jar
- -@rm -fR $(LIBDIR)/plugins
- -@rm -fR $(LIBDIR)/authenticators
- @JAR_FILES=" ";
- for i in ${SUBDIRS_JAR_COMMON}; do
- JAR_FILES="$$JAR_FILES $(PKGDIR)/$$i/*.class" ;
- done ;
- $(JAR) cf $(LIBDIR)/webmail-common.jar $$JAR_FILES ;
- JAR_FILES=" ";
- for i in ${SUBDIRS_JAR_STANDALONE}; do
- JAR_FILES="$$JAR_FILES $(PKGDIR)/$$i/*.class" ;
- done ;
- $(JAR) cf $(LIBDIR)/webmail-standalone.jar $$JAR_FILES ;
- JAR_FILES=" ";
- for i in ${SUBDIRS_JAR_SERVLET}; do
- JAR_FILES="$$JAR_FILES $(PKGDIR)/$$i/*.class" ;
- done ;
- $(JAR) cf $(LIBDIR)/webmail-servlet.jar $$JAR_FILES ;
- echo "Creating JAR-archives for www.dog.net.uk JavaMail providers (POP3/MBOX/NNTP) ..." ;
- $(JAR) cf $(LIBDIR)/pop3.jar $(FILES_JAR_POP3) ;
- $(JAR) cf $(LIBDIR)/mbox.jar $(FILES_JAR_MBOX) ;
- $(JAR) cf $(LIBDIR)/nntp.jar $(FILES_JAR_NNTP) ;
- echo "Creating lib/plugins/ and lib/authenticators/ directories ..." ;
- $(INSTALL) -m 0755 -d $(LIBDIR)/plugins ;
- $(INSTALL) -m 0755 -d $(LIBDIR)/authenticators ;
- echo "Copying Plugins to lib/plugins/ ..." ;
- $(INSTALL) -m 0644 $(PKGDIR)/plugins/*.class $(LIBDIR)/plugins/ ;
- echo "Copying Authenticators to lib/authenticators/ ..." ;
- $(INSTALL) -m 0644 $(PKGDIR)/authenticators/*.class $(LIBDIR)/authenticators/
- install-fast: jar-fast xml
- xml:
- @echo ================================================================ ;
- echo === Installing datafiles ;
- echo ================================================================ ;
- echo "* creating data/ directory ..." ;
- $(INSTALL) -d -m 0750 $(DATADIR) ;
- echo "* copying webmail.xml configuration file to data/ ..." ;
- $(INSTALL) --backup=numbered -m 0640 $(PKGDIR)/data/xml/webmail.xml $(DATADIR) ;
- echo "* creating lib/xml/ directory ..." ;
- $(INSTALL) -d -m 0755 $(LIBDIR)/xml ;
- echo "* copying XML DTDs to lib/xml/ ..." ;
- $(INSTALL) -m 0644 $(PKGDIR)/data/xml/*.dtd $(LIBDIR)/xml/ ;
- echo "* copying XML data files to lib/xml/ ... " ;
- $(INSTALL) -m 0644 $(PKGDIR)/data/xml/mysql_statements.xml $(LIBDIR)/xml/ ;
- $(INSTALL) -m 0644 $(PKGDIR)/data/xml/userdata.xml $(LIBDIR)/xml/ ;
- $(INSTALL) -m 0644 $(PKGDIR)/data/xml/usermodel_template.xml $(LIBDIR)/xml/ ;
- $(INSTALL) -m 0644 $(PKGDIR)/data/xml/generic_template.xml $(LIBDIR)/xml/ ;
- echo "* creating lib/templates/ directory ..." ;
- $(INSTALL) -d -m 0755 $(LIBDIR)/templates ;
- echo "* Copying XML template files to lib/templates/ ..."
- @for lang in ${LANGUAGES}; do
- echo -n " - language $$lang ... " ;
- $(INSTALL) -d -m 0755 $(LIBDIR)/templates/$$lang ;
- for theme in $(THEMES); do
- $(INSTALL) -d -m 0755 $(LIBDIR)/templates/$$lang/$$theme ;
- $(INSTALL) -d -m 0755 $(LIBDIR)/templates/$$lang/$$theme/images ;
- $(INSTALL) -m 0644 $(PKGDIR)/data/xml/$$lang/$$theme/*.x[ms]l $(LIBDIR)/templates/$$lang/$$theme ;
- $(INSTALL) -m 0644 $(PKGDIR)/data/xml/$$lang/$$theme/images/*.[pjg]?? $(LIBDIR)/templates/$$lang/$$theme/images ;
- done;
- echo " done." ;
- done;
- echo -n " - default language ($(DEFAULT_LANG)) ... ";
- rm -f $(LIBDIR)/templates/default ;
- ln -s $(DEFAULT_LANG) $(LIBDIR)/templates/default ;
- echo " done." ;
- echo "* Copying locale specific resources to lib/templates/ ..." ;
- $(INSTALL) -m 0644 $(PKGDIR)/data/xml/resources.xml $(LIBDIR)/templates/ ;
- $(INSTALL) -m 0644 $(PKGDIR)/data/xml/resource.dtd $(LIBDIR)/templates/ ;
- echo -n "Finished on " ;
- date
- doc: readme
- @echo ================================================================ ;
- echo === Generating Java Documentation for WebMail ;
- echo ================================================================
- @javadoc -use -d doc/javadoc/ -private -splitindex -windowtitle "WebMail Java Documentation" -classpath ${CLASSPATH}:.. net.wastl.webmail.server net.wastl.webmail.config net.wastl.webmail.server.http net.wastl.webmail.data net.wastl.webmail.debug net.wastl.webmail.misc net.wastl.webmail.ui net.wastl.webmail.ui.html net.wastl.webmail.server.admin -group "WebMail Core" net.wastl.webmail.* net/wastl/webmail/plugins/*.java net/wastl/webmail/authenticators/*.java
- clean:
- @echo ================================================================ ;
- echo === Deleting all class files ;
- echo ================================================================
- -@find . -name "*.class" | xargs rm -f
- @echo ================================================================ ;
- echo === Cleaning lib/ ;
- echo ================================================================
- -@rm -fR $(LIBDIR)/*
- -@rm -f $(BASEDIR)/LICENSE.*
- distclean: clean
- @echo ================================================================ ;
- echo === Deleting *~, *# and core;
- echo ================================================================
- -@find $(BASEDIR)/ -name "*~" | xargs rm -f
- -@find $(BASEDIR) -name "*#" | xargs rm -f
- -@find $(BASEDIR)/ -name "core" | xargs rm -f
- @echo ================================================================ ;
- echo === Deleting javadoc;
- echo ================================================================
- @rm -fR $(BASEDIR)/src/doc/javadoc
- @for i in ${SUBDIRS_DISTCLEAN}; do
- (
- echo ;
- echo ================================================================ ;
- echo === Cleaning $(PKGDIR)/$$i ;
- echo ================================================================ ;
- echo ;
- make -C $(PKGDIR)/$$i distclean ;
- ) ;
- done
- @echo ================================================================ ;
- echo === Cleaning data/ ;
- echo ================================================================
- -@rm -fR $(DATADIR)/*~
- -@rm -fR $(DATADIR)/*.xml
- -@rm -fR $(DATADIR)/*.log
- dist-bin: install
- @echo ================================================================ ;
- echo === Creating WebMail ${VERSION} binary distribution ;
- echo ================================================================
- @cd ../.. ;
- echo "Creating tar archive ..." ;
- ${TAR} cf ${DISTDIR}/webmail-${VERSION}-binary.tar webmail/bin/* webmail/COPYING webmail/Changes webmail/README* webmail/LICENSE.* webmail/data/* webmail/lib/* webmail/webmail-servlet.properties ;
- @COMPRESS=`which bzip2 > /dev/null 2>&1; if [ $$? = 0 ]; then which bzip2; else which gzip > /dev/null 2>&1; if [ $$? = 0 ]; then which gzip; else which compress; fi; fi`;
- echo "Compressing with $$COMPRESS ..." ;
- $$COMPRESS -f ${DISTDIR}/*.tar
- @echo ================================================================
- dist-src: distclean
- @echo ================================================================ ;
- echo === Creating WebMail ${VERSION} source distribution ;
- echo ================================================================
- @cd ../.. ;
- echo "Creating tar archive (complete distribution) ..." ;
- ${TAR} cf ${DISTDIR}/webmail-${VERSION}-source.tar webmail/* ;
- echo "Creating tar archive (distribution without contrib) ..." ;
- ${TAR} cfX ${DISTDIR}/webmail-${VERSION}-source-nocontrib.tar webmail/nocontrib.excl webmail/* ;
- echo "Creating tar archive (contrib only) ..." ;
- ${TAR} cf ${DISTDIR}/webmail-${VERSION}-contrib.tar webmail/contrib/* ;
- cd webmail
- @COMPRESS=`which bzip2 > /dev/null 2>&1; if [ $$? = 0 ]; then which bzip2; else which gzip > /dev/null 2>&1; if [ $$? = 0 ]; then which gzip; else which compress; fi; fi`;
- echo "Compressing with $$COMPRESS ..." ;
- $$COMPRESS -f ${DISTDIR}/*.tar
- dist: dist-src dist-bin
- readme:
- @echo "================================================================"
- @echo "== Creating WebMail README.html from XML sources ... =="
- @echo "================================================================"
- @${XSLT} -IN $(BASEDIR)/src/doc/readme/README.xml -XSL $(BASEDIR)/src/doc/readme/README.xsl -OUT $(BASEDIR)/README.html