Makefile to create figures from agr file

This commit is contained in:
Markus Rosenstihl 2023-06-02 21:45:40 +02:00
parent 9da99dbedc
commit c2e5ee8c2f

77
Makefile Normal file
View File

@ -0,0 +1,77 @@
# Anzahl an gleichzeitigen Prozessen
MAKEFLAGS+="-j 4"
#
# Alle Dateien die mit 'agr' enden
SRCS=$(wildcard *.agr)
# Verzeichnisse fuer PNG und EPS Dateien
TDIR=Figures
# Generiere Zieldateinamen
PNG200=$(patsubst %.agr,$(TDIR)/%_200.png,$(SRCS))
PNG600=$(patsubst %.agr,$(TDIR)/%_600.png,$(SRCS))
PNG2400=$(patsubst %.agr,$(TDIR)/%_2400.png,$(SRCS))
EPS=$(patsubst %.agr,$(TDIR)/%.eps,$(SRCS))
PDF=$(patsubst %.agr,$(TDIR)/%.pdf,$(SRCS))
PDFOPT=$(patsubst %.agr,$(TDIR)/%_opt.pdf,$(SRCS))
PS=$(patsubst %.agr,$(TDIR)/%.ps,$(SRCS))
# Optionen
OPAQUE=-pexec 'DEVICE "PNG" OP "transparent:off,compression:9"'
#-pexec 'DEVICE "PNG" PAGE SIZE 800, 600'
DPI200=-pexec 'DEVICE "PNG" DPI 200'
DPI600=-pexec 'DEVICE "PNG" DPI 600'
DPI2400=-pexec 'DEVICE "PNG" DPI 2400'
# add pngXXX to make png in XXX resolution, available are 200, 600 and 2400 DPI
# prepare is always needed!
all: prepare pdf
@echo Creating figures in "Figures" folder.
@echo Use "make" to update figures from updated agr files.
@echo Use "make -B" to force regeneration of all figures.
clean:
@echo Delete files in the "Figures" folder yourself, I won't do it!
eps: $(EPS)
ps: $(PS)
png200: $(PNG200) $(TPNG200)
png600: $(PNG600) $(TPNG600)
png2400: $(PNG2400) $(TPNG2400)
pdf: $(PDF)
pdfopt: $(PDFOPT)
# Verzeichnis erstellen
prepare: $(TDIR)
$(TDIR):
mkdir -p $@
$(TDIR)/%.ps : %.agr
LC_NUMERIC=C xmgrace -hardcopy -printfile $@ $<
$(TDIR)/%.eps : %.agr
LC_NUMERIC=C xmgrace -hardcopy -hdevice EPS -printfile $@ $<
$(TDIR)/%_600.png : %.agr
LC_NUMERIC=C xmgrace $(OPAQUE) $(DPI600) -hdevice PNG -hardcopy -printfile $@ $<
$(TDIR)/%_200.png : %.agr
LC_NUMERIC=C xmgrace $(OPAQUE) $(DPI200) -hdevice PNG -hardcopy -printfile $@ $<
$(TDIR)/%_2400.png : %.agr
LC_NUMERIC=C xmgrace $(OPAQUE) $(DPI2400) -hdevice PNG -hardcopy -printfile $@ $<
$(TDIR)/%.pdf : $(TDIR)/%.ps
epstopdf $< $@
# the following are not doing anything useful, used as an example only
$(TDIR)/%_opt.pdf : $(TDIR)/%.pdf
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.7 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$@ $<
# epspdf $<
# epspdf -b $@ $<
# inkscape $@ --export-filename $<
#$(TDIR)/%.pdf : $(TDIR)/%.ps
# #ps2pdf -dEPSCrop $< $@