Commit 3cb52123 authored by Guenter Paul Peters's avatar Guenter Paul Peters
Browse files

fetching of dependencies

compilattion
running JUnit tests
still missing: javadoc, web-site

git-svn-id: https://svn.math.tu-berlin.de/svn/jtem@45 f5b180c5-49ee-4939-b20e-b6ed35f0f7b7
parent 1630e722
#base name of the project
NAME=blas
lib: classes
cd classes; jar cf ../blas.jar `find . -name '*.class'`
#space separated list of source directories
SRCDIRS=src
classes:
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:
#where to put the generated javadoc
DOCDIR=doc
#the snippets for the webpage are put here
WEBDIR=web
#directory for the dependencies
LIBDIR=lib
#url for wget to retrieve the dependencies
DOWNLOADDEPS=http://www.math.tu-berlin.de/jtem/downloads
#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)
#things that are removed recursively by the clean target
CLEAN=$(BINDIR) $(DOCDIR) $(WEBDIR) $(LIBDIR) $(RELEASEDIR) .lastUpdateDeps .lastUpdateDepsMinusADay .testscompiled
# -- 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 $(filter %Test.java Test%.java,$(TESTSOURCEFILES))\
| sed -e 's,$(TESTDIR)/,,g' -e 's/.java//g' -e 'y,/,.,')
DEPS=$(patsubst %,$(LIBDIR)/%.jar, $(shell cat dependencies.txt | grep -v '^\#'))
.PHONY: default
default:
cat README
#dependencies will only be updated once a day
.PHONY: updatedeps
updatedeps: $(DEPS)
$(DEPS): .lastUpdateDeps
.lastUpdateDepsMinusADay: .lastUpdateDeps
.lastUpdateDeps:
@if [ ! -d $(LIBDIR) ]; then mkdir $(LIBDIR); fi
@cd $(LIBDIR); wget --timestamping $(subst $(LIBDIR), $(DOWNLOADDEPS), $(DEPS))
@touch .lastUpdateDeps
@touch -t `date --date="-1 day" +%Y%m%d%H%M` .lastUpdateDepsMinusADay
.PHONY: binaries
binaries: $(BINDIR)
$(BINDIR): $(SOURCEFILES) $(DEPS)
@if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); fi
javac -classpath `echo $(DEPS) | tr \ :` \
-d $(BINDIR)/ \
$(SOURCEFILES)
@touch $(BINDIR)
.PHONY: test
test: .testscompiled
ifneq ($(strip $(TESTDIR)),)
@for test in $(TESTS); do \
echo "- JUnitTest: $$test"; \
java -classpath `echo $(DEPS) | tr \ :`:$(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 -classpath `echo $(DEPS) | tr \ :`:$(JUNIT):$(BINDIR) \
-d $(TESTBINDIR)/ \
$(TESTSOURCEFILES)
touch .testscompiled
endif
.PHONY: javadoc
javadoc: $(DOCDIR)
$(DOCDIR): $(SOURCEFILES) $(DEPS)
if [ ! -d javadocs ]; then mkdir javadocs; fi
javadoc -d javadocs -classpath classes:`echo lib/*.jar | tr \ :` -sourcepath src -protected \
-windowtitle "blas documentation" -doctitle "blas" \
-nodeprecated -nodeprecatedlist `find src -name .svn -prune -or -type d -print | sed -e 'y,/,.,' -e 's/src\.//'`
-nodeprecated -nodeprecatedlist \
`find src -name .svn -prune -or -type d -print | sed -e 'y,/,.,' -e 's/src\.//'`
touch $(DOCDIR)
clean:
rm -f `find src -name "*.class"`
if [ -e blas.jar ]; then rm -f blas.jar; fi
if [ -d classes ]; then rm -fr classes; fi
if [ -d javadocs ]; then rm -fr javadocs; fi
.PHONY: web
web: $(WEBDIR)
$(WEBDIR): $(DOCDIR)
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 JUNITRUN=$(JUNITRUN); echo
.PHONY: clean
clean:
@for f in $(CLEAN); do if [ -e $$f ]; then rm -rf $$f; fi; done
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