From 4b0c115b58211dcc063bcd09f8fe122e558b92ce Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 20 Oct 2015 18:52:12 -0400 Subject: literate programming introduced, tangle not yet run --- makefile | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) (limited to 'makefile') 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 -- cgit v1.2.3