diff options
-rw-r--r-- | raw.mk | 12 | ||||
-rw-r--r-- | tex.mk | 29 |
2 files changed, 26 insertions, 15 deletions
@@ -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 @@ -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 |