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

now with release target, synced with latest version of the Makefile in jterm

some tests are no JUnit tests yet - excluded

git-svn-id: f5b180c5-49ee-4939-b20e-b6ed35f0f7b7
parent 63830fb2
......@@ -17,20 +17,20 @@ PACKAGEHTML=$(DOCDIR)/de/jtem/$(NAME)/package-summary.html
#location of the web site, may be empty
#directory of the website on the server, or local if SERVER is empty
#directory for the dependencies
#a place to put the archives that constitute a release, before copy to
#web site
#directories of the JUnit tests, all files that match Test*.java or * will be executed
#exclude the following tests
EXCLTESTS=RuppertTest TestLLL TestExactLLL
EXCLTESTS=TestSiegelReduction TestSiegelTransform TestLatticePointsForUniformApproximation TestLatticePointsInEllipsoid TestThetaWithChar
#where to find junit.jar
JUNIT=$(shell locate junit.jar | grep '/junit.jar' | tail --lines=1)
......@@ -56,14 +56,14 @@ JTEMURL=
# ----------------------------------
# Everything below should be generic
# ----------------------------------
# ---------------------------------------------------------------------
# Everything below should be generic (feel free to adapt to your needs)
# ---------------------------------------------------------------------
SOURCEFILES=$(shell find $(SRCDIRS) -name '*.java')
TESTSOURCEFILES=$(shell find $(TESTDIR) -name '*Test*.java' 2> /dev/null)
TESTSOURCEFILES=$(shell find $(TESTDIR) -name '*.java' 2> /dev/null)
ALLTESTS=$(shell find $(TESTDIR) -name '*Test*.java' 2> /dev/null\
| sed -e 's,$(TESTDIR)/,,g' -e 's/.java//g' -e 'y,/,.,' )
et_=$(addprefix %,$(
TESTS=$(filter-out $(et_), $(ALLTESTS))
......@@ -71,28 +71,27 @@ ext_=$(filter $(et_), $(ALLTESTS))
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)
#copy to SRVDIR
#function to copy to SRVDIR
ifeq ($(strip $(SERVER)),)
copy_to_website=cp -a $(1) $(SRVDIR)/$(2)
copy_to_website=cp -a $(1) $(SRVDIR)/$(strip $(2))
copy_to_website=scp -r $(1) $(SERVER):$(SRVDIR)/$(2)
copy_to_website=scp -r $(1) $(SERVER):$(SRVDIR)/$(strip $(2))
#execute on SERVER
#function to execute on SERVER
ifeq ($(strip $(SERVER)),)
exec_on_server=ssh $(SERVER) $(1)
#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
#function to get last change date from svn
svndate=`( svn --xml info $(1) 2> /dev/null | grep "<text-updated>" \
|| svn --xml info $(1) 2> /dev/null | grep "<date>" ) \
| sed -e 's/.*>\(....-..-..\).*/\1/'`
# ---Targets --
......@@ -115,10 +114,12 @@ help:
@echo "directory of compiled JUnit test (TESTBINDIR): $(TESTBINDIR)"
@echo "junit.jar (JUNIT): $(JUNIT)"
@echo "jtem url (JTEMURL): $(JTEMURL)"
# --- updatedeps ----
#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)
......@@ -128,11 +129,14 @@ $(DEPS):
if [ ! -f .lastUpdateDepsPlusADay \
-o .lastUpdateDepsPlusADay -ot .lastUpdateDepsCheck \
$(foreach d, $(subst $(LIBDIR)/,,$(DEPS)), -o ! -f $d) ]; \
then wget --timestamping $(subst $(LIBDIR), $(DOWNLOADDEPS), $(DEPS)); \
then wget --timestamping $(subst $(LIBDIR), $(DOWNLOADDEPS), $(DEPS)) || echo "ERROR: could not reach jTEM site to fetch dependencies!" ;\
touch -t `date --date="+1 day" +%Y%m%d%H%M` .lastUpdateDepsPlusADay; \
# --- binaries ---
#compile the SOURCFILES into BINDIR
.PHONY: binaries
binaries: $(BINDIR)
......@@ -143,8 +147,11 @@ $(BINDIR): $(SOURCEFILES) | $(DEPS)
-d $(BINDIR)/ \
$(SOURCEFILES) || { rm -rf $(BINDIR); echo "ERROR: compilation failed, folder \"$(BINDIR)\" removed"; exit 1; }
@touch $(BINDIR)
# --- test ---
#compile and run JUnit tests form TESTDIR
#compile and run JUnit test form TESTDIR
.PHONY: test
test: .testscompiled
#only runs tests if $(TESTDIR) is non empty
......@@ -157,6 +164,7 @@ ifneq ($(strip $(TESTDIR)),)
@if [ -n "$(ext_)" ]; then echo "WARNING: some tests where exluded, see variable EXCLTESTS"; fi
.testscompiled: $(BINDIR) $(TESTSOURCEFILES)
#only compile tests if $(TESTDIR) is non empty
ifneq ($(strip $(TESTDIR)),)
......@@ -168,10 +176,13 @@ ifneq ($(strip $(TESTDIR)),)
@touch .testscompiled
# --- javadoc ---
#generate api documentation with javadoc
.PHONY: javadoc
javadoc: $(DOCDIR)
$(DOCDIR): $(shell find $(SRCDIRS)) | $(DEPS)
$(DOCDIR): $(shell find $(SRCDIRS) -path "*.svn" -prune -o -print ) | $(DEPS)
@if [ ! -d $(DOCDIR) ]; then mkdir $(DOCDIR); fi
@javadoc $(JAVADOCOPTS) \
-d $(DOCDIR) -classpath $(BINDIR):`find $(LIBDIR) -name '*.jar' -printf %p: 2> /dev/null ` \
......@@ -179,33 +190,95 @@ $(DOCDIR): $(shell find $(SRCDIRS)) | $(DEPS)
@touch $(DOCDIR)
# --- web ---
#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))))`; \
@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)
$(call exec_on_server,touch -d $$date $(SRVDIR)/$(NAME)/content.html $(SRVDIR)/projects.html)
@if [ -f releasnotes.txt ]; then $(call copy_to_website, releasnotes.txt, downloads/$(NAME)); fi
@$(call exec_on_server, find $(SRVDIR) -user `whoami` | xargs chmod g+rw)
$(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 *
# --- release ---
.PHONY: release
release: web test $(DOCDIR) $(RELDIR)/$(NAME).jar $(RELDIR)/$(NAME).tgz $(RELDIR)/$(NAME).zip $(RELDIR)/$(NAME)-api.tgz $(RELDIR)/current.txt
@status=`svn status -u 2>&1 | grep -v "?" | head -n -1`; \
if [ -n "$$status" ]; then \
echo "STOP: Synchronize with repository first!"; exit 1 ; fi
@grep `cat $(RELDIR)/current.txt` releasnotes.txt 1>/dev/null 2>&1 || \
if [ -f releasnotes.txt ]; then mv releasnotes.txt releasnotes-old.txt; fi; \
cat $(RELDIR)/current.txt > releasnotes.txt; \
if [ -f releasnotes-old.txt ]; then cat releasnotes-old.txt >> releasnotes.txt; fi
@$(call copy_to_website, \
$(RELDIR)/$(NAME).jar $(RELDIR)/$(NAME).tgz $(RELDIR)/$(NAME).zip $(RELDIR)/$(NAME)-api.tgz,downloads)
@$(call copy_to_website, $(RELDIR)/$(NAME).jar,downloads/$(NAME)/$(NAME)`cat $(RELDIR)/current.txt`.jar)
@$(call copy_to_website, $(RELDIR)/$(NAME).tgz,downloads/$(NAME)/$(NAME)`cat $(RELDIR)/current.txt`.tgz)
@$(call copy_to_website, $(RELDIR)/$(NAME).zip,downloads/$(NAME)/$(NAME)`cat $(RELDIR)/current.txt`.zip)
@$(call copy_to_website, $(RELDIR)/$(NAME)-api.tgz,downloads/$(NAME)/$(NAME)`cat $(RELDIR)/current.txt`-api.tgz)
@$(call exec_on_server, rm -rf $(SRVDIR)/$(NAME)/api)
@$(call copy_to_website, $(DOCDIR), $(NAME)/api)
@$(call copy_to_website, $(RELDIR)/current.txt,downloads/$(NAME))
@$(call copy_to_website, releasnotes.txt,downloads/$(NAME))
@$(call exec_on_server, find $(SRVDIR) -user `whoami` | xargs chmod g+rw)
@echo release `cat rel/current.txt` succesfully deployed
#jar of compiled classes
$(RELDIR)/$(NAME).jar: $(BINDIR) $(RELDIR)/manifest.txt
@if [ ! -d $(RELDIR) ]; then mkdir $(RELDIR); fi
@jar cmf $(RELDIR)/manifest.txt $(RELDIR)/$(NAME).jar -C $(BINDIR) .
#archive of source and jars of all dependencies
$(RELDIR)/$(NAME).tgz: $(shell find $(SRCDIRS)) | updatedeps
@if [ ! -d $(RELDIR) ]; then mkdir $(RELDIR); fi
@tar czf $(RELDIR)/$(NAME).tgz $(SRCDIRS) $(LIBDIR) --exclude-vcs
#jar and jars of all dependencies
$(RELDIR)/$(NAME).zip: $(RELDIR)/$(NAME).jar | updatedeps
@if [ ! -d $(RELDIR) ]; then mkdir $(RELDIR); fi
@cd $(RELDIR); zip $(NAME).zip $(NAME).jar
@cd $(LIBDIR); zip -g ../$(RELDIR)/$(NAME).zip *
#archive of api-documentation
$(RELDIR)/$(NAME)-api.tgz: $(DOCDIR)
@if [ ! -d $(RELDIR) ]; then mkdir $(RELDIR); fi
@tar czf $(RELDIR)/$(NAME)-api.tgz $(DOCDIR) --exclude-vcs
$(RELDIR)/manifest.txt: $(RELDIR)/current.txt
@if [ ! -d $(RELDIR) ]; then mkdir $(RELDIR); fi
@echo "Implementation-Title: $(NAME)" > $(RELDIR)/manifest.txt
@echo "Implementation-Version: "`cat $(RELDIR)/current.txt` >> $(RELDIR)/manifest.txt
@echo "Implementation-Vendor: jTEM ($(JTEMURL))" >> $(RELDIR)/manifest.txt
@echo "Implementation-URL: $(JTEMURL)/downloads/$(NAME).jar" >> $(RELDIR)/manifest.txt
#release date
.PHONY: $(RELDIR)/current.txt
@if [ ! -d $(RELDIR) ]; then mkdir $(RELDIR); fi
@echo `date +%F`_rel`svn info --xml -r HEAD \
| sed -n -e '/<entry/,/>/p' \
| sed -n -e '/revision/s/.*"\([0-9]*\)".*/\1/p'`\
> $(RELDIR)/current.txt
# --- debug ---
.PHONY: debug
......@@ -18,6 +18,9 @@ javadoc: generate the api documentation with javadoc
web: produce and send the snippets for the projectspecific
part of the jtem website
release: generate the archives for a release and put them on the
jTEM server for download
clean: remove all generated files (see the variable
CLEAN in the makefile)
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