diff options
author | Gordon GECOS <u@adam> | 2023-10-28 17:15:57 -0400 |
---|---|---|
committer | Gordon GECOS <u@adam> | 2023-10-28 17:30:20 -0400 |
commit | bc4c510fc48a39252c2436813670a2da80bdd2c4 (patch) | |
tree | 8beafbd1e47feaf23d215a74d9601648f8ab1dc2 /Makefile | |
parent | 51b6e33d0dbb980a1977be8e2d29ca96d4781bcf (diff) |
infrastructure improvements
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 56 |
1 files changed, 28 insertions, 28 deletions
@@ -1,17 +1,15 @@ | |||
1 | build/title.txt: title.txt | build | ||
2 | $(call concatenate_with_terminator,\\n\\n\\n) | ||
3 | build/page1.txt: way-to-be-great.txt lost-pen.txt authenticated-counterfeit.txt | build | ||
4 | $(call concatenate_with_terminator,\\n\\n\\n) | ||
5 | build/rest.txt: medium.txt argument.txt break dis.txt why.txt | build | ||
6 | $(call concatenate_with_terminator,\\n\\n\\n) | ||
7 | 1 | ||
8 | break: | 2 | pages = 64lines.txt space title.txt break |
9 | printf \\\\f > $@ | 3 | pages += way-to-be-great.txt space lost-pen.txt space authenticated-counterfeit.txt break |
10 | 4 | pages += monad-tutorial.txt break | |
11 | pages = title.txt monad-tutorial.txt page1.txt introduction.txt rest.txt | 5 | pages += why.txt space dis.txt break |
6 | pages += argument.txt space medium.txt break | ||
7 | pages += introduction.txt break | ||
12 | 8 | ||
13 | source_text_files = $(addprefix build/,$(pages)) | 9 | source_text_files = $(addprefix build/,$(pages)) |
14 | 10 | ||
11 | allorthree = $(if $(NOTITLE),3,all) | ||
12 | |||
15 | output_name = poetrybook | 13 | output_name = poetrybook |
16 | pdf_viewer = evince | 14 | pdf_viewer = evince |
17 | 15 | ||
@@ -38,7 +36,7 @@ LPDF += $(if $(NUMBER_UP),-o number-up=$(NUMBER_UP)) | |||
38 | LPDF += $(if $(SIDES),-o sides=$(SIDES)) | 36 | LPDF += $(if $(SIDES),-o sides=$(SIDES)) |
39 | 37 | ||
40 | define concatenate_with_terminator | 38 | define concatenate_with_terminator |
41 | @($(foreach f,$(^), cat < $(f) && [ $(f) = break ] || printf $(1);)) > $@.tmp | 39 | @($(foreach f,$(+), cat < $(f) && printf $(1);)) > $@.tmp |
42 | @$(done) | 40 | @$(done) |
43 | endef | 41 | endef |
44 | 42 | ||
@@ -50,8 +48,14 @@ done = mv -T -- $@.tmp $@ | |||
50 | 48 | ||
51 | .INTERMEDIATE: build/$(output_txt) | 49 | .INTERMEDIATE: build/$(output_txt) |
52 | 50 | ||
51 | build/break: | ||
52 | printf \\f > $@ | ||
53 | |||
54 | build/space: | ||
55 | printf \\n\\n\\n > $@ | ||
56 | |||
53 | build/$(output_txt): $(source_text_files) | build | 57 | build/$(output_txt): $(source_text_files) | build |
54 | $(call concatenate_with_terminator,\\f) | 58 | $(call concatenate_with_terminator,'') |
55 | 59 | ||
56 | %.pdf: %.txt | 60 | %.pdf: %.txt |
57 | $(LPDF) $< > $@.tmp | 61 | $(LPDF) $< > $@.tmp |
@@ -60,35 +64,31 @@ build/$(output_txt): $(source_text_files) | build | |||
60 | build/%: % | build | 64 | build/%: % | build |
61 | cp --reflink -T -- $< $@ | 65 | cp --reflink -T -- $< $@ |
62 | 66 | ||
63 | .PHONY: realprint print print3 printall clean preview realview titleview cleanview | 67 | clean: |
68 | -rm -rf build | ||
64 | 69 | ||
65 | cleanview: clean view3 | 70 | .PHONY: realprint print print3 printall clean preview realview titleview cleanview |
66 | 71 | ||
67 | preview: realview | 72 | cleanview: clean view$(allorthree) |
68 | 73 | ||
69 | print: clean print3 | 74 | print: clean print$(allorthree) |
70 | 75 | ||
71 | clean: | 76 | viewall: PAGES=1- |
72 | -rm -rf build | 77 | viewall: realview |
78 | printall: PAGES=1- | ||
79 | printall: realprint | ||
73 | 80 | ||
74 | view3: PAGES=3- | 81 | view3: PAGES=3- |
75 | view3: realview | 82 | view3: realview |
83 | print3: PAGES=3- | ||
84 | print3: realprint | ||
76 | 85 | ||
77 | titleview: PAGES=1-2 | 86 | preview: realview |
78 | titleview: realview | ||
79 | |||
80 | realview: build/$(output_pdf) | 87 | realview: build/$(output_pdf) |
81 | -$(pdf_viewer) $< & | 88 | -$(pdf_viewer) $< & |
82 | |||
83 | realprint: build/$(output_pdf) | 89 | realprint: build/$(output_pdf) |
84 | $(LP) $^ | 90 | $(LP) $^ |
85 | 91 | ||
86 | print3: PAGES=3- | ||
87 | print3: realprint | ||
88 | |||
89 | printall: PAGES=1- | ||
90 | printall: realprint | ||
91 | |||
92 | .PHONY: install | 92 | .PHONY: install |
93 | install: | 93 | install: |
94 | apt install --no-upgrade printer-driver-cups-pdf | 94 | apt install --no-upgrade printer-driver-cups-pdf |