summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--css.mk18
-rw-r--r--pandoc.mk32
-rw-r--r--rem.mk12
3 files changed, 41 insertions, 21 deletions
diff --git a/css.mk b/css.mk
index f4decfa..2ae62e8 100644
--- a/css.mk
+++ b/css.mk
@@ -4,8 +4,13 @@
CLEAN_TARGETS += clean_css
REAL_CLEAN_TARGETS += real_clean_css
+dest_dir_css ?= $(dest_dir)
+destination_dirs += $(dest_dir_css)
+
scss_files = $(wildcard *.scss)
css_targets = $(scss_files:%.scss=%.css)
+scss_src_dest_targets = $(scss_files:%=$(dest_dir_css)/%)
+css_dest_targets = $(css_targets:%=$(dest_dir_css)/%)
css: $(css_targets)
@@ -20,16 +25,17 @@ ifneq ($(strip $(css_targets)),)
rm -f $(css_targets)
endif
-dest_dir_css:
- $(INSTALL) -d -m 0755 $(dest_dir)
+install_css: $(css_dest_targets)
-install_css: dest_dir_css
+$(css_dest_targets): $(dest_dir_css)/% : % | $(dest_dir_css)
ifneq ($(strip $(css_targets)),)
- $(INSTALL) -m 0644 $(css_targets) $(dest_dir)/
+ $(INSTALL) -m 0644 '$<' '$@'
endif
-install_css_src: dest_dir_css
+install_css_src: $(scss_src_dest_targets)
+
+$(scss_src_dest_targets): $(dest_dir_css)/% : % | $(dest_dir_css)
ifneq ($(strip $(scss_files)),)
- $(INSTALL) -m 0644 $(scss_files) $(dest_dir)/
+ $(INSTALL) -m 0644 '$<' '$@'
endif
diff --git a/pandoc.mk b/pandoc.mk
index 36264cf..532c900 100644
--- a/pandoc.mk
+++ b/pandoc.mk
@@ -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
diff --git a/rem.mk b/rem.mk
index b070616..1d8be29 100644
--- a/rem.mk
+++ b/rem.mk
@@ -4,8 +4,12 @@
CLEAN_TARGETS += clean_rem
REAL_CLEAN_TARGETS += real_clean_rem
+dest_dir_rem ?= $(dest_dir)
+destination_dirs += $(dest_dir_rem)
+
rem_files = $(wildcard *.rem)
html_from_rem = $(rem_files:%.rem=%.html)
+html_from_rem_dest_targets = $(html_from_rem:%=$(dest_dir_rem)/%)
html_rem: $(html_from_rem)
@@ -21,12 +25,12 @@ ifneq ($(strip $(html_from_rem)),)
rm -f $(html_from_rem)
endif
-dest_dir_rem:
- $(INSTALL) -d -m 0755 $(dest_dir)
-install_html_from_rem: dest_dir_rem $(html_from_rem)
+install_html_from_rem: $(html_from_rem_dest_targets)
+
+$(html_from_rem_dest_targets): $(dest_dir_rem)/% : % | $(dest_dir_rem)
ifneq ($(strip $(html_from_rem)),)
- $(INSTALL) -m 0644 $(html_from_rem) $(dest_dir)/
+ $(INSTALL) -m 0644 '$<' '$@'
endif