stud/II/Referatas/Makefile

116 lines
4.3 KiB
Makefile
Raw Normal View History

2020-06-18 09:37:54 +03:00
CROSSING = 622916 6109267 626066 6111487 # xmin ymin xmax ymax
2020-05-27 12:23:09 +03:00
ZEIMENA_TOLERANCES = 128 256 512 1024 2048 4096
2020-05-27 14:45:11 +03:00
SINEWAVE_TOLERANCES = 2 16 32
2020-06-18 11:05:13 +03:00
CROSSING_TOLERANCES = 128 256 512
CHAIKIN_CROSSING_TOLERANCES = 128 256 512
2020-05-27 12:34:32 +03:00
SINEWAVE_SIZE = 120x48
2020-05-27 12:01:03 +03:00
GEN1 = $(addsuffix .pdf, \
2020-06-18 09:37:54 +03:00
$(addprefix sinewave2_douglas_,$(SINEWAVE_TOLERANCES)) \
$(addprefix sinewave2_visvalingam_,$(SINEWAVE_TOLERANCES)) \
$(addprefix zeimena_douglas_,$(ZEIMENA_TOLERANCES)) \
$(addprefix zeimena_visvalingam_,$(ZEIMENA_TOLERANCES)))
2020-05-27 12:01:03 +03:00
GEN2 = $(addsuffix .pdf, \
2020-06-18 09:37:54 +03:00
$(addprefix overlaid_zeimena_douglas_,$(CROSSING_TOLERANCES)) \
$(addprefix overlaid_zeimena_visvalingam_,$(CROSSING_TOLERANCES)) \
$(addprefix overlaid_sinewave2_douglas_,$(SINEWAVE_TOLERANCES)) \
$(addprefix overlaid_sinewave2_visvalingam_,$(SINEWAVE_TOLERANCES)))
2020-06-18 10:38:05 +03:00
GEN3 = $(addsuffix .pdf, \
$(addprefix overlaid_chaikin_zeimena_douglas_,$(CHAIKIN_CROSSING_TOLERANCES)) \
$(addprefix overlaid_chaikin_zeimena_visvalingam_,$(CHAIKIN_CROSSING_TOLERANCES)))
2020-05-27 12:01:03 +03:00
2020-06-03 15:59:19 +03:00
.PHONY: all
all: mj-referatas.pdf mj-prezentacija.pdf
2021-01-04 12:56:54 +02:00
mj-referatas-bundle.pdf: mj-referatas.pdf $(shell git ls-files)
2021-01-04 12:55:00 +02:00
cp $< .tmp-$@
for f in $^; do \
if [ "$$f" = "$<" ]; then continue; fi; \
pdfattach .tmp-$@ $$f .tmp2-$@; \
mv .tmp2-$@ .tmp-$@; \
done
mv .tmp-$@ $@
2020-06-21 17:37:33 +03:00
mj-referatas.pdf: mj-referatas.tex version.tex bib.bib zeimena.pdf zeimena-pretty.pdf \
2020-06-18 10:38:05 +03:00
sinewave1.pdf sinewave2.pdf crossing.pdf $(GEN1) $(GEN2) $(GEN3)
2020-05-27 15:23:54 +03:00
latexmk -shell-escape -g -pdf $<
2020-05-22 10:19:17 +03:00
2020-06-03 18:38:44 +03:00
mj-prezentacija.pdf: mj-prezentacija.tex ../../misc/Logo_vilniaus_universitetas.png \
2020-06-03 18:30:14 +03:00
zeimena.pdf crossing.pdf $(GEN2) images/wang1998line.png
2020-06-03 15:59:19 +03:00
latexmk -pdf $<
2020-05-25 13:47:55 +03:00
define algo2img
2020-06-18 09:37:54 +03:00
db/.faux_$(1)_$(2)_%: $(2).sql db/.faux_ready
2020-05-27 15:23:54 +03:00
./managedb -- --echo-all \
-v ON_ERROR_STOP=1 \
-v src=$(1) \
2020-06-18 09:37:54 +03:00
-v param1=$$* \
2020-05-27 15:23:54 +03:00
-v tbl=$(1)_$(2)_$$* \
-f $(2).sql
2020-05-26 12:11:41 +03:00
touch $$@
2020-06-18 10:03:55 +03:00
db/.chaikin_$(1)_$(2)_%: db/.faux_$(1)_$(2)_% chaikin.sql
2020-06-18 09:37:54 +03:00
./managedb -- --echo-all \
-v ON_ERROR_STOP=1 \
2020-06-18 10:03:55 +03:00
-v src=$(1)_$(2)_$$* \
-v tbl=chaikin_$(1)_$(2)_$$* \
2020-06-18 09:37:54 +03:00
-f chaikin.sql
touch $$@
$(1)_$(2)_%.pdf: layer2img.py db/.faux_$(1)_$(2)_%
2020-05-27 12:23:09 +03:00
./layer2img.py --group2-table=$(1)_$(2)_$$* --size=$(3) --outfile $$@
2020-05-27 12:01:03 +03:00
endef
2020-06-18 10:46:42 +03:00
2020-05-27 12:01:03 +03:00
define algo2overlay
2020-06-18 09:37:54 +03:00
overlaid_$(1)_$(2)_%.pdf: layer2img.py db/.faux_$(1)_$(2)_%
2020-05-27 15:23:54 +03:00
./layer2img.py $(3) --group1-table=$(1) --group2-table=$(1)_$(2)_$$* \
--outfile $$@
2020-06-18 10:46:42 +03:00
overlaid_chaikin_$(1)_$(2)_%.pdf: layer2img.py db/.chaikin_$(1)_$(2)_%
2020-06-18 10:38:05 +03:00
./layer2img.py $(3) \
--group1-table=$(1) \
2020-06-18 10:46:42 +03:00
--group2-table=chaikin_$(1)_$(2)_$$* \
2020-06-18 10:38:05 +03:00
--outfile $$@
2020-05-25 13:04:39 +03:00
endef
2020-06-18 10:46:42 +03:00
2020-05-26 16:10:54 +03:00
define gpkg2pdf
2020-05-27 11:06:10 +03:00
$(1): $(2) ./layer2img.py
2020-05-27 12:23:09 +03:00
./layer2img.py $(3) --group1-infile=$$< --outfile $(1)
2020-05-26 16:10:54 +03:00
endef
2020-05-28 19:41:10 +03:00
$(eval $(call algo2img,sinewave2,douglas,$(SINEWAVE_SIZE)))
$(eval $(call algo2img,sinewave2,visvalingam,$(SINEWAVE_SIZE)))
2020-05-27 12:01:03 +03:00
$(eval $(call algo2img,zeimena,douglas,210x297))
$(eval $(call algo2img,zeimena,visvalingam,210x297))
2020-05-27 14:49:22 +03:00
$(eval $(call gpkg2pdf,sinewave1.pdf,sinewave1.gpkg,--size=$(SINEWAVE_SIZE)))
$(eval $(call gpkg2pdf,sinewave2.pdf,sinewave2.gpkg,--size=$(SINEWAVE_SIZE)))
2020-05-27 15:23:54 +03:00
$(eval $(call gpkg2pdf,zeimena.pdf,zeimena.gpkg rectangle.gpkg,\
--size=134x191 --group2-infile rectangle.gpkg))
2020-06-18 11:09:00 +03:00
$(eval $(call gpkg2pdf,crossing.pdf,zeimena.gpkg,\
--size=105x74 --group2-infile rectangle.gpkg --clip $(CROSSING)))
2020-05-27 12:34:32 +03:00
$(eval $(call algo2overlay,zeimena,douglas,--size 148x105 --clip $(CROSSING)))
$(eval $(call algo2overlay,zeimena,visvalingam,--size 148x105 --clip $(CROSSING)))
2020-05-27 14:41:47 +03:00
$(eval $(call algo2overlay,sinewave2,douglas,--size $(SINEWAVE_SIZE)))
$(eval $(call algo2overlay,sinewave2,visvalingam,--size $(SINEWAVE_SIZE)))
2020-05-22 10:19:17 +03:00
2020-05-27 13:56:37 +03:00
sinewave%.gpkg: fig2layer.py
./fig2layer.py -o $@ sine --numwaves=$*
2020-05-26 12:11:41 +03:00
2020-05-27 10:26:59 +03:00
rectangle.gpkg: fig2layer.py
2020-05-27 10:53:54 +03:00
./fig2layer.py -o $@ rect --bounds $(CROSSING)
2020-05-27 10:26:59 +03:00
2020-05-27 14:05:21 +03:00
db/.faux_ready: zeimena.gpkg sinewave2.gpkg managedb
2020-05-22 10:19:17 +03:00
-./managedb stop; rm -fr db
./managedb init
2020-05-26 12:11:41 +03:00
ogr2ogr -f PostgreSQL "PG:host=127.0.0.1 user=osm dbname=osm" zeimena.gpkg
2020-05-27 14:05:21 +03:00
ogr2ogr -f PostgreSQL "PG:host=127.0.0.1 user=osm dbname=osm" sinewave2.gpkg
2020-05-22 10:19:17 +03:00
touch $@
2020-06-02 10:45:13 +03:00
REF = $(shell git describe --tags --dirty)
2020-05-22 10:19:17 +03:00
GIT_DIR = $(shell git rev-parse --show-toplevel)/.git
version.tex: $(shell git ls-files .) $(GIT_DIR)
2020-05-22 22:20:47 +03:00
( \
date '+\gdef\GeneratedAt{%F %T %Z}%'; \
2020-06-02 10:45:13 +03:00
printf '\gdef\VCDescribe{%s}%%\n' $(REF); \
2020-05-22 22:20:47 +03:00
) > $@
2020-06-21 17:37:33 +03:00
# Optional: vizualize and analyze dependencies and artifacts of this Makefile
make.png:
$(MAKE) -Bnd | grep -Ev 'Makefile|version.tex|.git' | make2graph | dot -Tpng -o $@