Commit e6179966 authored by Guenter Paul Peters's avatar Guenter Paul Peters
Browse files

copied from ellipticFunctions

git-svn-id: https://svn.math.tu-berlin.de/svn/jtem@84 f5b180c5-49ee-4939-b20e-b6ed35f0f7b7
parent aec34d4c
#base name of the project
NAME=function
#space separated list of source directories
SRCDIRS=src
#where to put the binaries, also used to retrieve the binaries for the release archives
BINDIR=classes
#where to put the generated javadoc
DOCDIR=doc
#the snippets for the webpage are put here
WEBDIR=web
#the html page to read the wabsnippets of (usually a package.html)
PACKAGEHTML=$(subst package.html,package-summary.html,$(subst $(firstword $(SRCDIRS)),$(DOCDIR),$(shell find $(firstword $(SRCDIRS)) -name package.html | tail --lines=1)))
#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 files that constitute a release
RELEASEDIR=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) $(RELEASEDIR) .testscompiled
#jtem site url
JTEMURL=http://www.math.tu-berlin.de/jtem
# -- Everything below should be generic - the same for all jtem projects --
SOURCEFILES=$(shell find $(SRCDIRS) -name '*.java')
TESTSOURCEFILES=$(shell find $(TESTDIR) -name '*.java')
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 | 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 $(1) $(SRVDIR)/$(2)
else
copy_to_website=scp $(1) $(SERVER):$(SRVDIR)/$(2)
endif
#execute on SERVER
ifeq ($(strip $(SERVER)),)
exec_on_server=$(1)
else
exec_on_server=ssh $(SERVER) $(1)
endif
.PHONY: help
help:
@cat README
#dependencies will only be checked once a day and wget only fetches them,
#if the files are newer on the server
.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
.PHONY: binaries
binaries: $(BINDIR)
$(BINDIR): $(SOURCEFILES) | $(DEPS)
@if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); fi
javac $(JAVACOPTS) \
-classpath `find $(LIBDIR) -name '*.jar' -printf %p:` \
-d $(BINDIR)/ \
$(SOURCEFILES)
@touch $(BINDIR)
.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
.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)
.PHONY: web
web: $(WEBDIR)/teaser.html $(WEBDIR)/content.html
@for f in $?; do $(call copy_to_website,$$f,$(NAME)/$${f#$(WEBDIR)}); done
@$(call exec_on_server,touch $(SRVDIR)/$(NAME)/index.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
MAKE TARGETS
============
help (default): display the README file
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
binaries: compile the java classes
test: run the JUnit tests
javadoc: generate the api documentation with javadoc
web: produce and send the snippets for the projectspecific part of the jtem website
clean: remove all generated files (look for the variable CLEAN in the makefile)
debug: print the values of some generated variables
MAKEFILE CUSTOMIZATION
======================
change the variables at the beginning of the Makefile, or override variables via:
make <VARIABLENAME>="the value I like best" <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