Browse Source

hand off ./doc to sub-make

* Makefile: use info function for output and call shell only once
* default.mk: add PDFTEX and RMR variables for customization
* lisp/Makefile: add target 'all' and create $(lispdir) if necessary
* maint-targets.mk: invoke sub-make for HTML manuals
* maint.mk: remove unsused VARIABLES
* targets.mk: invoke sub-make for ./doc and clean up some targets
Achim Gratz 9 years ago
parent
commit
a5cb04dcd8
7 changed files with 113 additions and 85 deletions
  1. 15 12
      Makefile
  2. 6 0
      default.mk
  3. 59 0
      doc/Makefile
  4. 8 3
      lisp/Makefile
  5. 2 11
      maint-targets.mk
  6. 0 6
      maint.mk
  7. 23 53
      targets.mk

+ 15 - 12
Makefile

@@ -7,19 +7,22 @@
 # 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"
-	@echo "make all - compile Org ELisp files and documentation"
+	$(info )
+	$(info make              - show this help)
+	$(info )
+	$(info make clean        - clean Elisp and documentation files)
+	$(info make all          - compile Org ELisp files and documentation)
+	$(info )
+	$(info make docs         - make all documentation)
+	$(info make info         - make Info documentation)
+	$(info make html         - make HTML documentation)
+	$(info make pdf          - make pdf documentation)
+	$(info make card         - make refcards documentation)
+	$(info )
+	$(info make install      - install Org, both ELisp and Info files)
+	$(info make install-lisp - install Org ELisp files)
+	$(info make install-info - install Org Info file)
 	@echo ""
-	@echo "make doc - make all documentation"
-	@echo "make info - make Info documentation"
-	@echo "make html - make HTML documentation"
-	@echo "make pdf - make pdf documentation"
-	@echo "make card - make refcards documentation"
-	@echo ""
-	@echo "make install - install Org"
-	@echo "make install-lisp - install Org ELisp files"
-	@echo "make install-info - install Org Info file"
 
  include default.mk
 -include local.mk

+ 6 - 0
default.mk

@@ -30,6 +30,9 @@ ELC     = $(BATCH) -f batch-byte-compile
 # How to make a pdf file from a texinfo file
 TEXI2PDF = texi2pdf
 
+# How to make a pdf file from a tex file
+PDFTEX = pdftex
+
 # How to create directories
 MKDIR   = mkdir -p
 
@@ -45,6 +48,9 @@ FIND    = find
 # How to remove files
 RM      = rm -f
 
+# How to remove files recursively
+RMR     = rm -fr
+
 # 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

+ 59 - 0
doc/Makefile

@@ -0,0 +1,59 @@
+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
+
+all:		info html pdf card
+
+info:		org
+
+html:		org.html
+
+pdf:		org.pdf orgguide.pdf
+
+card:		orgcard.pdf orgcard_letter.pdf orgguide.pdf
+
+manual guide::
+	$(RMR) $@ ; $(MKDIR) $@
+manual::	org.texi
+	$(TEXI2HTML) -o $@ $<
+	../UTILITIES/mansplit.pl $@/*
+guide::		orgguide.texi
+	$(TEXI2HTML) -o $@ $<
+	../UTILITIES/guidesplit.pl $@/*
+
+
+install:	org
+	if [ ! -d $(infodir) ]; then $(MKDIR) $(infodir); else true; fi ;
+	$(CP) org $(infodir)
+	$(INSTALL_INFO) --infodir=$(infodir) org
+
+clean cleanall:
+	$(RM) dir org *.pdf *.html *_letter.tex \
+	      *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.pg *.pgs \
+	      *.toc *.tp *.tps *.vr *.vrs *.log *.html *.ps
+
+.SUFFIXES:	# we don't need default suffix rules
+.SUFFIXES:	.texi .tex .txt
+
+%:		%.texi
+	$(MAKEINFO) --no-split $< -o $@
+
+%.pdf:		LC_ALL=C	# work around a bug in texi2dvi
+%.pdf:		LANG=C		# work around a bug in texi2dvi
+%.pdf:		%.texi
+	$(TEXI2PDF) $<
+%.pdf:		%.tex
+	PDFLATEX=$(PDFTEX) $(TEXI2PDF) $<
+
+%.html:		%.texi
+	$(TEXI2HTML) --no-split -o $@ $<
+	../UTILITIES/manfull.pl $@
+
+%.txt:		%.tex
+	perl ../UTILITIES/orgcard2txt.pl $< > $@
+
+%_letter.tex:	%.tex
+	perl -pe 's/\\pdflayout=\(0l\)/\\pdflayout=(1l)/' \
+                   $< > $@

+ 8 - 3
lisp/Makefile

@@ -1,3 +1,7 @@
+ifeq ($(MAKELEVEL), 0)
+  $(error This make needs to be started as a sub-make from the toplevel directory.)
+endif
+
 LISPO = org-install.el
 LISPF = $(subst $(LISPO),,$(wildcard *.el))
 LISPC = $(LISPF:%el=%elc)
@@ -6,9 +10,7 @@ include dependencies.mk
 
 .PHONY:		autoloads compile install clean cleanall
 
-$(LISPC):	dependencies.mk
-
-compile:	$(LISPC)
+all compile:	$(LISPC)
 
 autoloads:	$(LISPO)
 
@@ -22,6 +24,7 @@ org-install.el:	$(LISPC)
 	 --eval '(save-buffer)'
 
 install:	$(LISPF) compile autoloads
+	if [ ! -d $(lispdir) ]; then $(MKDIR) $(lispdir); else true; fi ;
 	$(CP) $(LISPC) $(LISPF) $(LISPO) $(lispdir)
 
 clean:
@@ -30,6 +33,8 @@ clean:
 cleanall:
 	$(RM) $(LISPC) $(LISPO)
 
+$(LISPC):	dependencies.mk
+
 .SUFFIXES:	# we don't need default suffix rules
 .SUFFIXES:	.el .elc
 

+ 2 - 11
maint-targets.mk

@@ -11,17 +11,8 @@ p:	pdf
 g:	pdf
 	open doc/orgguide.pdf
 
-html_manual: doc/org.texi
-	rm -rf doc/manual
-	mkdir doc/manual
-	$(TEXI2HTML) -o doc/manual doc/org.texi
-	UTILITIES/mansplit.pl doc/manual/*.html
-
-html_guide: doc/orgguide.texi
-	rm -rf doc/guide
-	mkdir doc/guide
-	$(TEXI2HTML) -o doc/guide doc/orgguide.texi
-	UTILITIES/guidesplit.pl doc/guide/*.html
+html_manual html_guide:
+	$(MAKE) -C doc $(@:html_%=%)
 
 testrelease:
 	git checkout -b testrelease origin/maint

+ 0 - 6
maint.mk

@@ -3,12 +3,6 @@
 ##----------------------------------------------------------------------
 
 # The following variables need to be defined by the maintainer
-DOCFILES    = doc/org.texi doc/org.pdf doc/org doc/dir \
-              doc/pdflayout.sty doc/.nosearch \
-              doc/orgguide.texi doc/orgguide.pdf
-CARDFILES   = doc/orgcard.tex doc/orgcard.pdf doc/orgcard_letter.pdf
-TEXIFILES   = doc/org.texi
-INFOFILES   = doc/org
 
 # Package Manager (ELPA)
 PKG_TAG = $(shell date +%Y%m%d)

+ 23 - 53
targets.mk

@@ -1,4 +1,4 @@
-.PHONY:	default all up2 update compile lisp\
+.PHONY:	default all up2 update compile lisp doc \
 	install info html pdf card doc install-lisp install-info \
 	autoloads cleanall clean cleancontrib cleanelc cleandoc cleanrel
 .NOTPARALLEL: .PHONY
@@ -6,10 +6,14 @@
 DISTFILES_extra=  Makefile request-assign-future.txt contrib etc
 .EXPORT_ALL_VARIABLES:
 
-lisp compile:
-	$(MAKE) -C lisp compile
+LISPDIRS	= lisp #contrib
+SUBDIRS		= doc $(LISPDIRS) #contrib
 
-all:	lisp $(INFOFILES)
+compile:	lisp
+	$(MAKE) -C $< $@
+
+all:	$(SUBDIRS)
+	$(foreach dir, $?, $(MAKE) -C $(dir) $@;)
 
 up2:	update
 	sudo ${MAKE} install
@@ -19,69 +23,35 @@ update:
 	${MAKE} clean
 	${MAKE} all
 
-install: install-lisp
-
-info:	doc/org
-
-html:	doc/org.html
+install: install-lisp install-info
 
-pdf:	doc/org.pdf doc/orgguide.pdf
+docs:	info html pdf card
 
-card:	doc/orgcard.pdf doc/orgcard_letter.pdf doc/orgcard.txt
-
-doc:	html pdf card
+info html pdf card:
+	$(MAKE) -C doc $@
 
 install-lisp:
-	if [ ! -d $(lispdir) ]; then $(MKDIR) $(lispdir); else true; fi ;
 	$(MAKE) -C lisp install
 
-install-info: $(INFOFILES)
-	if [ ! -d $(infodir) ]; then $(MKDIR) $(infodir); else true; fi ;
-	$(CP) $(INFOFILES) $(infodir)
-	$(INSTALL_INFO) --infodir=$(infodir) $(INFOFILES)
+install-info:
+	$(MAKE) -C doc install
 
 autoloads: lisp maint.mk
-	$(MAKE) -C lisp autoloads
-
-doc/org: doc/org.texi
-	(cd doc && $(MAKEINFO) --no-split org.texi -o org)
-
-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))
+	$(MAKE) -C $< $@
 
-doc/org.html: doc/org.texi
-	(cd doc && $(TEXI2HTML) --no-split -o org.html org.texi)
-	UTILITIES/manfull.pl doc/org.html
-
-doc/orgcard.txt: doc/orgcard.tex
-	(cd doc && perl ../UTILITIES/orgcard2txt.pl orgcard.tex > orgcard.txt)
-
-doc/orgcard_letter.tex: doc/orgcard.tex
-	perl -pe 's/\\pdflayout=\(0l\)/\\pdflayout=(1l)/' \
-                   doc/orgcard.tex > doc/orgcard_letter.tex
-
-cleanall: clean
-	$(MAKE) -C lisp cleanall
+cleanall: $(SUBDIRS)
+	$(foreach dir, $?, $(MAKE) -C $(dir) $@;)
+	-$(FIND) . -name \*~ -exec $(RM) {} \;
 
-clean:	cleandoc cleanrel cleancontrib
+clean:	cleanrel
 	$(MAKE) -C lisp clean
+	$(MAKE) -C doc clean
 	-$(FIND) . -name \*~ -exec $(RM) {} \;
 
 cleancontrib:
 	-$(FIND) contrib -name \*~ -exec $(RM) {} \;
 
-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
+	$(RMR) RELEASEDIR
+	$(RMR) org-7.*
+	$(RMR) org-7*zip org-7*tar.gz