Makefile-Emacs 789 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/make -f -
  2. # use emacs as a shell, so that we can write emacs lisp code in here
  3. SHELL := emacs
  4. # set some flags for emacs
  5. .SHELLFLAGS := --quick --batch --eval
  6. # all org mode files will be converted
  7. # orgs := $(wildcard *.org)
  8. # only the list.org file will be converted
  9. orgs := list.org
  10. objs := $(orgs:.org=.md) $(orgs:.org=.texi) $(orgs:.org=.html)
  11. .PHONY: all
  12. all: $(objs)
  13. .PHONY: clean
  14. clean:
  15. /bin/rm --verbose *.html *.md *.texi || true;
  16. # in here comes the shell specific code
  17. .ONESHELL:
  18. %.html %.md %.texi: %.org
  19. (with-temp-buffer
  20. (require 'ox-md)
  21. (require 'ox-texinfo)
  22. (require 'ox-html)
  23. (when (insert-file-contents "$<")
  24. (org-mode)
  25. (org-export-to-file 'md "$*.md")
  26. (org-export-to-file 'texinfo "$*.texi")
  27. (org-export-to-file 'html "$*.html")))