Description: debianization
 Meant to maintain a minimal debian/rules, to fix warnings,
 to address Debian specific stuff in general.

Index: tth/makefile
===================================================================
--- tth.orig/makefile	2020-09-05 19:45:00.825685863 +0200
+++ tth/makefile	2020-09-05 19:45:38.977206233 +0200
@@ -1,9 +1,31 @@
 MINGW=mingw
-GCC=gcc -O
 TARS= tars/tthgoldC.tgz tars/tthgoldL.tar.gz  tars/ttmC.tar.gz\
  tars/ttmL.tar.gz  tars/tthgoldW.exe tars/ttmW.exe
 WARN=-Wall -Wno-unused-but-set-variable -Wno-stringop-truncation -Wno-stringop-overflow -Wno-format-overflow
 
+##CFLAGS += -O0
+
+dh_auto_build_default: tth ttm dh_auto_build_tthsplit dh_auto_build_tthrfcat dh_auto_build_manual dh_auto_build_gold_manual
+
+dh_auto_build_tthsplit:
+	make -C tools tthsplit
+
+dh_auto_build_tthrfcat: tthgold/tthrfcat.c
+	gcc $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -Wall -o tthrfcat $<
+
+dh_auto_build_manual: tth dh_auto_build_tthsplit
+	make -C manual
+
+dh_auto_build_gold_manual: tthgold_manual.tex tth
+	latex -no-shell-escape -interaction=batchmode $<
+	./tth -a $<
+
+tthgold_manual.tex: tthgold/gold_man.tex
+	sed \
+		-e 's#usr\/local\/tth#usr\/share\/tth#g' \
+		-e 's#tth\/swedish.bab#tth\/babel\/swedish.bab#g' \
+		< $< > $@
+
 unopt : tth.c
 	gcc -o tth $(WARN) tth.c
 	sleep 1s
@@ -34,13 +56,13 @@
 	flex -ottm.c ttm.lex
 
 ttm : ttm.c
-	gcc -o ttm $(WARN) ttm.c
+	gcc $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -Wall -o ttm ttm.c
 
 tth.c : tth.lex
 	flex -otth.c tth.lex
 
 tth : tth.c
-	$(GCC) -o tth $(WARN) tth.c
+	gcc $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -Wall -o tth tth.c
 
 # The tars are individual packages. Win32, Linux, C.
 
Index: tth/tools/makefile
===================================================================
--- tth.orig/tools/makefile	2020-09-05 19:45:00.825685863 +0200
+++ tth/tools/makefile	2020-09-05 19:45:00.817685963 +0200
@@ -7,7 +7,7 @@
 	mingw -o choice.exe choice.c
 
 tthsplit : tthsplit.c
-	gcc -o tthsplit tthsplit.c
+	gcc $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -Wall -o tthsplit tthsplit.c
 
 tthsplit.exe : tthsplit.c
 	mingw -o tthsplit.exe tthsplit.c
Index: tth/tthgold/README.txt
===================================================================
--- tth.orig/tthgold/README.txt	2020-09-05 19:45:00.825685863 +0200
+++ tth/tthgold/README.txt	2020-09-05 19:45:00.817685963 +0200
@@ -1,4 +1,4 @@
-Unzip or untar the distribution. It should make its own directory.
-For Wind@ws run the install.bat file by the command "install".
-Read the file gold_man.html or gold_man.tex for further instructions.
+Unzip or untar the distribution. It should make its own directory.
+For Wind@ws run the install.bat file by the command "install".
+Read the file tthgold_manual.html or tthgold_manual.tex for further instructions.
 
