Commit 957f1618902febe7fbd697d69ec30f43e030054a

Steffen Jaeckel 2017-08-28T16:58:26

update makefiles

diff --git a/.gitignore b/.gitignore
index e84e296..2717a33 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,3 +53,6 @@ test_*.txt
 
 *.bak
 *.orig
+*.asc
+*.tar.xz
+*.zip
diff --git a/doc/makefile b/doc/makefile
index 2adba2c..e15db08 100644
--- a/doc/makefile
+++ b/doc/makefile
@@ -14,7 +14,7 @@ endif
 
 # makes the LTM book DVI file, requires tetex, perl and makeindex [part of tetex I think]
 docdvi: tommath.src
-	cd pics ; MAKE=${MAKE} ${MAKE}
+	${MAKE} -C pics/ MAKE=${MAKE}
 	echo "hello" ${silent_stdout}
 	perl booker.pl
 	touch tommath.ind
diff --git a/makefile b/makefile
index 14d8cda..fdd2435 100644
--- a/makefile
+++ b/makefile
@@ -120,28 +120,28 @@ docdvi poster docs mandvi manual:
 pretty:
 	perl pretty.build
 
-#\zipup the project (take that!)
-no_oops: clean
-	cd .. ; cvs commit
-	echo Scanning for scratch/dirty files
-	find . -type f | grep -v CVS | xargs -n 1 bash mess.sh
-
 .PHONY: pre_gen
 pre_gen:
 	perl gen.pl
 	sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c
 	rm mpi.c
 
-zipup:
-	rm -rf ../libtommath-$(VERSION) \
-		&& rm -f ../ltm-$(VERSION).zip ../ltm-$(VERSION).zip.asc ../ltm-$(VERSION).tar.xz ../ltm-$(VERSION).tar.xz.asc
-	git archive HEAD --prefix=libtommath-$(VERSION)/ > ../libtommath-$(VERSION).tar
-	cd .. ; tar xf libtommath-$(VERSION).tar
-	MAKE=${MAKE} ${MAKE} -C ../libtommath-$(VERSION) clean manual poster docs
-	tar -c ../libtommath-$(VERSION)/* | xz -9 > ../ltm-$(VERSION).tar.xz
-	find ../libtommath-$(VERSION)/ -type f -exec unix2dos -q {} \;
-	cd .. ; zip -9r ltm-$(VERSION).zip libtommath-$(VERSION)
-	gpg -b -a ../ltm-$(VERSION).tar.xz && gpg -b -a ../ltm-$(VERSION).zip
+zipup: clean pre_gen new_file manual poster docs
+	@# Update the index, so diff-index won't fail in case the pdf has been created.
+	@#   As the pdf creation modifies the tex files, git sometimes detects the
+	@#   modified files, but misses that it's put back to its original version.
+	@git update-index --refresh
+	@git diff-index --quiet HEAD -- || ( echo "FAILURE: uncommited changes or not a git" && exit 1 )
+	rm -rf libtommath-$(VERSION) ltm-$(VERSION).*
+	@# files/dirs excluded from "git archive" are defined in .gitattributes
+	git archive --format=tar --prefix=libtommath-$(VERSION)/ HEAD | tar x
+	mkdir -p libtommath-$(VERSION)/doc
+	cp doc/bn.pdf doc/tommath.pdf doc/poster.pdf libtommath-$(VERSION)/doc/
+	tar -c libtommath-$(VERSION)/ | xz -6e -c - > ltm-$(VERSION).tar.xz
+	zip -9rq ltm-$(VERSION).zip libtommath-$(VERSION)
+	rm -rf libtommath-$(VERSION)
+	gpg -b -a ltm-$(VERSION).tar.xz
+	gpg -b -a ltm-$(VERSION).zip
 
 new_file:
 	bash updatemakes.sh