Commit 8fd1257a authored by Guenter Paul Peters's avatar Guenter Paul Peters
Browse files

copied from mfc

git-svn-id: https://svn.math.tu-berlin.de/svn/jtem@154 f5b180c5-49ee-4939-b20e-b6ed35f0f7b7
parent 1fc028d6
#base name of the project
NAME=moebiusViewer
lib: cls
cd classes; jar cf ../moebiusViewer.jar `find . -name '*.class'`
#space separated list of source directories
SRCDIRS=src
cls:
if [ ! -d classes ]; then mkdir classes; fi
javac -classpath `echo lib/*.jar|tr \ :` -d classes/ \
`find src -name '*.java'`
#where to put the binaries, also used to retrieve the binaries for the release archives
BINDIR=classes
javadoc:
if [ ! -d javadocs ]; then mkdir javadocs; fi
javadoc -d javadocs -classpath classes:`echo lib/*.jar|tr \ :` -sourcepath src -protected \
-windowtitle "moebiusViewer documentation" -doctitle "moebiusViewer" \
-nodeprecated -nodeprecatedlist `find src/moebiusViewer -type d -a ! -name CVS | sed -e 'y/\//./' -e 's/src\.\(.*\)/\1/'`
#where to put the generated javadoc
DOCDIR=doc
clean:
rm -f `find src -name "*.class"`
if [ -e moebiusViewer.jar ]; then rm -f moebiusViewer.jar; fi
if [ -d classes ]; then rm -fr classes; fi
if [ -d javadocs ]; then rm -fr javadocs; fi
#the snippets for the webpage are put here
WEBDIR=web
#the html page to read the wabsnippets of (usually a package.html)
PACKAGEHTML=$(DOCDIR)/de/jtem/$(NAME)/package-summary.html
#location of the web site, may be empty
SERVER=
#directory of the website on the server, or local if SERVER is empty
SRVDIR=/net/www/pub/jtem/test
#directory for the dependencies
LIBDIR=lib
#a place to put the archives that constitute a release, before copy to
#web site
RELDIR=release
#directories of the JUnit tests, all files that match Test*.java or *Test.java will be executed
TESTDIR=test
TESTBINDIR=$(TESTDIR)
#where to find junit.jar
JUNIT=$(shell locate junit.jar | grep '/junit.jar' | tail --lines=1)
#compile options
JAVACOPTS=-target 1.5 -source 1.5
#javadoc options
JAVADOCOPTS= -author -protected -nodeprecated -nodeprecatedlist \
-windowtitle 'de.jtem.$(NAME) package API documentation' \
-header '<a href="http://www.jtem.de/$(NAME)" target="_top">$(NAME)</a> by<br><a href="http://www.jtem.de" target="_top">jTEM</a>' \
-footer '<a href="http://www.jtem.de/$(NAME)" target="_top">$(NAME)</a> by<br><a href="http://www.jtem.de" target="_top">jTEM</a>' \
-bottom '<font size=-1><b><a href="mailto:jtem@math.tu-berlin.de?subject=$(NAME):">jTEM</a></b></font>' \
-link http://java.sun.com/javase/6/docs/api/ \
$(foreach d, $(DEPNAMES), -link $(JTEMURL)/$(d)/api)
#things that are removed recursively by the clean target
CLEAN=$(BINDIR) $(DOCDIR) $(WEBDIR) $(DEPS) $(RELDIR) .testscompiled `find $(TESTDIR) -name '*.class'`
#jtem site url
JTEMURL=http://www.math.tu-berlin.de/jtem
# ----------------------------------
# Everything below should be generic
# ----------------------------------
SOURCEFILES=$(shell find $(SRCDIRS) -name '*.java')
TESTSOURCEFILES=$(shell find $(TESTDIR) -name '*.java' 2> /dev/null)
TESTS=$(shell echo $(TESTSOURCEFILES) \
| sed -n -e '/Test/p' | sed -e 's,$(TESTDIR)/,,g' -e 's/.java//g' -e 'y,/,.,')
DEPNAMES=$(shell cat dependencies.txt 2> /dev/null | grep -v '^\#' )
DEPS=$(patsubst %,$(LIBDIR)/%.jar, $(DEPNAMES))
DOCPACKAGES=$(shell find $(SRCDIRS) -name '*.java' -printf "%h\n" | \
sed -e 'y,/,.,' $(foreach d,$(SRCDIRS), -e 's/$(d)\.//') | sort -u)
DOWNLOADDEPS=$(JTEMURL)/downloads
#copy to SRVDIR
ifeq ($(strip $(SERVER)),)
copy_to_website=cp -a $(1) $(SRVDIR)/$(2)
else
copy_to_website=scp -r $(1) $(SERVER):$(SRVDIR)/$(2)
endif
#execute on SERVER
ifeq ($(strip $(SERVER)),)
exec_on_server=$(1)
else
exec_on_server=ssh $(SERVER) $(1)
endif
#last change date from svn
svndate=svn info $(1) 2> /dev/null \
| sed -n '/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/s/.*\([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\).*/\1/p' \
| tail -n 1
# ---Targets --
.PHONY: help
help:
@cat README
@echo "CURRENT VALUES OF SOME VARIABLES"; echo "================================"; echo
@echo "project name (NAME): $(NAME)"
@echo "sources (SRCDIRS): $(SRCDIRS)"
@echo "compiled classes (BINDIR): $(BINDIR)"
@echo "generated api documentation (DOCDIR): $(DOCDIR)"
@echo "generated snippets for the web site (WEBDIR): $(WEBDIR)"
@echo "package html to produce the web snipptes (PACKAGEHTML): $(PACKAGEHTML)"
@echo "server of the website - may be empty(SERVER): $(SERVER)"
@echo "directory of the web site on the server (SRVDIR): $(SRVDIR)"
@echo "directory for the dependencies - put other archives here too (LIBDIR): $(LIBDIR)"
@echo "directory of release achives (RELDIR): $(RELDIR)"
@echo "directory of JUnit tests (TESTDIR): $(TESTDIR)"
@echo "direcotry of compiled JUnit test (TESTBINDIR): $(TESTBINDIR)"
@echo "junit.jar (JUNIT): $(JUNIT)"
@echo "jtem url (JTEMURL): $(JTEMURL)"
#dependencies will only be checked once a day and wget only fetches them,
#if the files are newer on the server or have different sizes
.PHONY: updatedeps $(DEPS)
updatedeps: $(DEPS)
$(DEPS):
@if [ ! -d $(LIBDIR) ]; then mkdir $(LIBDIR); fi
@cd $(LIBDIR); \
touch .lastUpdateDepsCheck; \
if [ ! -f .lastUpdateDepsPlusADay \
-o .lastUpdateDepsPlusADay -ot .lastUpdateDepsCheck \
$(foreach d, $(subst $(LIBDIR)/,,$(DEPS)), -o ! -f $d) ]; \
then wget --timestamping $(subst $(LIBDIR), $(DOWNLOADDEPS), $(DEPS)); \
touch -t `date --date="+1 day" +%Y%m%d%H%M` .lastUpdateDepsPlusADay; \
fi
#compile the SOURCFILES into BINDIR
.PHONY: binaries
binaries: $(BINDIR)
$(BINDIR): $(SOURCEFILES) | $(DEPS)
@if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); fi
cp=`find $(LIBDIR) -name '*.jar' -printf %p: 2> /dev/null` ; \
javac $(JAVACOPTS) \
`if [ -n "$${cp}" ]; then echo -classpath $${cp}; fi` \
-d $(BINDIR)/ \
$(SOURCEFILES) || { rm -rf $(BINDIR); echo "ERROR: compilation failed, folder \"$(BINDIR)\" removed"; exit 1; }
@touch $(BINDIR)
#compile and run JUnit test form TESTDIR
.PHONY: test
test: .testscompiled
#only runs tests if $(TESTDIR) is non empty
ifneq ($(strip $(TESTDIR)),)
@for test in $(TESTS); do \
echo "- JUnitTest: $$test"; \
java -classpath `find $(LIBDIR) -name '*.jar' -printf %p:`$(JUNIT):$(BINDIR):$(TESTBINDIR) \
junit.textui.TestRunner $$test; \
done
endif
.testscompiled: $(BINDIR) $(TESTSOURCEFILES)
#only compile tests if $(TESTDIR) is non empty
ifneq ($(strip $(TESTDIR)),)
@if [ ! -d $(TESTBINDIR) ]; then mkdir $(TESTBINDIR); fi
javac $(JAVACOPTS) \
-classpath `find $(LIBDIR) -name '*.jar' -printf %p:`$(JUNIT):$(BINDIR) \
-d $(TESTBINDIR)/ \
$(TESTSOURCEFILES)
@touch .testscompiled
endif
#generate api documentation with javadoc
.PHONY: javadoc
javadoc: $(DOCDIR)
$(DOCDIR): $(shell find $(SRCDIRS)) | $(DEPS)
@if [ ! -d $(DOCDIR) ]; then mkdir $(DOCDIR); fi
javadoc $(JAVADOCOPTS) \
-d $(DOCDIR) -classpath $(BINDIR):`find $(LIBDIR) -name '*.jar' -printf %p:` \
-sourcepath `echo $(SRCDIRS) | tr \ :` \
$(DOCPACKAGES)
@touch $(DOCDIR)
#generate web snippets and put them on the server
.PHONY: web
web: $(WEBDIR)/teaser.html $(WEBDIR)/content.html
@for f in $?; do $(call copy_to_website,$$f,$(NAME)/$${f#$(WEBDIR)}); done
@if [ -d $(dir $(PACKAGEHTML))/doc-files ]; then $(call copy_to_website,$(dir $(PACKAGEHTML))/doc-files,$(NAME)/doc-files); fi
@date=`$(call svndate, $(subst -summary,,$(subst $(DOCDIR),$(firstword $(SRCDIRS)),$(PACKAGEHTML))))`; \
if [ "" = "$$date" ]; then date=`date -r $< +%F`; fi; \
$(call exec_on_server,touch -d $$date $(SRVDIR)/$(NAME)/content.html)
$(PACKAGEHTML): $(DOCDIR)
$(WEBDIR)/teaser.html: $(PACKAGEHTML)
@if [ ! -d $(WEBDIR) ]; then mkdir $(WEBDIR); fi
@sed -e '0,/teaser start/d;/teaser end/,$$d' $(PACKAGEHTML) > $(WEBDIR)/teaser.html
@chmod g+rw $(WEBDIR)/teaser.html
$(WEBDIR)/content.html: $(PACKAGEHTML)
@if [ ! -d $(WEBDIR) ]; then mkdir $(WEBDIR); fi
@sed -e '0,/teaser start/d; /START OF BOTTOM NAVBAR/,$$d' \
-e 's,\(\.\./\)\+,$(JTEMURL)/$(NAME)/api/,g' \
$(PACKAGEHTML) > $(WEBDIR)/content.html
@chmod g+rw $(WEBDIR)/content.html
blas.jar: $(BINDIR)
cd $(BINDIR); jar cf ../blas.jar *
.PHONY: debug
debug:
@echo SOURCEFILES=$(SOURCEFILES); echo
@echo DEPS=$(DEPS); echo
@echo TESTSOURCEFILES=$(TESTSOURCEFILES); echo
@echo TESTS=$(TESTS); echo
@echo JUNIT=$(JUNIT); echo
@echo DOCPACKAGES=$(DOCPACKAGES); echo
@echo PACKAGEHTML=$(PACKAGEHTML); echo
.PHONY: clean
clean:
@for f in $(CLEAN); do if [ -e $$f ]; then rm -rf $$f; fi; done
*** Installation
MAKE TARGETS
============
Type make to build the moebiusViewer.jar and put it in your classpath. If you
haven't already included mfc.jar and numericalMethods.jar to your classpath
add these two archives in the lib directory too.
help (default): display the README file
*** oorange nodes
The nodes directory contains various example nodes.
updatedeps: fetch the jars of all jtem projects that this project
depends on (list is read from dependencies.txt) dependencies
will only be checked once a day, to force an update, remove
the corresponding archiv. Add third party archives to the
same directory (default is "lib", see the variable LIBDIR in
the Makefile)
binaries: compile the java classes
*** Building and Cleanup
test: run the JUnit tests
javadoc: generate the api documentation with javadoc
The Makefile supports the following targets:
web: produce and send the snippets for the projectspecific
part of the jtem website
lib (the default)
Create the file moebiusViewer.jar.
clean: remove all generated files (see the variable
CLEAN in the makefile)
cls
Compile the classes only. Do not build the library.
debug: print the values of some generated variables
javadoc
Generate documentation for the core features.
Note that javadoc prior to 1.4b2 does not generate the package overview.
NOTE: The documentation is linked against the java documentation from sun.
This should be changed before generating docs if a local mirror should be used.
clean:
remove the library file moebiusViewer.jar and the generated classes and
documentation.
MAKEFILE CUSTOMIZATION
======================
change the variables at the beginning of the Makefile, or override variables via:
make <VARIABLENAME>="my value" <target>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment