From: Junio C Hamano Date: Tue, 2 Mar 2010 20:44:08 +0000 (-0800) Subject: Merge branch 'jn/makedepend' X-Git-Tag: v1.7.1-rc0~118 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a026d5318cdcbc05690749ac9cd5c2a50d09cb14?ds=inline;hp=-c Merge branch 'jn/makedepend' * jn/makedepend: Makefile: clarify definition of TEST_OBJS Makefile: always remove .depend directories on 'make clean' Makefile: tuck away generated makefile fragments in .depend Teach Makefile to check header dependencies Makefile: list standalone program object files in PROGRAM_OBJS Makefile: lazily compute header dependencies Makefile: list generated object files in OBJECTS Makefile: disable default implicit rules Makefile: rearrange dependency rules Makefile: transport.o depends on branch.h now Makefile: drop dependency on $(wildcard */*.h) Makefile: clean up http-walker.o dependency rules Makefile: remove wt-status.h from LIB_H Makefile: make sure test helpers are rebuilt when headers change Makefile: add missing header file dependencies Conflicts: Makefile --- a026d5318cdcbc05690749ac9cd5c2a50d09cb14 diff --combined Makefile index afedb54b48,9dd995df75..52f2cc040b --- a/Makefile +++ b/Makefile @@@ -180,6 -180,9 +180,6 @@@ all: # If not set it defaults to the bare 'wish'. If it is set to the empty # string then NO_TCLTK will be forced (this is used by configure script). # -# Define THREADED_DELTA_SEARCH if you have pthreads and wish to exploit -# parallel delta searching when packing objects. -# # Define INTERNAL_QSORT to use Git's implementation of qsort(), which # is a simplified version of the merge sort used in glibc. This is # recommended if Git triggers O(n^2) behavior in your platform's qsort(). @@@ -214,6 -217,13 +214,13 @@@ # DEFAULT_EDITOR='~/bin/vi', # DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR', # DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork' + # + # Define COMPUTE_HEADER_DEPENDENCIES if your compiler supports the -MMD option + # and you want to avoid rebuilding objects when an unrelated header file + # changes. + # + # Define CHECK_HEADER_DEPENDENCIES to check for problems in the hard-coded + # dependency rules. GIT-VERSION-FILE: FORCE @$(SHELL_PATH) ./GIT-VERSION-GEN @@@ -275,6 -285,29 +282,6 @@@ pathsep = # JavaScript minifier invocation that can function as filter JSMIN = -# default configuration for gitweb -GITWEB_CONFIG = gitweb_config.perl -GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf -GITWEB_HOME_LINK_STR = projects -GITWEB_SITENAME = -GITWEB_PROJECTROOT = /pub/git -GITWEB_PROJECT_MAXDEPTH = 2007 -GITWEB_EXPORT_OK = -GITWEB_STRICT_EXPORT = -GITWEB_BASE_URL = -GITWEB_LIST = -GITWEB_HOMETEXT = indextext.html -GITWEB_CSS = gitweb.css -GITWEB_LOGO = git-logo.png -GITWEB_FAVICON = git-favicon.png -ifdef JSMIN -GITWEB_JS = gitweb.min.js -else -GITWEB_JS = gitweb.js -endif -GITWEB_SITE_HEADER = -GITWEB_SITE_FOOTER = - export prefix bindir sharedir sysconfdir CC = gcc @@@ -311,12 -344,12 +318,13 @@@ COMPAT_CFLAGS COMPAT_OBJS = LIB_H = LIB_OBJS = + PROGRAM_OBJS = PROGRAMS = SCRIPT_PERL = SCRIPT_PYTHON = SCRIPT_SH = +SCRIPT_LIB = - TEST_PROGRAMS = + TEST_PROGRAMS_NEED_X = SCRIPT_SH += git-am.sh SCRIPT_SH += git-bisect.sh @@@ -327,21 -360,20 +335,21 @@@ SCRIPT_SH += git-merge-octopus.s SCRIPT_SH += git-merge-one-file.sh SCRIPT_SH += git-merge-resolve.sh SCRIPT_SH += git-mergetool.sh -SCRIPT_SH += git-mergetool--lib.sh SCRIPT_SH += git-notes.sh -SCRIPT_SH += git-parse-remote.sh SCRIPT_SH += git-pull.sh SCRIPT_SH += git-quiltimport.sh SCRIPT_SH += git-rebase--interactive.sh SCRIPT_SH += git-rebase.sh SCRIPT_SH += git-repack.sh SCRIPT_SH += git-request-pull.sh -SCRIPT_SH += git-sh-setup.sh SCRIPT_SH += git-stash.sh SCRIPT_SH += git-submodule.sh SCRIPT_SH += git-web--browse.sh +SCRIPT_LIB += git-mergetool--lib +SCRIPT_LIB += git-parse-remote +SCRIPT_LIB += git-sh-setup + SCRIPT_PERL += git-add--interactive.perl SCRIPT_PERL += git-difftool.perl SCRIPT_PERL += git-archimport.perl @@@ -362,12 -394,31 +370,31 @@@ EXTRA_PROGRAMS # ... and all the rest that could be moved out of bindir to gitexecdir PROGRAMS += $(EXTRA_PROGRAMS) - PROGRAMS += git-fast-import$X - PROGRAMS += git-imap-send$X - PROGRAMS += git-shell$X - PROGRAMS += git-show-index$X - PROGRAMS += git-upload-pack$X - PROGRAMS += git-http-backend$X + + PROGRAM_OBJS += fast-import.o + PROGRAM_OBJS += imap-send.o + PROGRAM_OBJS += shell.o + PROGRAM_OBJS += show-index.o + PROGRAM_OBJS += upload-pack.o + PROGRAM_OBJS += http-backend.o + + PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS)) + + TEST_PROGRAMS_NEED_X += test-chmtime + TEST_PROGRAMS_NEED_X += test-ctype + TEST_PROGRAMS_NEED_X += test-date + TEST_PROGRAMS_NEED_X += test-delta + TEST_PROGRAMS_NEED_X += test-dump-cache-tree + TEST_PROGRAMS_NEED_X += test-genrandom + TEST_PROGRAMS_NEED_X += test-match-trees + TEST_PROGRAMS_NEED_X += test-parse-options + TEST_PROGRAMS_NEED_X += test-path-utils + TEST_PROGRAMS_NEED_X += test-run-command + TEST_PROGRAMS_NEED_X += test-sha1 + TEST_PROGRAMS_NEED_X += test-sigchain + TEST_PROGRAMS_NEED_X += test-index-version + -TEST_PROGRAMS := $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X)) ++TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X)) # List built-in command $C whose implementation cmd_$C() is not in # builtin-$C.o but is linked in as part of some other command. @@@ -427,6 -478,7 +454,7 @@@ LIB_H += blob. LIB_H += builtin.h LIB_H += cache.h LIB_H += cache-tree.h + LIB_H += color.h LIB_H += commit.h LIB_H += compat/bswap.h LIB_H += compat/cygwin.h @@@ -438,6 -490,7 +466,7 @@@ LIB_H += delta. LIB_H += diffcore.h LIB_H += diff.h LIB_H += dir.h + LIB_H += exec_cmd.h LIB_H += fsck.h LIB_H += git-compat-util.h LIB_H += graph.h @@@ -480,7 -533,8 +509,8 @@@ LIB_H += tree-walk. LIB_H += unpack-trees.h LIB_H += userdiff.h LIB_H += utf8.h - LIB_H += wt-status.h + LIB_H += xdiff-interface.h + LIB_H += xdiff/xdiff.h LIB_OBJS += abspath.o LIB_OBJS += advice.o @@@ -698,10 -752,12 +728,10 @@@ EXTLIBS ifeq ($(uname_S),Linux) NO_STRLCPY = YesPlease NO_MKSTEMPS = YesPlease - THREADED_DELTA_SEARCH = YesPlease endif ifeq ($(uname_S),GNU/kFreeBSD) NO_STRLCPY = YesPlease NO_MKSTEMPS = YesPlease - THREADED_DELTA_SEARCH = YesPlease endif ifeq ($(uname_S),UnixWare) CC = cc @@@ -755,6 -811,7 +785,6 @@@ ifeq ($(uname_S),Darwin NO_STRLCPY = YesPlease endif NO_MEMMEM = YesPlease - THREADED_DELTA_SEARCH = YesPlease USE_ST_TIMESPEC = YesPlease endif ifeq ($(uname_S),SunOS) @@@ -767,6 -824,7 +797,6 @@@ NO_MKDTEMP = YesPlease NO_MKSTEMPS = YesPlease NO_REGEX = YesPlease - THREADED_DELTA_SEARCH = YesPlease ifeq ($(uname_R),5.7) NEEDS_RESOLV = YesPlease NO_IPV6 = YesPlease @@@ -822,6 -880,7 +852,6 @@@ ifeq ($(uname_S),FreeBSD BASIC_LDFLAGS += -L/usr/local/lib DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease USE_ST_TIMESPEC = YesPlease - THREADED_DELTA_SEARCH = YesPlease ifeq ($(shell expr "$(uname_R)" : '4\.'),2) PTHREAD_LIBS = -pthread NO_UINTMAX_T = YesPlease @@@ -835,6 -894,7 +865,6 @@@ ifeq ($(uname_S),OpenBSD NEEDS_LIBICONV = YesPlease BASIC_CFLAGS += -I/usr/local/include BASIC_LDFLAGS += -L/usr/local/lib - THREADED_DELTA_SEARCH = YesPlease endif ifeq ($(uname_S),NetBSD) ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2) @@@ -842,6 -902,7 +872,6 @@@ endif BASIC_CFLAGS += -I/usr/pkg/include BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib - THREADED_DELTA_SEARCH = YesPlease USE_ST_TIMESPEC = YesPlease NO_MKSTEMPS = YesPlease endif @@@ -856,7 -917,9 +886,7 @@@ ifeq ($(uname_S),AIX INTERNAL_QSORT = UnfortunatelyYes NEEDS_LIBICONV=YesPlease BASIC_CFLAGS += -D_LARGE_FILES - ifneq ($(shell expr "$(uname_V)" : '[1234]'),1) - THREADED_DELTA_SEARCH = YesPlease - else + ifeq ($(shell expr "$(uname_V)" : '[1234]'),1) NO_PTHREADS = YesPlease endif endif @@@ -882,6 -945,7 +912,6 @@@ ifeq ($(uname_S),IRIX SNPRINTF_RETURNS_BOGUS = YesPlease SHELL_PATH = /usr/gnu/bin/bash NEEDS_LIBGEN = YesPlease - THREADED_DELTA_SEARCH = YesPlease endif ifeq ($(uname_S),IRIX64) NO_SETENV=YesPlease @@@ -900,6 -964,7 +930,6 @@@ SNPRINTF_RETURNS_BOGUS = YesPlease SHELL_PATH=/usr/gnu/bin/bash NEEDS_LIBGEN = YesPlease - THREADED_DELTA_SEARCH = YesPlease endif ifeq ($(uname_S),HP-UX) NO_IPV6=YesPlease @@@ -949,6 -1014,7 +979,6 @@@ ifeq ($(uname_S),Windows NO_CURL = YesPlease NO_PYTHON = YesPlease BLK_SHA1 = YesPlease - THREADED_DELTA_SEARCH = YesPlease CC = compat/vcbuild/scripts/clink.pl AR = compat/vcbuild/scripts/lib.pl @@@ -1000,6 -1066,7 +1030,6 @@@ ifneq (,$(findstring MINGW,$(uname_S)) NO_REGEX = YesPlease NO_PYTHON = YesPlease BLK_SHA1 = YesPlease - THREADED_DELTA_SEARCH = YesPlease COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch -Icompat/win32 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o \ @@@ -1022,6 -1089,14 +1052,14 @@@ endi -include config.mak.autogen -include config.mak + ifdef CHECK_HEADER_DEPENDENCIES + USE_COMPUTED_HEADER_DEPENDENCIES = + endif + + ifdef COMPUTE_HEADER_DEPENDENCIES + USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease + endif + ifdef SANE_TOOL_PATH SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH)) BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|' @@@ -1077,11 -1152,12 +1115,12 @@@ els REMOTE_CURL_PRIMARY = git-remote-http$X REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES) - PROGRAMS += $(REMOTE_CURL_NAMES) git-http-fetch$X + PROGRAM_OBJS += http-fetch.o + PROGRAMS += $(REMOTE_CURL_NAMES) curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p) ifeq "$(curl_check)" "070908" ifndef NO_EXPAT - PROGRAMS += git-http-push$X + PROGRAM_OBJS += http-push.o endif endif ifndef NO_EXPAT @@@ -1101,7 -1177,7 +1140,7 @@@ endi EXTLIBS += -lz ifndef NO_POSIX_ONLY_PROGRAMS - PROGRAMS += git-daemon$X + PROGRAM_OBJS += daemon.o endif ifndef NO_OPENSSL OPENSSL_LIBSSL = -lssl @@@ -1268,10 -1344,12 +1307,12 @@@ endi ifdef BLK_SHA1 SHA1_HEADER = "block-sha1/sha1.h" LIB_OBJS += block-sha1/sha1.o + LIB_H += block-sha1/sha1.h else ifdef PPC_SHA1 SHA1_HEADER = "ppc/sha1.h" LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o + LIB_H += ppc/sha1.h else SHA1_HEADER = EXTLIBS += $(LIB_4_CRYPTO) @@@ -1297,12 -1375,16 +1338,12 @@@ ifdef RUNTIME_PREFI endif ifdef NO_PTHREADS - THREADED_DELTA_SEARCH = BASIC_CFLAGS += -DNO_PTHREADS else EXTLIBS += $(PTHREAD_LIBS) -endif - -ifdef THREADED_DELTA_SEARCH - BASIC_CFLAGS += -DTHREADED_DELTA_SEARCH LIB_OBJS += thread-utils.o endif + ifdef DIR_HAS_BSD_GROUP_SEMANTICS COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS endif @@@ -1413,7 -1495,7 +1454,7 @@@ export TAR INSTALL DESTDIR SHELL_PAT SHELL = $(SHELL_PATH) -all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS +all:: shell_compatibility_test $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS ifneq (,$X) $(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';) endif @@@ -1464,25 -1546,17 +1505,25 @@@ common-cmds.h: ./generate-cmdlist.sh co common-cmds.h: $(wildcard Documentation/git-*.txt) $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@ +define cmd_munge_script +$(RM) $@ $@+ && \ +sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ + -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ + -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ + -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ + -e $(BROKEN_PATH_FIX) \ + $@.sh >$@+ +endef + $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh - $(QUIET_GEN)$(RM) $@ $@+ && \ - sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ - -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ - -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ - -e $(BROKEN_PATH_FIX) \ - $@.sh >$@+ && \ + $(QUIET_GEN)$(cmd_munge_script) && \ chmod +x $@+ && \ mv $@+ $@ +$(SCRIPT_LIB) : % : %.sh + $(QUIET_GEN)$(cmd_munge_script) && \ + mv $@+ $@ + ifndef NO_PERL $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak @@@ -1505,11 -1579,6 +1546,11 @@@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % chmod +x $@+ && \ mv $@+ $@ + +.PHONY: gitweb +gitweb: + $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all + ifdef JSMIN OTHER_PROGRAMS += gitweb/gitweb.cgi gitweb/gitweb.min.js gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js @@@ -1517,13 -1586,30 +1558,13 @@@ els OTHER_PROGRAMS += gitweb/gitweb.cgi gitweb/gitweb.cgi: gitweb/gitweb.perl endif - $(QUIET_GEN)$(RM) $@ $@+ && \ - sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \ - -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ - -e 's|++GIT_BINDIR++|$(bindir)|g' \ - -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \ - -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \ - -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \ - -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \ - -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \ - -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \ - -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \ - -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \ - -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \ - -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \ - -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \ - -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \ - -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \ - -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \ - -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \ - -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \ - -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \ - $< >$@+ && \ - chmod +x $@+ && \ - mv $@+ $@ + $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) + +ifdef JSMIN +gitweb/gitweb.min.js: gitweb/gitweb.js + $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) +endif # JSMIN + git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js $(QUIET_GEN)$(RM) $@ $@+ && \ @@@ -1550,6 -1636,12 +1591,6 @@@ $(patsubst %.perl,%,$(SCRIPT_PERL)) git mv $@+ $@ endif # NO_PERL - -ifdef JSMIN -gitweb/gitweb.min.js: gitweb/gitweb.js - $(QUIET_GEN)$(JSMIN) <$< >$@ -endif # JSMIN - ifndef NO_PYTHON $(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py @@@ -1592,12 -1684,132 +1633,133 @@@ git.o git.spec $(patsubst %.perl,%,$(SCRIPT_PERL)) \ : GIT-VERSION-FILE - %.o: %.c GIT-CFLAGS - $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $< + TEST_OBJS := $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS)) + GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \ + git.o http.o http-walker.o remote-curl.o + XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \ + xdiff/xmerge.o xdiff/xpatience.o + OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS) + + dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d) + dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS)))) + + ifdef COMPUTE_HEADER_DEPENDENCIES + $(dep_dirs): + mkdir -p $@ + + missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs)) + dep_file = $(dir $@).depend/$(notdir $@).d + dep_args = -MF $(dep_file) -MMD -MP + ifdef CHECK_HEADER_DEPENDENCIES + $(error cannot compute header dependencies outside a normal build. \ + Please unset CHECK_HEADER_DEPENDENCIES and try again) + endif + endif + + ifndef COMPUTE_HEADER_DEPENDENCIES + ifndef CHECK_HEADER_DEPENDENCIES + dep_dirs = + missing_dep_dirs = + dep_args = + endif + endif + + ifdef CHECK_HEADER_DEPENDENCIES + ifndef PRINT_HEADER_DEPENDENCIES + missing_deps = $(filter-out $(notdir $^), \ + $(notdir $(shell $(MAKE) -s $@ \ + CHECK_HEADER_DEPENDENCIES=YesPlease \ + USE_COMPUTED_HEADER_DEPENDENCIES=YesPlease \ + PRINT_HEADER_DEPENDENCIES=YesPlease))) + endif + endif + + ASM_SRC := $(wildcard $(OBJECTS:o=S)) + ASM_OBJ := $(ASM_SRC:S=o) + C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS)) + + .SUFFIXES: + + ifdef PRINT_HEADER_DEPENDENCIES + $(C_OBJ): %.o: %.c FORCE + echo $^ + $(ASM_OBJ): %.o: %.S FORCE + echo $^ + + ifndef CHECK_HEADER_DEPENDENCIES + $(error cannot print header dependencies during a normal build. \ + Please set CHECK_HEADER_DEPENDENCIES and try again) + endif + endif + + ifndef PRINT_HEADER_DEPENDENCIES + ifdef CHECK_HEADER_DEPENDENCIES + $(C_OBJ): %.o: %.c $(dep_files) FORCE + @set -e; echo CHECK $@; \ + missing_deps="$(missing_deps)"; \ + if test "$$missing_deps"; \ + then \ + echo missing dependencies: $$missing_deps; \ + false; \ + fi + $(ASM_OBJ): %.o: %.S $(dep_files) FORCE + @set -e; echo CHECK $@; \ + missing_deps="$(missing_deps)"; \ + if test "$$missing_deps"; \ + then \ + echo missing dependencies: $$missing_deps; \ + false; \ + fi + endif + endif + + ifndef CHECK_HEADER_DEPENDENCIES + $(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) + $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $< + $(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs) + $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $< + endif + %.s: %.c GIT-CFLAGS FORCE $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $< - %.o: %.S GIT-CFLAGS - $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $< + + ifdef USE_COMPUTED_HEADER_DEPENDENCIES + # Take advantage of gcc's on-the-fly dependency generation + # See . + dep_files_present := $(wildcard $(dep_files)) + ifneq ($(dep_files_present),) + include $(dep_files_present) + endif + else + # Dependencies on header files, for platforms that do not support + # the gcc -MMD option. + # + # Dependencies on automatically generated headers such as common-cmds.h + # should _not_ be included here, since they are necessary even when + # building an object for the first time. + # + # XXX. Please check occasionally that these include all dependencies + # gcc detects! + + $(GIT_OBJS): $(LIB_H) + builtin-branch.o builtin-checkout.o builtin-clone.o builtin-reset.o branch.o transport.o: branch.h + builtin-bundle.o bundle.o transport.o: bundle.h + builtin-bisect--helper.o builtin-rev-list.o bisect.o: bisect.h + builtin-clone.o builtin-fetch-pack.o transport.o: fetch-pack.h ++builtin-grep.o: thread-utils.h + builtin-send-pack.o transport.o: send-pack.h + builtin-log.o builtin-shortlog.o: shortlog.h + builtin-prune.o builtin-reflog.o reachable.o: reachable.h + builtin-commit.o builtin-revert.o wt-status.o: wt-status.h + builtin-tar-tree.o archive-tar.o: tar.h + builtin-pack-objects.o: thread-utils.h + http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h + http.o http-walker.o http-push.o remote-curl.o: http.h + + xdiff-interface.o $(XDIFF_OBJS): \ + xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \ + xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h + endif exec_cmd.s exec_cmd.o: ALL_CFLAGS += \ '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \ @@@ -1612,7 -1824,6 +1774,6 @@@ config.s config.o: ALL_CFLAGS += -DETC_ http.s http.o: ALL_CFLAGS += -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' ifdef NO_EXPAT - http-walker.o: http.h http-walker.s http-walker.o: ALL_CFLAGS += -DNO_EXPAT endif @@@ -1623,10 -1834,6 +1784,6 @@@ git-imap-send$X: imap-send.o $(GITLIBS $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL) - http.o http-walker.o http-push.o: http.h - - http.o http-walker.o: $(LIB_H) - git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ $(LIBS) $(CURL_LIBCURL) @@@ -1644,18 -1851,9 +1801,9 @@@ $(REMOTE_CURL_PRIMARY): remote-curl.o h $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) - $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) - $(patsubst git-%$X,%.o,$(PROGRAMS)) git.o: $(LIB_H) $(wildcard */*.h) - builtin-revert.o wt-status.o: wt-status.h - $(LIB_FILE): $(LIB_OBJS) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) - XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \ - xdiff/xmerge.o xdiff/xpatience.o - $(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \ - xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h - $(XDIFF_LIB): $(XDIFF_OBJS) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS) @@@ -1721,24 -1919,6 +1869,6 @@@ GIT-GUI-VARS: FORC fi endif - ### Testing rules - - TEST_PROGRAMS_NEED_X += test-chmtime - TEST_PROGRAMS_NEED_X += test-ctype - TEST_PROGRAMS_NEED_X += test-date - TEST_PROGRAMS_NEED_X += test-delta - TEST_PROGRAMS_NEED_X += test-dump-cache-tree - TEST_PROGRAMS_NEED_X += test-genrandom - TEST_PROGRAMS_NEED_X += test-match-trees - TEST_PROGRAMS_NEED_X += test-parse-options - TEST_PROGRAMS_NEED_X += test-path-utils - TEST_PROGRAMS_NEED_X += test-run-command - TEST_PROGRAMS_NEED_X += test-sha1 - TEST_PROGRAMS_NEED_X += test-sigchain - TEST_PROGRAMS_NEED_X += test-index-version - - TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X)) - test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X)) all:: $(TEST_PROGRAMS) $(test_bindir_programs) @@@ -1756,6 -1936,8 +1886,8 @@@ bin-wrappers/%: wrap-for-bin.s export NO_SVN_TESTS + ### Testing rules + test: all $(MAKE) -C t/ all @@@ -1767,9 -1949,7 +1899,7 @@@ test-delta$X: diff-delta.o patch-delta. test-parse-options$X: parse-options.o - test-parse-options.o: parse-options.h - - .PRECIOUS: $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS)) + .PRECIOUS: $(TEST_OBJS) test-%$X: test-%.o $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) @@@ -1815,7 -1995,6 +1945,7 @@@ install: al $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' + $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)' $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install ifndef NO_PERL @@@ -1935,9 -2114,10 +2065,10 @@@ distclean: clea clean: $(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o \ $(LIB_FILE) $(XDIFF_LIB) - $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X + $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X $(RM) $(TEST_PROGRAMS) $(RM) -r bin-wrappers + $(RM) -r $(dep_dirs) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope* $(RM) -r autom4te.cache $(RM) config.log config.mak.autogen config.mak.append config.status config.cache @@@ -1967,7 -2147,7 +2098,7 @@@ endi ### Check documentation # check-docs:: - @(for v in $(ALL_PROGRAMS) $(BUILT_INS) git gitk; \ + @(for v in $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git gitk; \ do \ case "$$v" in \ git-merge-octopus | git-merge-ours | git-merge-recursive | \ @@@ -2010,12 -2190,9 +2141,12 @@@ documented,gitrepository-layout | \ documented,gittutorial | \ documented,gittutorial-2 | \ + documented,git-bisect-lk2009 | \ + documented.git-remote-helpers | \ + documented,gitworkflows | \ sentinel,not,matching,is,ok ) continue ;; \ esac; \ - case " $(ALL_PROGRAMS) $(BUILT_INS) git gitk " in \ + case " $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git gitk " in \ *" $$cmd "*) ;; \ *) echo "removed but $$how: $$cmd" ;; \ esac; \