| 1 | ### |
| 2 | ### You can use this Makefile to generate an executable JAR file |
| 3 | ### The available options are: |
| 4 | ### - make: will create the JAR file (must be compiled before) |
| 5 | ### - make bin/5 && make: will create a Java 1.5 JAR |
| 6 | ### - make bin/6 && make: will create a Java 1.6 JAR |
| 7 | ### - make bin/7 && make: will create a Java 1.7 JAR |
| 8 | ### - make bin/8 && make: will create a Java 1.8 JAR |
| 9 | ### - make clean: will clean temporary files |
| 10 | ### - make mrpropre: will clean temporary files and remove the JAR file |
| 11 | |
| 12 | ALL: jvcard.jar |
| 13 | |
| 14 | bin/bin: bin/be/nikiroo/jvcard/launcher/Main.class src/be/nikiroo/jvcard/*/* src/be/nikiroo/jvcard/* |
| 15 | @echo You need to compile the code first: |
| 16 | @echo " make bin/5: will compile in Java 1.5 target mode" |
| 17 | @echo " make bin/6: will compile in Java 1.6 target mode" |
| 18 | @echo " make bin/7: will compile in Java 1.7 target mode" |
| 19 | @echo " make bin/8: will compile in Java 1.8 target mode" |
| 20 | @false |
| 21 | |
| 22 | .PHONY: ALL clean mrproper mrpropre love |
| 23 | |
| 24 | love: |
| 25 | @echo ...not war? |
| 26 | |
| 27 | clean: |
| 28 | @echo Cleaning files... |
| 29 | @rm -f bin/[0-9] bin/bin bin/files bin/lanterna |
| 30 | |
| 31 | mrproper: mrpropre |
| 32 | |
| 33 | mrpropre: clean |
| 34 | @echo Removing jar files... |
| 35 | @rm -f jvcard.jar jvcard-`grep "APPLICATION_VERSION" src/be/nikiroo/jvcard/launcher/Main.java | head -n1 | cut -d'"' -f2`.jar |
| 36 | |
| 37 | jvcard.jar: bin/bin |
| 38 | @echo 'Main-Class: be.nikiroo.jvcard.launcher.Main' > bin/manifest |
| 39 | @echo >> bin/manifest |
| 40 | @echo Creating jar file jvcard-`grep "APPLICATION_VERSION" src/be/nikiroo/jvcard/launcher/Main.java | head -n1 | cut -d'"' -f2`.jar... |
| 41 | jar cfm jvcard-`grep "APPLICATION_VERSION" src/be/nikiroo/jvcard/launcher/Main.java | head -n1 | cut -d'"' -f2`.jar bin/manifest -C bin/ be -C bin/ com -C bin/ default-theme.properties -C bin/ multilang |
| 42 | @rm bin/manifest |
| 43 | @echo Copying to jvcard.jar... |
| 44 | @cp jvcard-`grep "APPLICATION_VERSION" src/be/nikiroo/jvcard/launcher/Main.java | head -n1 | cut -d'"' -f2`.jar jvcard.jar |
| 45 | |
| 46 | bin/5: bin/lanterna bin/files |
| 47 | @cp -r src/* bin/ |
| 48 | @echo Compiling in Java 1.5 mode "('make bin/5')"... |
| 49 | javac -cp bin/ -encoding UTF-8 -Xlint -Xlint:-options -source 5 -target 5 @bin/files -d bin/ |
| 50 | @rm -f bin/[0-9] |
| 51 | @touch bin/5 |
| 52 | @touch bin/bin |
| 53 | |
| 54 | bin/6: bin/lanterna bin/files |
| 55 | @cp -r src/* bin/ |
| 56 | @echo Compiling in Java 1.6 mode "('make bin/6')"... |
| 57 | javac -cp bin/ -encoding UTF-8 -Xlint -Xlint:-options -source 6 -target 6 @bin/files -d bin/ |
| 58 | @rm -f bin/[0-9] |
| 59 | @touch bin/6 |
| 60 | @touch bin/bin |
| 61 | |
| 62 | bin/7: bin/lanterna bin/files |
| 63 | @cp -r src/* bin/ |
| 64 | @echo Compiling in Java 1.7 mode "('make bin/7')"... |
| 65 | javac -cp bin/ -encoding UTF-8 -Xlint -Xlint:-options -source 7 -target 7 @bin/files -d bin/ |
| 66 | @rm -f bin/[0-9] |
| 67 | @touch bin/7 |
| 68 | @touch bin/bin |
| 69 | |
| 70 | bin/8: bin/lanterna bin/files |
| 71 | @cp -r src/* bin/ |
| 72 | @echo Compiling in Java 1.8 mode "('make bin/8')"... |
| 73 | javac -cp bin/ -encoding UTF-8 -Xlint -Xlint:-options -source 8 -target 8 @bin/files -d bin/ |
| 74 | @rm -f bin/[0-9] |
| 75 | @touch bin/8 |
| 76 | @touch bin/bin |
| 77 | |
| 78 | bin/files: src/be/nikiroo/jvcard/*/* src/be/nikiroo/jvcard/* |
| 79 | @mkdir -p bin/ |
| 80 | @find src/be/ -name '*.java' > bin/files |
| 81 | |
| 82 | bin/lanterna: src/resources/* src/com/googlecode/lanterna/* src/com/googlecode/lanterna/*/* src/com/googlecode/lanterna/*/*/* |
| 83 | @mkdir -p bin/ |
| 84 | @find src/com/ -name '*.java' > bin/lanterna |
| 85 | cp -r src/resources/* bin/ |
| 86 | javac -encoding UTF-8 -source 5 @bin/lanterna -d bin/ || rm bin/lanterna |
| 87 | @test -e bin/lanterna |
| 88 | |