posaune
authorMichael Wagner <info@wagnertech.de>
Tue, 21 Jun 2016 13:19:22 +0000 (15:19 +0200)
committerMichael Wagner <info@wagnertech.de>
Tue, 21 Jun 2016 13:19:22 +0000 (15:19 +0200)
tools/make/configure
tools/make/insert_build.sh [new file with mode: 0755]
tools/make/makefile

index f4541ba..e27e9e2 100755 (executable)
@@ -127,4 +127,5 @@ fi
 
 # append version to make.pre
 echo "version = $version" >> make.pre
+echo "build = $build" >> make.pre
 
diff --git a/tools/make/insert_build.sh b/tools/make/insert_build.sh
new file mode 100755 (executable)
index 0000000..00a90b0
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+set -e
+
+usage="insert_build.sh <file> <build>"
+
+# inserts _<build> before last dot of filename
+# example: "insert_build.sh 45 foo.pdf" leads to "foo_45.pdf"
+
+if [ $# -ne 2 ]; then
+       echo $usage
+       exit 1
+fi
+
+stem=${1%.*}
+ext=${1##*.}
+
+cp $1 ${stem}_$2.$ext
+
index 6513f24..b2f4944 100644 (file)
@@ -8,6 +8,7 @@ COMPILE_TARGET = compile.stamp
 COPY = $(NOP)
 ZIP = zip -r $(project).zip $(project)
 DEB = fakeroot dpkg-deb --build $(project)
+INSERT_BUILD = projects/tools/make/insert_build.sh
 
 #default parameters
 project = default
@@ -38,6 +39,9 @@ zip: $(project).zip
 deb: $(project).deb
        # Debian package ready
 
+version: $(COMPILE_TARGET)
+       $(INSERT_BUILD) $(COMPILE_TARGET) $(build)
+
 #-----------------------------------------------------------------
 # compile steps
 #-----------------------------------------------------------------
@@ -78,5 +82,5 @@ clean:
 # Build-Regeln
 #-----------------------------------------------------------------
 %.pdf : %.tex $(SOURCES)
-       pdflatex $<
+       pdflatex $< && pdflatex $<