diff options
Diffstat (limited to 'pandoc.mk')
-rw-r--r-- | pandoc.mk | 32 |
1 files changed, 21 insertions, 11 deletions
@@ -5,11 +5,20 @@ CLEAN_TARGETS += clean_md REAL_CLEAN_TARGETS += real_clean_md +dest_dir_md ?= $(dest_dir) +destination_dirs += $(dest_dir_md) + md_files = $(wildcard *.md) tex_from_md = $(md_files:%.md=%.tex) pdf_from_md = $(md_files:%.md=%.pdf) html_from_md = $(md_files:%.md=%.html) +md_src_dest_targets = $(md_files:%=$(dest_dir_md)/%) +md_fig_dest_targets = $(md_fig_files:%=$(dest_dir_md)/%) +tex_from_md_dest_targets = $(tex_from_md:%=$(dest_dir_md)/%) +pdf_from_md_dest_targets = $(pdf_from_md:%=$(dest_dir_md)/%) +html_from_md_dest_targets = $(html_from_md:%=$(dest_dir_md)/%) + # to disable preprocessor use #PANDOC_PREPROCESSOR_CMD ?= cat #PANDOC_PREPROCESSOR_OPTIONS ?= @@ -83,27 +92,28 @@ $(pdf_from_md): %.pdf : %.md $(md_fig_files) $(md_configs) $(PANDOC_PREPROCESSOR) $< | $(PANDOC_PDF_METADATA) | $(PANDOC) $(PANDOC_PDF_OPTIONS) -o $@ -dest_dir_md: - $(INSTALL) -d -m 0755 $(dest_dir) - -install_md_src: dest_dir_md install_md_fig_files +install_md_src: $(md_src_dest_targets) install_md_fig_files +$(md_src_dest_targets): $(dest_dir_md)/% : % | $(dest_dir_md) ifneq ($(strip $(md_files)),) - $(INSTALL) -m 0644 $(html_from_md) $(dest_dir)/ + $(INSTALL) -m 0644 '$<' '$@' endif -install_md_fig_files: +install_md_fig_files: $(md_fig_dest_targets) +$(md_fig_dest_targets): $(dest_dir_md)/% : % | $(dest_dir_md) ifneq ($(strip $(md_fig_files)),) - $(INSTALL) -m 0644 $(md_fig_files) $(dest_dir)/ + $(INSTALL) -m 0644 '$<' '$@' endif -install_html_md: dest_dir_md $(html_from_md) install_md_fig_files +install_html_md: $(html_from_md_dest_targets) install_md_fig_files +$(html_from_md_dest_targets): $(dest_dir_md)/% : % | $(dest_dir_md) ifneq ($(strip $(html_from_md)),) - $(INSTALL) -m 0644 $(html_from_md) $(dest_dir)/ + $(INSTALL) -m 0644 '$<' '$@' endif -install_pdf_md: dest_dir_md $(pdf_from_md) +install_pdf_md: $(pdf_from_md_dest_targets) +$(pdf_from_md_dest_targets): $(dest_dir_md)/% : % | $(dest_dir_md) ifneq ($(strip $(pdf_from_md)),) - $(INSTALL) -m 0644 $(pdf_from_md) $(dest_dir)/ + $(INSTALL) -m 0644 '$<' '$@' endif clean_md: clean_md_aux |