use sed instead of perl, add target clean-install
[org-mode.git] / lisp / Makefile
blob0845113f18f8051a39da2fbe3592a850a47c1170
1 ifeq ($(MAKELEVEL), 0)
2 $(error This make needs to be started as a sub-make from the toplevel directory.)
3 endif
5 GITVERSION = $(shell git describe --abbrev=6 HEAD)
6 GITSTATUS = $(shell git status -uno --porcelain)
7 ifneq ("$(GITSTATUS)", "")
8 GITVERSION := $(GITVERSION).dirty
9 endif
11 LISPO = org-install.el
12 LISPF = $(subst $(LISPO),,$(wildcard *.el))
13 LISPC = $(LISPF:%el=%elc)
15 include dependencies.mk
17 .PHONY: all autoloads compile install clean cleanall clean-install
19 all compile: $(LISPC)
21 autoloads: $(LISPO)
23 org-install.el: $(LISPC)
24 $(BATCH) \
25 --eval "(require 'autoload)" \
26 --eval '(find-file "$(LISPO)")' \
27 --eval '(erase-buffer)' \
28 --eval '(mapc (lambda (x) (generate-file-autoloads (symbol-name x))) (quote ($(LISPF))))' \
29 --eval '(insert "\n(provide (quote org-install))\n")' \
30 --eval '(save-buffer)'
32 install: $(LISPF) compile autoloads
33 if [ ! -d $(lispdir) ]; then $(MKDIR) $(lispdir); else true; fi ;
34 $(CP) $(LISPC) $(LISPF) $(LISPO) $(lispdir)
35 -$(SED) -e 's/^\((defconst org-git-version \).*/\1 "$(GITVERSION)"/;' org.el > $(lispdir)/org.el
36 $(MAKE) $(lispdir)/org.elc
38 clean:
39 $(RM) *.elc
41 cleanall:
42 $(RM) *.elc $(LISPO)
44 clean-install:
45 if [ ! -d $(lispdir) ]; then $(MKDIR) $(lispdir); else true; fi ;
46 $(RM) $(lispdir)/org*.el* $(lispdir)/ob*.el*
48 $(LISPC): dependencies.mk
50 .SUFFIXES: # we don't need default suffix rules
51 .SUFFIXES: .el .elc
53 .el.elc:
54 $(info in subdir lisp)
55 $(ELC) $<