From 58fbed94fba25bee08a3b0eea453429e075efe1c Mon Sep 17 00:00:00 2001 From: Gordon GECOS Date: Thu, 9 Nov 2023 05:31:41 -0500 Subject: booklet printing --- Makefile | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index c5a63d9..f7c4c3c 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,22 @@ -pages = $(if $(TITLE),64lines.txt title.txt break) +pages = $(if $(TITLE),title.txt break) pages += way-to-be-great.txt space lost-pen.txt space authenticated-counterfeit.txt break -pages += bitcoin.txt space monad-tutorial.txt break pages += why.txt space con-job.txt break pages += argument.txt space medium.txt break pages += introduction.txt $(if $(FINALE),finale.txt) break -pages += human-communication.txt +pages += human-communication.txt break +pages += bitcoin.txt space monad-tutorial.txt +pages += $(if $(TITLE),break 64lines.txt) + +define pages +$(if $(TITLE),title.txt break) +way-to-be-great.txt space lost-pen.txt space authenticated-counterfeit.txt break +argument.txt space why.txt space con-job.txt break +introduction.txt space introjoke.txt break +human-communication.txt break +monad-tutorial.txt break +$(if $(TITLE),break break 64lines.txt) +endef +pages := $(pages:=) output_name = poetrybook pdf_viewer = evince @@ -36,6 +48,10 @@ define concatenate_with_terminator @$(done) endef +newprint: NUMBER_UP=1 +newprint: SIDES= + + dirs = build $(dirs): @mkdir -p $@ @@ -58,22 +74,49 @@ build/$(output_txt): $(addprefix build/,$(pages)) | build $(LPDF) $< > $@.tmp $(done) +%.ps: %.pdf + pdf2ps -dLanguageLevel=3 $< $@ + build/%: % | build cp --reflink -T -- $< $@ clean: -rm -rf build -.PHONY: view print viewall printall realview realprint +.PHONY: view print viewall printall realview realprint booklet pages + +booklet: clean build/booklet.pdf + -$(pdf_viewer) $(word 2, $+) & +pages: clean build/pages.ps + -$(pdf_viewer) $(word 2, $+) & + +newprint: clean newrealprint +newrealprint: NUMBER_UP=1 +newrealprint: SIDES= +newrealprint: build/pages.pdf + -$(pdf_viewer) $< & + +%.pdf: %.ps + ps2pdf $< $@ + +build/pages.ps: NUMBER_UP=1 +build/pages.ps: SIDES= +build/pages.ps: build/$(output_pdf:pdf=ps) + @cp -T -- $^ $@ + +build/booklet.ps: build/pages.ps + psbook $< $@.tmp + psnup -2 $@.tmp $@ + @rm $@.tmp view: clean realview print: clean realprint -realview: build/$(output_pdf) +realview: build/pages.pdf -$(pdf_viewer) $< & -realprint: build/$(output_pdf) +realprint: build/booklet.ps $(LP) $^ .PHONY: install install: - apt install --no-upgrade printer-driver-cups-pdf evince + apt install --no-upgrade printer-driver-cups-pdf evince ghostscript -- cgit v1.2.3