[PATCH/RFC] "Recursive Make considered harmful"

From: Ryan Anderson <ryan@michonline.com>
Date: 2005-07-27 18:39:10
Convert build process from recurse Make to a single Make

The old Makefiles in Documentation/ and tools/ still exist until we feel
confident that I didn't miss anything on this conversion.

Most of this patch is fixing up the main Makefile to avoid overlapping
target names.

Signed-off-by: Ryan Anderson <ryan@michonline.com>
---

 Documentation/Makefile.inc |   50 ++++++++++++++++++++++++++++++++++++++++++++
 Makefile                   |   24 ++++++++++++++-------
 tools/Makefile.inc         |   12 +++++++++++
 3 files changed, 78 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/Makefile.inc
 create mode 100644 tools/Makefile.inc

003afd3ed1f83b4533b628182fa16c9ab0dc0467
diff --git a/Documentation/Makefile.inc b/Documentation/Makefile.inc
new file mode 100644
--- /dev/null
+++ b/Documentation/Makefile.inc
@@ -0,0 +1,50 @@
+MAN1_TXT=$(wildcard Documentation/git-*.txt)
+MAN7_TXT=Documentation/git.txt
+
+DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT))
+
+DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
+DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
+
+mandir=$(prefix)/man
+man1=$(mandir)/man1
+man7=$(mandir)/man7
+
+#
+# Please note that there is a minor bug in asciidoc.
+# The version after 6.0.3 _will_ include the patch found here:
+#   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
+#
+# Until that version is released you may have to apply the patch
+# yourself - yes, all 6 characters of it!
+#
+
+all-doc: html man
+
+html: $(DOC_HTML)
+
+
+man: man1 man7
+man1: $(DOC_MAN1)
+man7: $(DOC_MAN7)
+
+install-doc:
+	$(INSTALL) -m755 -d $(dest)/$(man1) $(dest)/$(man7)
+	$(INSTALL) $(DOC_MAN1) $(dest)/$(man1)
+	$(INSTALL) $(DOC_MAN7) $(dest)/$(man7)
+
+# 'include' dependencies
+Documentation/git-diff-%.txt: Documentation/diff-format.txt Documentation/diff-options.txt
+	touch $@
+
+clean-doc:
+	rm -f Documentation/*.xml Documentation/*.html Documentation/*.1 Documentation/*.7
+
+%.html : %.txt
+	asciidoc -b xhtml11 -d manpage $<
+
+%.1 %.7 : %.xml
+	xmlto -o Documentation/ man $<
+
+%.xml : %.txt
+	asciidoc -b docbook -d manpage $<
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -54,9 +54,17 @@ PROG=   git-update-cache git-diff-files 
 	git-show-index git-daemon git-var git-peek-remote \
 	git-update-server-info git-show-rev-cache git-build-rev-cache
 
-all: $(PROG)
+include Documentation/Makefile.inc
+include tools/Makefile.inc
 
-install: $(PROG) $(SCRIPTS)
+all: all-bin all-doc
+all-bin: $(PROG)
+#all-tools
+
+install: install-bin install-doc
+#install-tools
+
+install-bin: $(PROG) $(SCRIPTS)
 	$(INSTALL) -m755 -d $(dest)$(bin)
 	$(INSTALL) $(PROG) $(SCRIPTS) $(dest)$(bin)
 
@@ -204,20 +212,20 @@ rpm: dist
 test: all
 	$(MAKE) -C t/ all
 
-doc:
-	$(MAKE) -C Documentation all
+doc: all-doc
+#	$(MAKE) -C Documentation all
 
-install-tools:
+install-toolsxx:
 	$(MAKE) -C tools install
 
-install-doc:
+install-docxx:
 	$(MAKE) -C Documentation install
 
-clean:
+clean: clean-doc clean-tools
 	rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE)
 	rm -f git-core-*.tar.gz git-core.spec
 	$(MAKE) -C tools/ clean
-	$(MAKE) -C Documentation/ clean
 
 backup: clean
 	cd .. ; tar czvf dircache.tar.gz dir-cache
+
diff --git a/tools/Makefile.inc b/tools/Makefile.inc
new file mode 100644
--- /dev/null
+++ b/tools/Makefile.inc
@@ -0,0 +1,12 @@
+#
+# Make Linus git-tools
+#
+
+PROG += $(addprefix tools/,git-mailsplit git-mailinfo)
+SCRIPTS += $(addprefix tools/,git-applymbox git-applypatch)
+
+tools/git-%: tools/%.c
+	$(CC) $(CFLAGS) -o $@ $(filter %.c,$^)
+
+clean-tools:
+	rm -f tools/*.o

-- 

Ryan Anderson
  sometimes Pug Majere
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Jul 27 18:48:12 2005

This archive was generated by hypermail 2.1.8 : 2005-07-27 18:48:44 EST