Browse Source

Introduce compatibility and convenience targets, local.mk template, add "helpall"

* Makefile: new target "helpall" to document all targets, while "help"
  continues to show a brief subset.

* default.mk: add cutlines for sed to produce local.mk with.

* targets.mk: add target "local.mk" to produce an (empty) local.mk
  configuration template when it isn't already present.  Ignore any
  error when making this target since sed might not be present on all
  systems.  Redefine target "update" to not include testing, similarly
  add target "update2" to additionally install without test.  Add
  targets "up0" to stop after git pull and "up1" to stop after test,
  while "up2" continues to do everything and then installs.  Complete
  .PHONY target list.  Add "refcard" target for compatibility with old
  make.  Clean contrib in "cleanall", too.
Achim Gratz 7 years ago
parent
commit
687766c922
3 changed files with 93 additions and 34 deletions
  1. 67 21
      Makefile
  2. 2 2
      default.mk
  3. 24 11
      targets.mk

+ 67 - 21
Makefile

@@ -11,31 +11,77 @@ all::
 
 # Describe valid make targets for org-mode.
 .PHONY:	targets help
-targets help:
+targets help helpall::
 	$(info )
-	$(info make help          - show this help)
-	$(info make               - cleanly compile Org ELisp files and documentation)
-	$(info )
-	$(info Installation)
+	$(info Getting Help)
 	$(info ============)
-	$(info make install       - install Org, both ELisp and Info files)
-	$(info make install-lisp  - install Org, only ELisp files)
-	$(info make install-info  - install Org, only Info file)
 	$(info )
-	$(info Maintenance)
+	$(info make help          - show brief help)
+	$(info make targets       - dito)
+	$(info make helpall       - show extended help)
+	$(info )
+	$(info Build and Check)
+	$(info ===============)
+	$(info make               - build Org ELisp and all documentation)
+	$(info make all           - dito)
+	$(info make compile       - build Org ELisp files)
+	$(info make autoloads     - create org-install.el to load org in-place)
+	$(info make check         - build Org ELisp files and run test suite)
+helpall::
+	$(info make test          - dito)
+	$(info make compile-dirty - build only stale Org ELisp files)
+	$(info make test-dirty    - check without building first)
+	$(info )
+	$(info Compatibility)
+	$(info =============)
+	$(info make oldorg        - what the old make did: compile autoloads info)
+	$(info )
+	$(info Convenience)
 	$(info ===========)
-	$(info make doc           - 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 check         - build org and run complete test suite)
-	$(info make clean         - clean Org ELisp and documentation files)
-	$(info make compile       - cleanly compile Org ELisp files)
-	$(info make compile-dirty - compile Org ELisp without cleaning)
-	$(info )
-	$(info make clean-install - remove installed Org ELisp and documentation files)
+	$(info make up0           - pull from upstream)
+	$(info make up1           - pull from upstream, build and check)
+	$(info make up2           - pull from upstream, build, check and install)
+	$(info make update        - pull from upstream and build)
+	$(info make update2       - pull from upstream, build and install)
+	$(info make local.mk      - create new local.mk as template for adaptation)
+	$(info )
+	$(info Cleaning)
+	$(info ========)
+	$(info make clean         - remove built Org ELisp files and documentation)
+	$(info make cleanall      - remove everything that can be built and all remnants)
+	$(info make cleandirs     - clean in etc/, lisp/ and doc/)
+	$(info make cleancontrib  - remove remnants in contrib/)
+	$(info make cleandoc      - remove built documentation)
+	$(info make cleandocs     - dito)
+	$(info make cleanlisp     - remove built Org ELisp files)
+	$(info make cleanelc      - dito)
+	$(info make cleanrel      - remove release remnants)
+	$(info make cleantest     - remove check remnants)
+	$(info make clean-install - remove previous Org installation)
+	$(info )
+	$(info Documentation)
+	$(info =============)
+targets help helpall::
+	$(info make doc           - build all documentation)
+helpall::
+	$(info make docs          - dito)
+targets help helpall::
+	$(info make info          - build Info documentation)
+helpall::
+	$(info make html          - build HTML documentation)
+	$(info make pdf           - build PDF documentation)
+	$(info make card          - build reference cards)
+	$(info make refcard       - dito)
+targets help helpall::
+	$(info )
+	$(info Installation)
+	$(info ============)
+	$(info make install       - build and install Org)
+helpall::
+	$(info make install-etc   - build and install files in /etc)
+	$(info make install-lisp  - build and install Org Elisp files)
+	$(info make install-info  - build and install Info documentation)
+targets help helpall::
 	@echo ""
 
  include targets.mk	# toplevel make machinery

+ 2 - 2
default.mk

@@ -2,7 +2,7 @@
 ##  NEVER EDIT THIS FILE, PUT ANY ADAPTATIONS INTO local.mk
 ##----------------------------------------------------------------------
 ##  CHECK AND ADAPT THE FOLLOWING DEFINITIONS
-##----------------------------------------------------------------------
+##-8<-------------------------------------------------------------------
 
 # Override default target if desired or define your own default target
 # oldorg:	# have plain "make" do the same things the old Makefile did
@@ -38,7 +38,7 @@ BTEST_OB_LANGUAGES = awk C fortran maxima lilypond octave python sh # R
               # R is not activated by default because it requires ess to be installed and configured
 BTEST_EXTRA = # extra packages to require for testing
 
-##----------------------------------------------------------------------
+##->8-------------------------------------------------------------------
 ## YOU MAY NEED TO ADAPT THESE DEFINITIONS
 ##----------------------------------------------------------------------
 

+ 24 - 11
targets.mk

@@ -21,13 +21,26 @@ ifneq ($(GITSTATUS),)
   GITVERSION := $(GITVERSION).dirty
 endif
 
-.PHONY:	default all oldorg up2 update compile lisp doc etc \
+.PHONY:	all oldorg update update2 up0 up1 up2 compile $(SUBDIRS) \
 	check test install info html pdf card doc docs $(INSTSUB) \
 	autoloads cleanall clean cleancontrib cleanrel clean-install \
-	cleanelc cleandirs cleanlisp cleandoc cleandocs cleantest
-
-# backwards compatibility target
-oldorg:	compile autoloads info
+	cleanelc cleandirs cleanlisp cleandoc cleandocs cleantest \
+	compile compile-dirty
+
+oldorg:	compile autoloads info # what the old makefile did when no target was specified
+refcard:	card
+update update2::	up0 all
+
+.PRECIOUS:	local.mk
+local.mk:
+	$(info ==========================================)
+	$(info Created a local.mk template.)
+	$(info Please adapt local.mk to your local setup!)
+	$(info ==========================================)
+	-@$(SED) -n \
+		-e '/-8<-/,/->8-/ {s/^\(\s*[^#]\)/#\1/;p}' \
+		-e '$$ i ## See default.mk for further configuration options.' \
+		default.mk > $@
 
 all \
 compile::	lisp
@@ -51,13 +64,13 @@ ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around f
 	$(MAKE) cleantest
 endif
 
-up2:	update
-	$(SUDO) $(MAKE) install
-
-update:
+up0 up1 up2::
 	git remote update
 	git pull
-	$(MAKE) check
+up1 up2::	all
+	$(MAKE) test-dirty
+up2 update2::
+	$(SUDO) $(MAKE) install
 
 install:	$(INSTSUB)
 
@@ -81,7 +94,7 @@ clean:	cleanrel
 	$(MAKE) -C lisp clean
 	$(MAKE) -C doc clean
 
-cleanall: cleandirs cleantest
+cleanall: cleandirs cleantest cleancontrib
 	-$(FIND) . -name \*~ -exec $(RM) {} \;
 
 cleancontrib: