-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
36 lines (30 loc) · 1.07 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
WWWDIR=$(HOME)/Documents/Websites/tcs.uni-frankfurt.de/static/teaching/summer21/algo1
SOURCES=$(wildcard *.tex)
TARGETS=$(patsubst %.tex,%.pdf,$(SOURCES))
GITINFOS=$(patsubst %.tex,%.gitinfo,$(SOURCES))
%.gitinfo: .git/logs/HEAD
@echo "%%% This file is generated by Makefile." > [email protected]
@echo "%%% Do not edit this file!%%%" >> [email protected]
@git log -1 --format="format:\\gdef\\gitHash{%H}\\gdef\\gitAbbrevHash{%h}\\gdef\\gitAuthorDate{%as}\\gdef\\gitAuthorIsoDate{%ad}\\gdef\\gitAuthorName{%an}" $(patsubst %.gitinfo,%.tex,$@) >> [email protected]
@if ! diff $@ [email protected] &> /dev/null; then mv [email protected] $@; else rm [email protected]; fi
%.pdf: %.tex %.gitinfo algo121.sty uebung_cs.cls allgemeine-kriterien.inc
latexmk $<
.PHONY: all
all: $(TARGETS)
.PHONY: gitinfo
gitinfo: $(GITINFOS)
.PHONY: deploy
deploy: all
@if test -d $(WWWDIR); then \
for f in $(TARGETS); do \
if ! diff $$f $(WWWDIR)/$$f &> /dev/null; then \
cp $$f $(WWWDIR)/$$f; \
echo "Copied $$f to WWWDIR."; \
fi; \
done \
fi
@cd $(WWWDIR) && yarn build && yarn upload
.PHONY: clean
clean:
rm -f *.gitinfo *.gitinfo.new
latexmk -C