From b567341443789c174e1dc56739c31d6582008e05 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Mon, 30 Apr 2012 06:49:23 +0200 Subject: [PATCH] clean up Makefile some more, keep autoloads around * lisp/Makefile: remove stop targets, make autoloads depend on source files again (not .PHONY). Keep autoload files around after compile, but make sure to re-create them before installation and compile. Remove autoload files before re-creating them to avoid errors from Emacs when saving the buffer. * targets.mk: remove stop targets and the mess that was necessary to support them. * default.mk: must use $(CURDIR) not $(PWD), $(PWD) is not well defined when using sudo. --- default.mk | 2 +- lisp/Makefile | 26 +++++++++++--------------- targets.mk | 18 ++++++++---------- 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/default.mk b/default.mk index 7bfd22465..a618be7de 100644 --- a/default.mk +++ b/default.mk @@ -110,7 +110,7 @@ MAKE_ORG_INSTALL = $(BATCH) \ --eval '(add-to-list '"'"'load-path ".")' \ --eval '(load "org-compat.el")' \ --eval '(load "../UTILITIES/org-fixup.el")' \ - --eval '(org-make-org-install "$(PWD)/lisp/org-install.el")' + --eval '(org-make-org-install "$(CURDIR)/lisp/org-install.el")' # How to generate org-version.el MAKE_ORG_VERSION = $(BATCH) \ diff --git a/lisp/Makefile b/lisp/Makefile index 617d53e43..be6be5ff3 100644 --- a/lisp/Makefile +++ b/lisp/Makefile @@ -10,36 +10,32 @@ LISPA = $(LISPV) $(LISPI) LISPF = $(filter-out $(LISPA),$(wildcard *.el)) LISPC = $(LISPF:%el=%elc) -NOSTOP = all compile compile-dirty -DOSTOP = compile-stop compile-stop-dirty - -.PHONY: $(NOSTOP) $(DOSTOP) \ - autoloads $(LISPA) \ - install clean cleanauto cleanall clean-install \ +.PHONY: all compile compile-dirty \ + autoloads \ + install clean cleanauto cleanall clean-install # do not clean here, done in toplevel make -$(NOSTOP) $(DOSTOP):: $(LISPV) +all compile:: autoloads +all compile compile-dirty:: $(LISPA) $(ELCDIR) -$(NOSTOP):: - $(MAKE) cleanauto -autoloads: $(LISPA) +autoloads: cleanauto $(LISPA) -$(LISPV): +$(LISPV): $(LISPF) @echo "org-version: $(ORGVERSION) ($(GITVERSION))" + @$(RM) $(@) @$(MAKE_ORG_VERSION) -$(LISPI): $(LISPV) +$(LISPI): $(LISPV) $(LISPF) @echo "org-install: $(ORGVERSION) ($(GITVERSION))" - $(MAKE_ORG_INSTALL) + @$(RM) $(@) + @$(MAKE_ORG_INSTALL) install: $(LISPF) compile if [ ! -d $(DESTDIR)$(lispdir) ] ; then \ $(MKDIR) $(DESTDIR)$(lispdir) ; \ fi ; - $(MAKE) autoloads $(CP) $(LISPC) $(LISPF) $(LISPA) $(DESTDIR)$(lispdir) - $(MAKE) cleanauto cleanauto clean cleanall:: $(RM) $(LISPA) $(LISPA:%el=%elc) diff --git a/targets.mk b/targets.mk index ca9863abf..e775fa763 100644 --- a/targets.mk +++ b/targets.mk @@ -23,12 +23,12 @@ ifneq ($(GITSTATUS),) endif .PHONY: all oldorg update update2 up0 up1 up2 compile $(SUBDIRS) \ - check test install info html pdf card doc docs $(INSTSUB) \ - autoloads cleanall clean cleancontrib cleanutils cleanrel clean-install \ - cleanelc cleandirs cleanlisp cleandoc cleandocs cleantest \ - compile compile-stop compile-dirty compile-stop-dirty uncompiled + check test install info html pdf card doc docs $(INSTSUB) \ + autoloads cleanall clean cleancontrib cleanutils cleanrel clean-install \ + cleanelc cleandirs cleanlisp cleandoc cleandocs cleantest + compile compile-dirty uncompiled -oldorg: compile-stop info # what the old makefile did when no target was specified +oldorg: compile info # what the old makefile did when no target was specified uncompiled: cleanlisp autoloads # for developing refcard: card update update2:: up0 all @@ -48,9 +48,9 @@ local.mk: -e '$$ i ## See default.mk for further configuration options.' \ default.mk > $@ -all compile-stop compile:: lisp +all compile:: lisp $(MAKE) -C $< clean -compile compile-stop compile-dirty compile-stop-dirty:: lisp +all compile compile-dirty:: lisp $(MAKE) -C $< $@ all clean-install:: @@ -59,9 +59,7 @@ all clean-install:: check test:: all check test test-dirty:: -$(MKDIR) $(testdir) - $(MAKE) autoloads TMPDIR=$(testdir) $(BTEST) - $(MAKE) -C lisp cleanauto ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection $(MAKE) cleantest endif @@ -72,7 +70,7 @@ up0 up1 up2:: up1 up2:: all $(MAKE) test-dirty up2 update2:: - $(SUDO) $(MAKE) install-dirty + $(SUDO) $(MAKE) install install: $(INSTSUB)