瀏覽代碼

shuffle targets to their correct place, harden recipes

* Makefile: declare phony targets, remove help text for install-info-debian
* default.mk: add variable for FIND and RM
* targets.mk, maint-targets.mk: shuffle targets to where they belong, declare
  phony targets, work around a texi2dvi bug, use pattern rules, use targets for
  dependencies instead of repeating them verbatim
Achim Gratz 13 年之前
父節點
當前提交
77f0e50787
共有 4 個文件被更改,包括 71 次插入66 次删除
  1. 1 2
      Makefile
  2. 6 0
      default.mk
  3. 10 38
      maint-targets.mk
  4. 54 26
      targets.mk

+ 1 - 2
Makefile

@@ -3,10 +3,9 @@
 # Maintainer: Carsten Dominik <dominik@science.uva.nl>
 # Version: VERSIONTAG
 #
-# To install org-mode, edit the Makefile, type `make', then `make install'.
-# To create the PDF and HTML documentation files, type `make doc'.
 
 # Describe valid make targets for org-mode.
+.PHONY:	targets help
 targets help:
 	@echo "make - compile Org ELisp files"
 	@echo "make clean - clean Elisp and documentation files"

+ 6 - 0
default.mk

@@ -39,6 +39,12 @@ MAKEINFO = makeinfo
 # How to create the HTML file
 TEXI2HTML = makeinfo --html --number-sections
 
+# How to find files
+FIND    = find
+
+# How to remove files
+RM      = rm
+
 # 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

+ 10 - 38
maint-targets.mk

@@ -1,6 +1,15 @@
+.PHONY:	p g html_manual html_guide \
+	testrelease release fixrelease \
+	relup makerelease sync_release sync_manual \
+	distfile pkg push pushtag pushreleasetag
+.NOTPARALLEL: .PHONY
 # Below here are special targets for maintenance only
 
-html: doc/org.html
+p:	pdf
+	open doc/org.pdf
+
+g:	pdf
+	open doc/orgguide.pdf
 
 html_manual: doc/org.texi
 	rm -rf doc/manual
@@ -14,12 +23,6 @@ html_guide: doc/orgguide.texi
 	$(TEXI2HTML) -o doc/guide doc/orgguide.texi
 	UTILITIES/guidesplit.pl doc/guide/*.html
 
-info:	doc/org
-
-pdf:	doc/org.pdf doc/orgguide.pdf
-
-card:	doc/orgcard.pdf doc/orgcard_letter.pdf doc/orgcard.txt
-
 testrelease:
 	git checkout -b testrelease origin/maint
 	git merge -s recursive -X theirs master
@@ -146,37 +149,6 @@ pkg:
 	echo "(define-package \"org\" \"$(PKG_TAG)\" \"$(PKG_DOC)\" $(PKG_REQ))" > org-$(PKG_TAG)/org-pkg.el
 	tar cf org-$(PKG_TAG).tar org-$(PKG_TAG) --remove-files
 
-cleanall:
-	${MAKE} clean
-	rm -f lisp/org-install.el
-
-clean:
-	${MAKE} cleanelc
-	${MAKE} cleandoc
-	${MAKE} cleanrel
-	rm -f *~ */*~ */*/*~
-
-cleancontrib:
-	find contrib -name \*~ -exec rm {} \;
-
-cleanelc:
-	rm -f $(ELCFILES)
-cleandoc:
-	-(cd doc && rm -f org.pdf org org.html orgcard.pdf orgguide.pdf)
-	-(cd doc && rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.pg *.pgs)
-	-(cd doc && rm -f *.toc *.tp *.tps *.vr *.vrs *.log *.html *.ps)
-	-(cd doc && rm -f orgcard_letter.tex orgcard_letter.pdf)
-	-(cd doc && rm -rf manual)
-
-cleanrel:
-	rm -rf RELEASEDIR
-	rm -rf org-7.*
-	rm -rf org-7*zip org-7*tar.gz
-
-.el.elc:
-	$(ELC) $<
-
-
 push:
 	git push orgmode@orgmode.org:org-mode.git master
 

+ 54 - 26
targets.mk

@@ -1,9 +1,13 @@
+.PHONY:	default all up2 update compile \
+	install info html pdf card doc install-lisp install-info \
+	autoloads cleanall clean cleancontrib cleanelc cleandoc cleanrel
+.NOTPARALLEL: .PHONY
 # Additional distribution files
 DISTFILES_extra=  Makefile request-assign-future.txt contrib etc
 
-default: $(ELCFILES) $(ELCBFILES)
+default: $(ELCFILES)
 
-all:	$(ELCFILES) $(ELCBFILES) $(INFOFILES)
+all:	default $(INFOFILES)
 
 up2:	update
 	sudo ${MAKE} install
@@ -13,19 +17,21 @@ update:
 	${MAKE} clean
 	${MAKE} all
 
-compile: $(ELCFILES0) $(ELCBFILES)
+compile: $(ELCFILES0)
 
 install: install-lisp
 
-doc: doc/org.html doc/org.pdf doc/orgcard.pdf doc/orgcard_letter.pdf doc/orgguide.pdf doc/orgcard.txt
+info:	doc/org
 
-p:
-	${MAKE} pdf && open doc/org.pdf
+html:	doc/org.html
 
-g:
-	${MAKE} pdf && open doc/orgguide.pdf
+pdf:	doc/org.pdf doc/orgguide.pdf
 
-install-lisp: $(LISPFILES) $(ELCFILES)
+card:	doc/orgcard.pdf doc/orgcard_letter.pdf doc/orgcard.txt
+
+doc:	html pdf card
+
+install-lisp: $(LISPFILES) default
 	if [ ! -d $(lispdir) ]; then $(MKDIR) $(lispdir); else true; fi ;
 	$(CP) $(LISPFILES)  $(lispdir)
 	$(CP) $(ELCFILES)   $(lispdir)
@@ -37,31 +43,30 @@ install-info: $(INFOFILES)
 
 autoloads: lisp/org-install.el
 
-lisp/org-install.el: $(LISPFILES0) Makefile
-	$(BATCH) --eval "(require 'autoload)" \
-		--eval '(find-file "org-install.el")'  \
-		--eval '(erase-buffer)' \
-		--eval '(mapc (lambda (x) (generate-file-autoloads (symbol-name x))) (quote ($(LISPFILES0))))' \
-		--eval '(insert "\n(provide (quote org-install))\n")' \
-		--eval '(save-buffer)'
+lisp/org-install.el: $(LISPFILES0) maint.mk dependencies.mk
+	$(BATCH) \
+	 --eval "(require 'autoload)" \
+	 --eval '(find-file "org-install.el")' \
+	 --eval '(erase-buffer)' \
+	 --eval '(mapc (lambda (x) (generate-file-autoloads (symbol-name x))) (quote ($(LISPFILES0))))' \
+	 --eval '(insert "\n(provide (quote org-install))\n")' \
+	 --eval '(save-buffer)'
 	mv org-install.el lisp
 
 doc/org: doc/org.texi
 	(cd doc && $(MAKEINFO) --no-split org.texi -o org)
 
-doc/org.pdf: doc/org.texi
-	(cd doc && $(TEXI2PDF) org.texi)
-
-doc/orgguide.pdf: doc/orgguide.texi
-	(cd doc && $(TEXI2PDF) orgguide.texi)
+doc/%.pdf: LC_ALL=C	# work around a bug in texi2dvi
+doc/%.pdf: LANG=C	# work around a bug in texi2dvi
+doc/%.pdf: doc/%.texi
+	(cd doc && $(TEXI2PDF) $(<F))
+doc/%.pdf: doc/%.tex
+	(cd doc && $(TEXI2PDF) $(<F))
 
 doc/org.html: doc/org.texi
 	(cd doc && $(TEXI2HTML) --no-split -o org.html org.texi)
 	UTILITIES/manfull.pl doc/org.html
 
-doc/orgcard.pdf: doc/orgcard.tex
-	(cd doc && pdftex orgcard.tex)
-
 doc/orgcard.txt: doc/orgcard.tex
 	(cd doc && perl ../UTILITIES/orgcard2txt.pl orgcard.tex > orgcard.txt)
 
@@ -69,6 +74,29 @@ doc/orgcard_letter.tex: doc/orgcard.tex
 	perl -pe 's/\\pdflayout=\(0l\)/\\pdflayout=(1l)/' \
                    doc/orgcard.tex > doc/orgcard_letter.tex
 
-doc/orgcard_letter.pdf: doc/orgcard_letter.tex
-	(cd doc && pdftex orgcard_letter.tex)
+cleanall: clean
+	$(RM) lisp/org-install.el
+
+clean:	cleanelc cleandoc cleanrel cleancontrib
+	-$(FIND) . -name \*~ -exec $(RM) {} \;
+
+cleancontrib:
+	-$(FIND) contrib -name \*~ -exec $(RM) {} \;
+
+cleanelc:
+	rm -f $(ELCFILES)
+
+cleandoc:
+	-(cd doc && rm -f org.pdf org org.html orgcard.pdf orgguide.pdf)
+	-(cd doc && rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.pg *.pgs)
+	-(cd doc && rm -f *.toc *.tp *.tps *.vr *.vrs *.log *.html *.ps)
+	-(cd doc && rm -f orgcard_letter.tex orgcard_letter.pdf)
+	-(cd doc && rm -rf manual)
+
+cleanrel:
+	rm -rf RELEASEDIR
+	rm -rf org-7.*
+	rm -rf org-7*zip org-7*tar.gz
 
+.el.elc:
+	$(ELC) $<