summaryrefslogtreecommitdiff
path: root/tex.mk
diff options
context:
space:
mode:
Diffstat (limited to 'tex.mk')
-rw-r--r--tex.mk29
1 files changed, 20 insertions, 9 deletions
diff --git a/tex.mk b/tex.mk
index 1a6e447..5dfc7dc 100644
--- a/tex.mk
+++ b/tex.mk
@@ -4,6 +4,9 @@
CLEAN_TARGETS += clean_tex
REAL_CLEAN_TARGETS += real_clean_tex
+dest_dir_tex ?= $(dest_dir)
+destination_dirs += $(dest_dir_tex)
+
pdf_from_independent_tex= $(tex_independent:%.tex=%.pdf)
tex_independent_bases= $(tex_independent:%.tex=%)
@@ -11,6 +14,16 @@ tex_includes_bases = $(tex_includes:%.tex=%)
pdf_tex: $(pdf_from_independent_tex)
+pdf_tex_dest_targets = $(pdf_from_independent_tex:%=$(dest_dir_tex)/%)
+
+tex_dest_targets = $(tex_independent:%=$(dest_dir_tex)/%)
+ifneq ($(strip $(tex_includes)),)
+tex_dest_targets += $(tex_includes:%=$(dest_dir_tex)/%)
+endif
+ifneq ($(strip $(tex_fig_files)),)
+tex_dest_targets += $(tex_fig_files:%=$(dest_dir_tex)/%)
+endif
+
# rubber does not deal with nicely with subfiles
# thus force switch below
$(pdf_from_independent_tex): %.pdf : %.tex $(tex_fig_files) $(tex_includes)
@@ -23,20 +36,18 @@ else
pdflatex $<
endif
-dest_dir_tex:
- $(INSTALL) -d -m 0755 $(dest_dir)
+install_pdf_tex: $(pdf_tex_dest_targets)
-install_pdf_tex: dest_dir_tex $(pdf_from_independent_tex)
+$(pdf_tex_dest_targets): $(dest_dir_tex)/% : % | $(dest_dir_tex)
ifneq ($(strip $(pdf_from_independent_tex)),)
- $(INSTALL) -m 0644 $(pdf_from_independent_tex) $(dest_dir)/
+ $(INSTALL) -m 0644 '$<' '$@'
endif
-install_tex_src: dest_dir_tex
+install_tex_src: $(tex_dest_targets)
+
+$(tex_dest_targets): $(dest_dir_tex)/% : % | $(dest_dir_tex)
ifneq ($(strip $(tex_independent)),)
- $(INSTALL) -m 0644 $(tex_independent) $(dest_dir)/
-endif
-ifneq ($(strip $(tex_fig_files)),)
- $(INSTALL) -m 0644 $(tex_fig_files) $(dest_dir)/
+ $(INSTALL) -m 0644 '$<' '$@'
endif
clean_tex: clean_tex_aux