X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=Makefile.base;h=e44b5d52cd5a6d09e2a6c2cad323f4aa92f24a39;hp=559b89d9020a53df2b6212600233c68cd88841a2;hb=5dd985cf7d5e2bb88b07fd43e7b4a4eda4647181;hpb=fe999aa400c2627291325558f1ae8c734da7900c diff --git a/Makefile.base b/Makefile.base index 559b89d..e44b5d5 100644 --- a/Makefile.base +++ b/Makefile.base @@ -7,6 +7,7 @@ #TEST = path to main test source to compile #JAR_FLAGS += a list of things to pack, each usually prefixed with "-C bin/" #SJAR_FLAGS += a list of things to pack, each usually prefixed with "-C src/", for *-sources.jar files +#TEST_PARAMS = any parameter to pass to the test runnable when "test-run" JAVAC = javac JAVAC_FLAGS += -encoding UTF-8 -d ./bin/ -cp ./src/ @@ -34,7 +35,7 @@ RJAR_FLAGS += -jar all: build jar -.PHONY: all clean mrproper mrpropre build run jrun jar resources install libs love +.PHONY: all clean mrproper mrpropre build run jrun jar resources test-resources install libs love bin: @mkdir -p bin @@ -50,7 +51,7 @@ build: resources $(JAVAC) $(JAVAC_FLAGS) "src/$$sup.java" ; \ done -test: +test: test-resources @[ -e bin/$(MAIN).class ] || echo You need to build the sources @[ -e bin/$(MAIN).class ] @echo Compiling test program... @@ -86,7 +87,18 @@ love: resources: libs @echo Copying resources into bin/... - @cd src && find . | grep -v '\.java$$' | while read -r ln; do \ + @cd src && find . | grep -v '\.java$$' | grep -v '/test/' | while read -r ln; do \ + if [ -f "$$ln" ]; then \ + dir="`dirname "$$ln"`"; \ + mkdir -p "../bin/$$dir" ; \ + cp "$$ln" "../bin/$$ln" ; \ + fi ; \ + done + @cp VERSION bin/ + +test-resources: resources + @echo Copying test resources into bin/... + @cd src && find . | grep -v '\.java$$' | grep '/test/' | while read -r ln; do \ if [ -f "$$ln" ]; then \ dir="`dirname "$$ln"`"; \ mkdir -p "../bin/$$dir" ; \ @@ -96,9 +108,11 @@ resources: libs libs: bin @[ -e bin/libs -o ! -d libs ] || echo Extracting sources from libs... - @[ -e bin/libs -o ! -d libs ] || (cd src && for lib in ../libs/*-sources.jar; do \ - basename "$$lib"; \ - jar xf "$$lib"; \ + @[ -e bin/libs -o ! -d libs ] || (cd src && for lib in ../libs/*-sources.jar ../libs/*-sources.patch.jar; do \ + if [ "$$lib" != '../libs/*-sources.jar' -a "$$lib" != '../libs/*-sources.patch.jar' ]; then \ + basename "$$lib"; \ + jar xf "$$lib"; \ + fi \ done ) @[ ! -d libs ] || touch bin/libs @@ -134,7 +148,7 @@ run-test: @[ "$(TEST)" = "" -o -e "bin/$(TEST).class" ] @echo Running tests for "$(NAME)"... @[ "$(TEST)" != "" ] || echo No test sources defined. - [ "$(TEST)" = "" ] || $(JAVA) $(JAVA_FLAGS) $(TEST) + [ "$(TEST)" = "" ] || ( clear ; $(JAVA) $(JAVA_FLAGS) $(TEST) $(TEST_PARAMS) ) install: @[ -e $(NAME).jar ] || echo You need to build the jar