Parcourir la source

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.
Achim Gratz il y a 13 ans
Parent
commit
501f9b1741
4 fichiers modifiés avec 22 ajouts et 9 suppressions
  1. 3 0
      default.mk
  2. 6 2
      doc/Makefile
  3. 11 6
      lisp/Makefile
  4. 2 1
      targets.mk

+ 3 - 0
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

+ 6 - 2
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
 

+ 11 - 6
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
 

+ 2 - 1
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