summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2013-10-22 13:18:55 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2013-10-22 13:18:55 -0400
commite4a96cee395549dccb18f81b03724fe2d517c88f (patch)
treeab5d11e939f21c51683f00374bac6de61100a525
downloadmakefile_templates-e4a96cee395549dccb18f81b03724fe2d517c88f.tar.gz
makefile_templates-e4a96cee395549dccb18f81b03724fe2d517c88f.zip
init
-rw-r--r--css.mk35
-rw-r--r--raw.mk19
-rw-r--r--subdir_makefile/Makefile27
-rw-r--r--subdirs.mk9
-rw-r--r--t2t.mk87
-rw-r--r--tex.mk60
6 files changed, 237 insertions, 0 deletions
diff --git a/css.mk b/css.mk
new file mode 100644
index 0000000..f4decfa
--- /dev/null
+++ b/css.mk
@@ -0,0 +1,35 @@
+# -*- make -*-
+# (C) 2013 by Eugeniy Mikhailov, <evgmik@gmail.com>
+
+CLEAN_TARGETS += clean_css
+REAL_CLEAN_TARGETS += real_clean_css
+
+scss_files = $(wildcard *.scss)
+css_targets = $(scss_files:%.scss=%.css)
+
+css: $(css_targets)
+
+$(css_targets): %.css : %.scss
+ sass $< > $@
+
+clean_css:
+ rm -rf .sass-cache
+
+real_clean_css:
+ifneq ($(strip $(css_targets)),)
+ rm -f $(css_targets)
+endif
+
+dest_dir_css:
+ $(INSTALL) -d -m 0755 $(dest_dir)
+
+install_css: dest_dir_css
+ifneq ($(strip $(css_targets)),)
+ $(INSTALL) -m 0644 $(css_targets) $(dest_dir)/
+endif
+
+install_css_src: dest_dir_css
+ifneq ($(strip $(scss_files)),)
+ $(INSTALL) -m 0644 $(scss_files) $(dest_dir)/
+endif
+
diff --git a/raw.mk b/raw.mk
new file mode 100644
index 0000000..33b24e6
--- /dev/null
+++ b/raw.mk
@@ -0,0 +1,19 @@
+# -*- make -*-
+# (C) 2013 by Eugeniy Mikhailov, <evgmik@gmail.com>
+
+CLEAN_TARGETS += clean_raw
+REAL_CLEAN_TARGETS += real_clean_raw
+
+clean_raw:
+
+real_clean_raw:
+
+dest_dir_raw:
+ $(INSTALL) -d -m 0755 $(dest_dir)
+
+install_raw: dest_dir_raw
+ifneq ($(strip $(raw_files)),)
+ $(INSTALL) -m 0644 $(raw_files) $(dest_dir)/
+endif
+
+
diff --git a/subdir_makefile/Makefile b/subdir_makefile/Makefile
new file mode 100644
index 0000000..65fa78f
--- /dev/null
+++ b/subdir_makefile/Makefile
@@ -0,0 +1,27 @@
+# -*- make -*-
+
+# Default value so one can compile this standalone
+TOPDIR ?= ..
+include ./local.mk
+include $(TOPDIR)/common.mk
+include $(MAKEINCLUDE_DIR)/t2t.mk
+include $(MAKEINCLUDE_DIR)/tex.mk
+include $(MAKEINCLUDE_DIR)/css.mk
+include $(MAKEINCLUDE_DIR)/raw.mk
+include $(MAKEINCLUDE_DIR)/subdirs.mk
+
+
+dest_dir = $(DESTDIR)$(PREFIX)/$(PACKAGE_DIR)
+
+.DEFAULT_GOAL := all
+
+all: compile install
+
+compile: subdirs $(REQUIRED_TARGETS)
+
+clean: subdirs $(CLEAN_TARGETS)
+
+real_clean: subdirs clean $(REAL_CLEAN_TARGETS)
+
+install: subdirs $(INSTALL_TARGETS)
+
diff --git a/subdirs.mk b/subdirs.mk
new file mode 100644
index 0000000..ec45cfb
--- /dev/null
+++ b/subdirs.mk
@@ -0,0 +1,9 @@
+# -*- make -*-
+
+subdirs: $(SUBDIRS)
+
+$(SUBDIRS):
+ echo $(MAKE) -C $@ $(MAKECMDGOALS)
+ $(MAKE) -C $@ $(MAKECMDGOALS)
+
+.PHONY: $(SUBDIRS)
diff --git a/t2t.mk b/t2t.mk
new file mode 100644
index 0000000..e1c3bc8
--- /dev/null
+++ b/t2t.mk
@@ -0,0 +1,87 @@
+# -*- make -*-
+# (C) 2013 by Eugeniy Mikhailov, <evgmik@gmail.com>
+
+CLEAN_TARGETS += clean_t2t
+REAL_CLEAN_TARGETS += real_clean_t2t
+
+t2t_files = $(wildcard *.t2t)
+tex_from_t2t = $(t2t_files:%.t2t=%.tex)
+pdf_from_t2t = $(tex_from_t2t:%.tex=%.pdf)
+html_from_t2t = $(t2t_files:%.t2t=%.html)
+
+html_t2t: $(html_from_t2t)
+
+pdf_tex: $(pdf_from_independent_tex)
+
+pdf_t2t: $(pdf_from_t2t)
+
+tex_t2t: $(tex_from_t2t)
+
+
+
+$(html_from_t2t): %.html : %.t2t $(t2t_fig_files) $(t2t_configs)
+ txt2tags --css-sugar -t html -o $@ $<
+
+$(tex_from_t2t): %.tex : %.t2t $(t2t_fig_files) $(t2t_configs)
+ txt2tags -t tex -o $@ $<
+
+$(pdf_from_t2t): %.pdf : %.tex $(t2t_fig_files)
+ rubber -d $<
+
+
+dest_dir_t2t:
+ $(INSTALL) -d -m 0755 $(dest_dir)
+
+install_t2t_src: dest_dir_t2t install_t2t_fig_files
+ifneq ($(strip $(t2t_files)),)
+ $(INSTALL) -m 0644 $(html_from_t2t) $(dest_dir)/
+endif
+
+install_t2t_fig_files:
+ifneq ($(strip $(t2t_fig_files)),)
+ $(INSTALL) -m 0644 $(t2t_fig_files) $(dest_dir)/
+endif
+
+install_html_t2t: dest_dir_t2t $(html_from_t2t) install_t2t_fig_files
+ifneq ($(strip $(html_from_t2t)),)
+ $(INSTALL) -m 0644 $(html_from_t2t) $(dest_dir)/
+endif
+
+install_pdf_t2t: dest_dir_t2t $(pdf_from_t2t)
+ifneq ($(strip $(pdf_from_t2t)),)
+ $(INSTALL) -m 0644 $(pdf_from_t2t) $(dest_dir)/
+endif
+
+clean_t2t: clean_t2t_aux
+
+real_clean_t2t: clean_t2t_tex clean_t2t_aux
+ifneq ($(strip $(pdf_from_t2t)),)
+ rm -f $(pdf_from_t2t)
+endif
+ifneq ($(strip $(html_from_t2t)),)
+ rm -f $(html_from_t2t)
+endif
+
+clean_t2t_tex:
+ifneq ($(strip $(tex_from_t2t)),)
+ rm -f $(tex_from_t2t)
+endif
+
+clean_t2t_aux:
+ifneq ($(strip $(tex_from_t2t)),)
+ rm -f $(tex_from_t2t:%.tex=%.dvi)
+ rm -f $(tex_from_t2t:%.tex=%.log)
+ rm -f $(tex_from_t2t:%.tex=%.aux)
+ rm -f $(tex_from_t2t:%.tex=%.nav)
+ rm -f $(tex_from_t2t:%.tex=%.out)
+ rm -f $(tex_from_t2t:%.tex=%.snm)
+ rm -f $(tex_from_t2t:%.tex=%.toc)
+ rm -f $(tex_from_t2t:%.tex=%.vrb)
+ rm -f $(tex_from_t2t:%.tex=%.blg)
+ rm -f $(tex_from_t2t:%.tex=%.bbl)
+ rm -f missfont.log
+ rm -f *Notes.bib
+endif
+
+
+
diff --git a/tex.mk b/tex.mk
new file mode 100644
index 0000000..f130ee9
--- /dev/null
+++ b/tex.mk
@@ -0,0 +1,60 @@
+# -*- make -*-
+# (C) 2013 by Eugeniy Mikhailov, <evgmik@gmail.com>
+
+CLEAN_TARGETS += clean_tex
+REAL_CLEAN_TARGETS += real_clean_tex
+
+pdf_from_independent_tex= $(tex_independent:%.tex=%.pdf)
+tex_independent_bases= $(tex_independent:%.tex=%)
+
+tex_includes_bases = $(tex_includes:%.tex=%)
+
+pdf_tex: $(pdf_from_independent_tex)
+
+# rubber does not deal with nicely with subfiles
+# thus force switch below
+$(pdf_from_independent_tex): %.pdf : %.tex $(tex_fig_files) $(tex_includes)
+ rubber -f -d $<
+
+dest_dir_tex:
+ $(INSTALL) -d -m 0755 $(dest_dir)
+
+install_pdf_tex: dest_dir_tex $(pdf_from_independent_tex)
+ifneq ($(strip $(pdf_from_independent_tex)),)
+ $(INSTALL) -m 0644 $(pdf_from_independent_tex) $(dest_dir)/
+endif
+
+install_tex_src: 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)/
+endif
+
+clean_tex: clean_tex_aux
+
+clean_tex_aux:
+ifneq ($(strip $(tex_independent_bases)),)
+ rm -f $(tex_independent_bases:%=%.dvi)
+ rm -f $(tex_independent_bases:%=%.log)
+ rm -f $(tex_independent_bases:%=%.aux)
+ rm -f $(tex_independent_bases:%=%.nav)
+ rm -f $(tex_independent_bases:%=%.out)
+ rm -f $(tex_independent_bases:%=%.snm)
+ rm -f $(tex_independent_bases:%=%.toc)
+ rm -f $(tex_independent_bases:%=%.vrb)
+ rm -f $(tex_independent_bases:%=%.blg)
+ rm -f $(tex_independent_bases:%=%.bbl)
+ rm -f missfont.log
+ rm -f *Notes.bib
+endif
+ifneq ($(strip $(tex_includes_bases)),)
+ rm -f $(tex_includes_bases:%=%.aux)
+endif
+
+real_clean_tex: clean_tex_aux
+ifneq ($(strip $(pdf_from_independent_tex)),)
+ rm -f $(pdf_from_independent_tex)
+endif
+