more robust shell code for install/clean-install
[org-mode/org-mode-NeilSmithlineMods.git] / lisp / Makefile
blob0824ffe78ebdc51ef5aa5aede87683197f76827c
1 ORG-INSTALL = $(BATCH) \
2 --eval "(require 'autoload)" \
3 --eval '(find-file "$(LISPO)")' \
4 --eval '(erase-buffer)' \
5 --eval '(mapc (lambda (x) (generate-file-autoloads (symbol-name x))) (quote ($(LISPF))))' \
6 --eval '(insert "\n(provide (quote org-install))\n")' \
7 --eval '(insert "\n(defconst org-release \"$(ORGVERSION)\"\n \"The release version of org-mode. Inserted by installing org-mode\n or when a release is made.\")\n")' \
8 --eval '(insert "\n(defconst org-git-version \"$(GITVERSION)\"\n \"The Git version of org-mode. Inserted by installing org-mode\n or when a release is made.\")\n")' \
9 --eval '(insert "\n(defconst org-odt-data-dir \"$(datadir)\"\n \"The location of ODT styles.\")\n")' \
10 --eval '(save-buffer)'
11 -include local.mk # optional local customization
13 .NOTPARALLEL: # always run this make serially
14 .SUFFIXES: # we don't need default suffix rules
15 ifeq ($(MAKELEVEL), 0)
16 $(error This make needs to be started as a sub-make from the toplevel directory.)
17 endif
19 LISPO = org-install.el
20 LISPF = $(subst $(LISPO),,$(wildcard *.el))
21 LISPC = $(LISPF:%el=%elc)
23 .PHONY: all compile compile-dirty autoloads install clean cleanall clean-install
25 all \
26 compile \
27 compile-dirty: cleanauto
28 $(ELCDIR)
30 autoloads: $(LISPO)
32 org-install.el: $(LISPF)
33 $(ORG-INSTALL)
35 install: $(LISPF) compile autoloads
36 if [ ! -d $(DESTDIR)$(lispdir) ] ; then \
37 $(MKDIR) $(DESTDIR)$(lispdir) ; \
38 fi ;
39 $(CP) $(LISPC) $(LISPF) $(LISPO) $(DESTDIR)$(lispdir)
41 clean:
42 $(RM) *.elc
44 cleanauto:
45 $(RM) $(LISPO) $(LISPO:%el=%elc)
47 cleanall:
48 $(RM) *.elc $(LISPO)
50 clean-install:
51 if [ -d $(DESTDIR)$(lispdir) ] ; then \
52 $(RM) $(DESTDIR)$(lispdir)/org*.el* $(DESTDIR)$(lispdir)/ob*.el* ; \
53 fi ;