From 6549136606ba6ec2cfe91efaa00a018ce2f586d2 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Thu, 16 Apr 2015 23:21:21 -0400 Subject: raw and tex files properly use for dest_dirs.mk capabilities --- raw.mk | 12 ++++++------ tex.mk | 29 ++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/raw.mk b/raw.mk index 7ed5761..d3688c3 100644 --- a/raw.mk +++ b/raw.mk @@ -4,18 +4,18 @@ CLEAN_TARGETS += clean_raw REAL_CLEAN_TARGETS += real_clean_raw -raw_dest_targets = $(raw_files:%=$(dest_dir)/%) +dest_dir_raw ?= $(dest_dir) +destination_dirs += $(dest_dir_raw) + +raw_dest_targets = $(raw_files:%=$(dest_dir_raw)/%) clean_raw: real_clean_raw: -dest_dir_raw: - $(INSTALL) -d -m 0755 $(dest_dir) - -install_raw: dest_dir_raw $(raw_dest_targets) +install_raw: $(raw_dest_targets) -$(raw_dest_targets): $(dest_dir)/% : % +$(raw_dest_targets): $(dest_dir_raw)/% : % | $(dest_dir_raw) ifneq ($(strip $(raw_files)),) $(INSTALL) -m 0644 '$<' '$@' endif 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 -- cgit v1.2.3