aboutsummaryrefslogtreecommitdiffhomepage
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile49
1 files changed, 45 insertions, 4 deletions
diff --git a/makefile b/makefile
index 5fe6f58..de2a78e 100644
--- a/makefile
+++ b/makefile
@@ -31,6 +31,13 @@ PRG_SRC=$(PRG_NAME).d
PRG_SRCDIR=./lib/$(PRG_NAME)
PRG_BIN=$(PRG_NAME)
PRG_BINDIR=bin
+# ORG
+EMACSLISP=/usr/share/emacs/site-lisp
+EMACSLISP_ORG=~/.emacs.d/elpa/org-20151005
+EMACSLISP_ORG_CONTRIB=~/.emacs.d/elpa/org-plus-contrib-20151005
+ORGFILELIST=$(shell echo `ls -1 maker.org org/*.org`)
+ORGFILES=""
+ORGDIR=$(shell echo `pwd`)
all: build
@@ -61,16 +68,50 @@ debug_gdc: $(PRG_SRCDIR)/$(PRG_SRC)
$(GDC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \
$(PRG_SRCDIR)/$(PRG_SRC)
-release: $(PRG_SRCDIR)/$(PRG_SRC)
+release: distclean_and_init tangle $(PRG_SRCDIR)/$(PRG_SRC)
$(DC) $(DC_FLAGS) $(DC_FLAGS_RELEASE) \
$(DC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \
$(PRG_SRCDIR)/$(PRG_SRC)
+init:
+ mkdir -p $(PRG_SRCDIR); \
+ mkdir -p $(PRG_BINDIR);
+
clean: $(PRG_BINDIR)/$(PRG_BIN).o
rm $(PRG_BINDIR)/$(PRG_NAME).o
-distclean: $(PRG_BINDIR)
- rm -rf $(PRG_BINDIR)
+expunge: init $(PRG_BINDIR)
+ rm -rf $(PRG_BINDIR); \
+ rm -rf $(PRG_SRCDIR);
+
+distclean: init $(PRG_BINDIR) expunge
+
+distclean_and_init: init $(PRG_BINDIR) expunge
+ mkdir -p $(PRG_SRCDIR); \
+ mkdir -p $(PRG_BINDIR);
+
+tangle:
+ for f in $(ORGFILELIST); do \
+ ORGFILES="$$ORGFILES \"$$f\""; \
+ done; \
+ emacs --batch -Q -q \
+ --eval "(progn \
+ (add-to-list 'load-path \
+ (expand-file-name \"$(EMACSLISP)\")) \
+ (add-to-list 'load-path \
+ (expand-file-name \"$(EMACSLISP_ORG)\" t)) \
+ (add-to-list 'load-path \
+ (expand-file-name \"$(EMACSLISP_ORG_CONTRIB)\" t)) \
+ (require 'org)(require 'ob)(require 'ob-tangle) \
+ (mapc (lambda (file) \
+ (find-file (expand-file-name file \"$(ORGDIR)\")) \
+ (setq-local org-src-preserve-indentation t) \
+ (org-babel-tangle) \
+ (kill-buffer)) '($$ORGFILES)))" 2>&1
+
+gitsnapshot: distclean_and_init tangle
+ git commit -a
.PHONY : all build rebuild debug release \
- clean distclean
+ clean distclean init \
+ tangle