summaryrefslogtreecommitdiff
path: root/tex.mk
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2015-04-16 23:21:21 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2015-04-16 23:21:21 -0400
commit6549136606ba6ec2cfe91efaa00a018ce2f586d2 (patch)
tree84f8a2903c1ee9d6b435caf293f8500ccc18f05c /tex.mk
parent04446741647dce023766af5cdfe0ac6bdb563e0c (diff)
downloadmakefile_templates-6549136606ba6ec2cfe91efaa00a018ce2f586d2.tar.gz
makefile_templates-6549136606ba6ec2cfe91efaa00a018ce2f586d2.zip
raw and tex files properly use for dest_dirs.mk capabilities
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