-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (38 loc) · 1.69 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
BIN = bin
PDF = lib.pdf
CODE_DIR = code
CODE_DIR_FILES = $(shell find code -type f)
INFO = $(BIN)/lib.info
TMP_PDF = $(BIN)/tmp_lib.pdf
TMP_INFO = $(BIN)/tmp_lib.info
DATE = $(BIN)/date
$(PDF): $(TMP_PDF) $(INFO)
pdftk $(TMP_PDF) update_info $(INFO) output $@
$(TMP_PDF): $(CODE_DIR_FILES) | $(BIN)
python3 builder.py $(CODE_DIR) $(TMP_PDF)
$(INFO): $(TMP_INFO) $(DATE)
sed 's/InfoBegin\rInfoKey:[^\r]*\rInfoValue:[^\r]*\r//g' < $< > $(TMP_INFO)_1
/bin/echo -en "\r" >> $(TMP_INFO)_1
/bin/echo -en "InfoBegin\rInfoKey: Title\rInfoValue: Biblioteczka drużyny KMR.\r" >> $(TMP_INFO)_1
/bin/echo -en "InfoBegin\rInfoKey: Creator\rInfoValue: Marek Sommer\r" >> $(TMP_INFO)_1
/bin/echo -en "InfoBegin\rInfoKey: Producer\rInfoValue: Marek Sommer\r" >> $(TMP_INFO)_1
/bin/echo -en "InfoBegin\rInfoKey: Author\rInfoValue: Marek Sommer, Kamil Dębowski, Mateusz Radecki\r" >> $(TMP_INFO)_1
/bin/echo -en "InfoBegin\rInfoKey: CreationDate\rInfoValue: " >> $(TMP_INFO)_1
cat $(DATE) | tr '\r' '\n' >> $(TMP_INFO)_1
/bin/echo -en "InfoBegin\rInfoKey: ModDate\rInfoValue: " >> $(TMP_INFO)_1
cat $(DATE) | tr '\r' '\n' >> $(TMP_INFO)_1
/bin/echo -en "InfoBegin\rInfoKey: Subject\rInfoValue: Biblioteczka ACM.\r" >> $(TMP_INFO)_1
/bin/echo -en "InfoBegin\rInfoKey: Keywords\rInfoValue: biblioteczka acm kmr marek sommer kamil dębowski mateusz radecki.\r" >> $(TMP_INFO)_1
cat $(TMP_INFO)_1 | tr '\r' '\n' > $@
$(DATE): | $(BIN)
date +"D:%Y%m%d%H%M%S%z" | sed "s/\+\([0-9][0-9]\)\([0-9][0-9]\)/\+\1\'\2\'/g" > $@
$(TMP_INFO): $(TMP_PDF)
pdftk $^ dump_data | tr '\n' '\r' > $@
$(BIN):
mkdir -p $(BIN)
.PHONY: clean
clean:
rm $(BIN) __pycache__ -rf
.PHONY: cleanall
cleanall: clean
rm $(PDF) -rf