Commit 67b50367 authored by Guenter Paul Peters's avatar Guenter Paul Peters
Browse files

license headers updated, makefile updated with template

git-svn-id: https://svn.math.tu-berlin.de/svn/jtem@645 f5b180c5-49ee-4939-b20e-b6ed35f0f7b7
parent ec4f9233
All jTEM projects are licensed under the FreeBSD license
or 2-clause BSD license (see http://www.opensource.org/licenses/bsd-license.php).
Copyright (c) 2005-2009, Technische Universität Berlin, jTEM
Copyright (c) 2005-2010, Technische Universität Berlin, jTEM
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
......
......@@ -12,10 +12,14 @@ 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=$(DOCDIR)/de/jtem/$(NAME)/package-summary.html
#the package summary file (source)
PACKAGEHTML=$(word 1,$(SRCDIRS))/de/jtem/$(NAME)/package.html
#the html page to read the websnippets of
#(usually the processed PACKAGEHTML: package-summary.html)
PACKAGESUMHTML=$(DOCDIR)/de/jtem/$(NAME)/package-summary.html
#location of the web site, may be empty
SERVER=
SERVER=gauss.math.tu-berlin.de
#directory of the website on the server, or local if SERVER is empty
SRVDIR=/net/www/pub/jtem
......@@ -40,11 +44,15 @@ JAVACOPTS=-target 1.5 -source 1.5
#javadoc options
JAVADOCOPTS= -author -protected -nodeprecated -nodeprecatedlist \
-windowtitle 'de.jtem.$(NAME) package API documentation' \
-overview $(PACKAGEHTML) \
-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)
$(foreach d, $(DEPNAMES), -link $(JTEMURL)/$(d)/api) \
-d $(DOCDIR) -classpath "$(BINDIR):`find $(LIBDIR) -name '*.jar' -printf %p: 2> /dev/null `" \
-sourcepath `echo $(SRCDIRS) | tr \ :` \
$(DOCPACKAGES)
#things that are removed recursively by the clean target
......@@ -63,11 +71,18 @@ JTEMURL=http://www.math.tu-berlin.de/jtem
SOURCEFILES=$(shell find $(SRCDIRS) -name '*.java')
TESTSOURCEFILES=$(shell find $(TESTDIR) -name '*.java' 2> /dev/null)
ifeq ($(strip $(TESTDIR)),)
ALLTESTS=
et_=
TESTS=
ext_=
else
ALLTESTS=$(shell find $(TESTDIR) -name '*Test*.java' 2> /dev/null\
| sed -e 's,$(TESTDIR)/,,g' -e 's/.java//g' -e 'y,/,.,' )
et_=$(addprefix %,$(EXCLTESTS:.java=))
TESTS=$(filter-out $(et_), $(ALLTESTS))
ext_=$(filter $(et_), $(ALLTESTS))
endif
DEPNAMES=$(shell cat dependencies.txt 2> /dev/null | grep -v '^\#' )
DEPS=$(patsubst %,$(LIBDIR)/%.jar, $(DEPNAMES))
......@@ -77,15 +92,15 @@ DOWNLOADDEPS=$(JTEMURL)/downloads
#function to copy to SRVDIR
ifeq ($(strip $(SERVER)),)
copy_to_website=cp -R $(1) $(SRVDIR)/$(strip $(2))
copy_to_website=cp -R $(1) $(SRVDIR)/$(strip $(2)) && echo " - copy \"$(1)\" to \" $(SRVDIR)/$(strip $(2))\" "
else
copy_to_website=scp -r $(1) $(SERVER):$(SRVDIR)/$(strip $(2))
copy_to_website=scp -r $(1) $(SERVER):$(SRVDIR)/$(strip $(2)) && echo " - copy \"$(1)\" to \" $(SERVER):$(SRVDIR)/$(strip $(2))\" "
endif
#function to execute on SERVER
ifeq ($(strip $(SERVER)),)
exec_on_server=$(1)
else
exec_on_server=ssh $(SERVER) $(1)
exec_on_server=ssh $(SERVER) "$(1)"
endif
......@@ -93,14 +108,14 @@ endif
.PHONY: help
help:
@cat README
@cat README.txt
@echo "CURRENT VALUES OF SOME VARIABLES"; echo "================================"; echo
@echo "project name (NAME): $(NAME)"
@echo "find sources in (SRCDIRS): $(SRCDIRS)"
@echo "compiled classes in (BINDIR): $(BINDIR)"
@echo "generat api documentation in (DOCDIR): $(DOCDIR)"
@echo "generat snippets for the web site in (WEBDIR): $(WEBDIR)"
@echo "package.html to produce the web snipptes (PACKAGEHTML): $(PACKAGEHTML)"
@echo "package-summary.html to produce the web snipptes (PACKAGESUMHTML): $(PACKAGESUMHTML)"
@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)"
......@@ -139,10 +154,11 @@ $(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` \
`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)
@echo " - compilation of sources in \"$(SRCDIRS)\" successfull, class files in \"$(BINDIR)\" "
# --- test ---
......@@ -151,10 +167,12 @@ $(BINDIR): $(SOURCEFILES) | $(DEPS)
.PHONY: test
test: .testscompiled
#only runs tests if $(TESTDIR) is non empty
ifneq ($(strip $(TESTDIR)),)
ifeq ($(strip $(TESTDIR)),)
@echo "No tests, variable TESTDIR is empty."
else
@for test in $(TESTS); do \
echo "- JUnitTest: $$test"; \
java -classpath `find $(LIBDIR) -name '*.jar' -printf %p: 2> /dev/null`$(JUNIT):$(BINDIR):$(TESTBINDIR) \
java -ea -classpath "`find $(LIBDIR) -name '*.jar' -printf %p: 2> /dev/null`$(JUNIT):$(BINDIR):$(TESTBINDIR)" \
junit.textui.TestRunner $$test || { echo "JUnit Test failed!" ; exit 1; } \
done;
@if [ -n "$(ext_)" ]; then echo "WARNING: some tests where exluded, see variable EXCLTESTS"; fi
......@@ -166,10 +184,11 @@ endif
ifneq ($(strip $(TESTDIR)),)
@if [ ! -d $(TESTBINDIR) ]; then mkdir $(TESTBINDIR); fi
@javac $(JAVACOPTS) \
-classpath `find $(LIBDIR) -name '*.jar' -printf %p: 2> /dev/null`$(JUNIT):$(BINDIR) \
-classpath "`find $(LIBDIR) -name '*.jar' -printf %p: 2> /dev/null`$(JUNIT):$(BINDIR)" \
-d $(TESTBINDIR)/ \
$(TESTSOURCEFILES)
@touch .testscompiled
@echo " - compilation of test in \"$(TESTDIR)\" successfull, class files in \"$(TESTBINDIR)\" "
endif
......@@ -180,10 +199,7 @@ endif
javadoc: $(DOCDIR)
$(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 ` \
-sourcepath `echo $(SRCDIRS) | tr \ :` \
$(DOCPACKAGES)
@javadoc $(JAVADOCOPTS)
@touch $(DOCDIR)
......@@ -194,19 +210,17 @@ $(DOCDIR): $(shell find $(SRCDIRS) -path "*.svn" -prune -o -print ) | $(DEPS)
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
@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)
$(PACKAGEHTML): $(DOCDIR)
@if [ -f releasenotes.txt ]; then $(call copy_to_website, releasenotes.txt,downloads/$(NAME)); fi
@-$(call exec_on_server, find $(SRVDIR) -user `whoami` | xargs chmod ug+rw 2> /dev/null)
$(WEBDIR)/teaser.html: $(PACKAGEHTML)
$(WEBDIR)/teaser.html: $(DOCDIR)
@if [ ! -d $(WEBDIR) ]; then mkdir $(WEBDIR); fi
@sed -e '0,/teaser start/d;/teaser end/,$$d' $(PACKAGEHTML) > $(WEBDIR)/teaser.html
$(WEBDIR)/content.html: $(PACKAGEHTML)
@sed -e '0,/teaser start/d;/teaser end/,$$d' $(PACKAGESUMHTML) > $(WEBDIR)/teaser.html
$(WEBDIR)/content.html: $(DOCDIR)
@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
$(PACKAGESUMHTML) > $(WEBDIR)/content.html
# --- release ---
......@@ -214,27 +228,32 @@ $(WEBDIR)/content.html: $(PACKAGEHTML)
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
echo "STOP: Synchronize with repository first!"; exit 1 ;\
else echo "- svn is synchronized"; fi
@grep `cat $(RELDIR)/current.txt` releasenotes.txt 1>/dev/null 2>&1 || \
if [ -f releasenotes.txt ]; then mv releasenotes.txt releasenotes-old.txt; fi; \
cat $(RELDIR)/current.txt > releasenotes.txt; \
if [ -f releasenotes-old.txt ]; then cat releasenotes-old.txt >> releasenotes.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, $(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)-api_`cat $(RELDIR)/current.txt`.tgz)
@$(call exec_on_server, if [ -d $(SRVDIR)/$(NAME)/api ]; then rm -rf $(SRVDIR)/$(NAME)/api; fi)
@$(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
@$(call copy_to_website, releasenotes.txt,downloads/$(NAME))
@-$(call exec_on_server, find $(SRVDIR) -user `whoami` | xargs chmod ug+rw 2> /dev/null)
@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
@$(foreach dir, $(SRCDIRS), for subdir in `find $(dir) -name .svn -prune -o -type d -print `; \
do if [ ! -d $(BINDIR)$${subdir#$(dir)} ]; then mkdir $(BINDIR)$${subdir#$(dir)}; fi; done;)
@$(foreach dir, $(SRCDIRS), for file in `find $(dir) -name .svn -prune -o -type f -print `; \
do cp -u $${file} $(BINDIR)$${file#$(dir)}; done;)
@jar cmf $(RELDIR)/manifest.txt $(RELDIR)/$(NAME).jar -C $(BINDIR) .
#archive of source and jars of all dependencies
......@@ -246,7 +265,7 @@ $(RELDIR)/$(NAME).tgz: $(shell find $(SRCDIRS)) | updatedeps
$(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 *
@if [ ! $(LIBDIR)="" -a -d $(LIBDIR) ]; then cd $(LIBDIR); zip -g ../$(RELDIR)/$(NAME).zip *; fi
#archive of api-documentation
$(RELDIR)/$(NAME)-api.tgz: $(DOCDIR)
......@@ -265,7 +284,7 @@ $(RELDIR)/manifest.txt: $(RELDIR)/current.txt
.PHONY: $(RELDIR)/current.txt
$(RELDIR)/current.txt:
@if [ ! -d $(RELDIR) ]; then mkdir $(RELDIR); fi
@echo `date +%F`_rel`svn info --xml -r HEAD \
@echo `date +%F`_rev`svn info --xml -r HEAD \
| sed -n -e '/<entry/,/>/p' \
| sed -n -e '/revision/s/.*"\([0-9]*\)".*/\1/p'`\
> $(RELDIR)/current.txt
......@@ -280,6 +299,7 @@ debug:
@echo TESTS=$(TESTS); echo
@echo JUNIT=$(JUNIT); echo
@echo DOCPACKAGES=$(DOCPACKAGES); echo
@echo PACKAGESUMHTML=$(PACKAGESUMHTML); echo
@echo PACKAGEHTML=$(PACKAGEHTML); echo
@echo DEPS=$(DEPS); echo
......
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