From 501f9b17419ffaafa0ab2d167247a393ab855d7f Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Mon, 18 Jul 2011 17:55:23 +0200 Subject: [PATCH] use sed instead of perl, add target clean-install * Makefile, lisp/Makefile, doc/Makefile: add target clean-install to remove files in install-directories * default.mk: add customization variable $(SED) * doc/Makefile: do not remove dir while cleaning * lisp/Makefile: use sed instead of perl to weave git-status into org.el and ignore any errors while doing it. Keep git status in $(GITSTATUS) to make it more clear what happens in the check. --- default.mk | 3 +++ doc/Makefile | 8 ++++++-- lisp/Makefile | 17 +++++++++++------ targets.mk | 3 ++- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/default.mk b/default.mk index cb92181ba..cb61ff38c 100644 --- a/default.mk +++ b/default.mk @@ -51,6 +51,9 @@ RM = rm -f # How to remove files recursively RMR = rm -fr +# How to stream edit a file +SED = sed + # How to copy the lisp files and elc files to their destination. # CP = cp -p # try this if there is no install CP = install -p diff --git a/doc/Makefile b/doc/Makefile index 251ee568c..8ce532828 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -2,7 +2,7 @@ ifeq ($(MAKELEVEL), 0) $(error This make needs to be started as a sub-make from the toplevel directory.) endif -.PHONY: all info html pdf card manual guide install clean cleanall +.PHONY: all info html pdf card manual guide install clean cleanall clean-install all: info html pdf card @@ -30,10 +30,14 @@ install: org $(INSTALL_INFO) --infodir=$(infodir) org clean cleanall: - $(RM) dir org *.pdf *.html *_letter.tex \ + $(RM) org *.pdf *.html *_letter.tex \ *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.pg *.pgs \ *.toc *.tp *.tps *.vr *.vrs *.log *.html *.ps +clean-install: + $(RM) $(infodir)/org* + @echo You should run $(INSTALL_INFO) again to correct dir entries. + .SUFFIXES: # we don't need default suffix rules .SUFFIXES: .texi .tex .txt diff --git a/lisp/Makefile b/lisp/Makefile index 963d08c8a..0845113f1 100644 --- a/lisp/Makefile +++ b/lisp/Makefile @@ -2,8 +2,9 @@ ifeq ($(MAKELEVEL), 0) $(error This make needs to be started as a sub-make from the toplevel directory.) endif -GITVERSION = $(shell git describe --abbrev=6 HEAD) -ifneq ($(shell git status -uno --porcelain), '') +GITVERSION = $(shell git describe --abbrev=6 HEAD) +GITSTATUS = $(shell git status -uno --porcelain) +ifneq ("$(GITSTATUS)", "") GITVERSION := $(GITVERSION).dirty endif @@ -13,7 +14,7 @@ LISPC = $(LISPF:%el=%elc) include dependencies.mk -.PHONY: autoloads compile install clean cleanall +.PHONY: all autoloads compile install clean cleanall clean-install all compile: $(LISPC) @@ -31,14 +32,18 @@ org-install.el: $(LISPC) install: $(LISPF) compile autoloads if [ ! -d $(lispdir) ]; then $(MKDIR) $(lispdir); else true; fi ; $(CP) $(LISPC) $(LISPF) $(LISPO) $(lispdir) - perl -i -pe 's/^(\(defconst org-git-version ).*/\1 "$(GITVERSION)"/;' $(lispdir)/org.el + -$(SED) -e 's/^\((defconst org-git-version \).*/\1 "$(GITVERSION)"/;' org.el > $(lispdir)/org.el $(MAKE) $(lispdir)/org.elc clean: - $(RM) $(LISPC) + $(RM) *.elc cleanall: - $(RM) $(LISPC) $(LISPO) + $(RM) *.elc $(LISPO) + +clean-install: + if [ ! -d $(lispdir) ]; then $(MKDIR) $(lispdir); else true; fi ; + $(RM) $(lispdir)/org*.el* $(lispdir)/ob*.el* $(LISPC): dependencies.mk diff --git a/targets.mk b/targets.mk index df54cf35f..219e61cc5 100644 --- a/targets.mk +++ b/targets.mk @@ -12,7 +12,8 @@ SUBDIRS = doc $(LISPDIRS) #contrib compile: lisp $(MAKE) -C $< $@ -all: $(SUBDIRS) +all \ +clean-install: $(SUBDIRS) $(foreach dir, $?, $(MAKE) -C $(dir) $@;) up2: update -- 2.11.4.GIT