From: Junio C Hamano Date: Wed, 20 Mar 2019 06:16:04 +0000 (+0900) Subject: Merge branch 'ab/makefile-help-devs-more' X-Git-Tag: v2.22.0-rc0~144 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3cef67694cfd4f90e12174576fec79252d1e8b96?ds=inline;hp=-c Merge branch 'ab/makefile-help-devs-more' CFLAGS now can be tweaked when invoking Make while using DEVELOPER=YesPlease; this did not work well before. * ab/makefile-help-devs-more: Makefile: allow for combining DEVELOPER=1 and CFLAGS="..." Makefile: move the setting of *FLAGS closer to "include" Makefile: Move *_LIBS assignment into its own section Makefile: add/remove comments at top and tweak whitespace Makefile: move "strip" assignment down from flags Makefile: remove an out-of-date comment --- 3cef67694cfd4f90e12174576fec79252d1e8b96 diff --combined Makefile index 537493822b,710a3475a9..3e03290d8f --- a/Makefile +++ b/Makefile @@@ -479,7 -479,11 +479,11 @@@ all: # # Define DEVELOPER to enable more compiler warnings. Compiler version # and family are auto detected, but could be overridden by defining - # COMPILER_FEATURES (see config.mak.dev) + # COMPILER_FEATURES (see config.mak.dev). You can still set + # CFLAGS="..." in combination with DEVELOPER enables, whether that's + # for tweaking something unrelated (e.g. optimization level), or for + # selectively overriding something DEVELOPER or one of the DEVOPTS + # (see just below) brings in. # # When DEVELOPER is set, DEVOPTS can be used to control compiler # options. This variable contains keywords separated by @@@ -506,17 -510,8 +510,8 @@@ GIT-VERSION-FILE: FORC @$(SHELL_PATH) ./GIT-VERSION-GEN -include GIT-VERSION-FILE - # CFLAGS and LDFLAGS are for the users to override from the command line. - - CFLAGS = -g -O2 -Wall - LDFLAGS = - ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS) - ALL_LDFLAGS = $(LDFLAGS) - STRIP ?= strip - - # Create as necessary, replace existing, make ranlib unneeded. - ARFLAGS = rcs - + # Set our default configuration. + # # Among the variables below, these: # gitexecdir # template_dir @@@ -561,6 -556,7 +556,7 @@@ perllibdir_relative = $(patsubst $(pref export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir + # Set our default programs CC = cc AR = ar RM = rm -f @@@ -573,29 -569,14 +569,14 @@@ TCLTK_PATH = wis XGETTEXT = xgettext MSGFMT = msgfmt CURL_CONFIG = curl-config - PTHREAD_LIBS = -lpthread - PTHREAD_CFLAGS = GCOV = gcov + STRIP = strip SPATCH = spatch export TCL_PATH TCLTK_PATH - # user customisation variable for 'sparse' target - SPARSE_FLAGS ?= - # internal/platform customisation variable for 'sparse' - SP_EXTRA_FLAGS = - - SPATCH_FLAGS = --all-includes --patch . - - - - ### --- END CONFIGURATION SECTION --- - - # Those must not be GNU-specific; they are shared with perl/ which may - # be built by a different compiler. (Note that this is an artifact now - # but it still might be nice to keep that distinction.) - BASIC_CFLAGS = -I. - BASIC_LDFLAGS = + # Set our default LIBS variables + PTHREAD_LIBS = -lpthread # Guard against environment variables BUILTIN_OBJS = @@@ -773,7 -754,6 +754,7 @@@ TEST_BUILTINS_OBJS += test-string-list. TEST_BUILTINS_OBJS += test-submodule-config.o TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o TEST_BUILTINS_OBJS += test-subprocess.o +TEST_BUILTINS_OBJS += test-trace2.o TEST_BUILTINS_OBJS += test-urlmatch-normalization.o TEST_BUILTINS_OBJS += test-xml-encode.o TEST_BUILTINS_OBJS += test-wildmatch.o @@@ -842,8 -822,7 +823,8 @@@ VCSSVN_LIB = vcs-svn/lib. GENERATED_H += command-list.h -LIB_H = $(shell $(FIND) . \ +LIB_H := $(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \ + $(FIND) . \ -name .git -prune -o \ -name t -prune -o \ -name Documentation -prune -o \ @@@ -1019,16 -998,6 +1000,16 @@@ LIB_OBJS += tempfile. LIB_OBJS += thread-utils.o LIB_OBJS += tmp-objdir.o LIB_OBJS += trace.o +LIB_OBJS += trace2.o +LIB_OBJS += trace2/tr2_cfg.o +LIB_OBJS += trace2/tr2_cmd_name.o +LIB_OBJS += trace2/tr2_dst.o +LIB_OBJS += trace2/tr2_sid.o +LIB_OBJS += trace2/tr2_tbuf.o +LIB_OBJS += trace2/tr2_tgt_event.o +LIB_OBJS += trace2/tr2_tgt_normal.o +LIB_OBJS += trace2/tr2_tgt_perf.o +LIB_OBJS += trace2/tr2_tls.o LIB_OBJS += trailer.o LIB_OBJS += transport.o LIB_OBJS += transport-helper.o @@@ -1177,6 -1146,25 +1158,25 @@@ ifeq ($(wildcard sha1collisiondetection DC_SHA1_SUBMODULE = auto endif + # Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be + # tweaked by config.* below as well as the command-line, both of + # which'll override these defaults. + CFLAGS = -g -O2 -Wall + LDFLAGS = + BASIC_CFLAGS = -I. + BASIC_LDFLAGS = + + # library flags + ARFLAGS = rcs + PTHREAD_CFLAGS = + + # For the 'sparse' target + SPARSE_FLAGS ?= + SP_EXTRA_FLAGS = + + # For the 'coccicheck' target + SPATCH_FLAGS = --all-includes --patch . + include config.mak.uname -include config.mak.autogen -include config.mak @@@ -1185,6 -1173,9 +1185,9 @@@ ifdef DEVELOPE include config.mak.dev endif + ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) + ALL_LDFLAGS = $(LDFLAGS) + comma := , empty := space := $(empty) $(empty) @@@ -1608,9 -1599,7 +1611,9 @@@ ifdef NO_INET_PTO LIB_OBJS += compat/inet_pton.o BASIC_CFLAGS += -DNO_INET_PTON endif -ifndef NO_UNIX_SOCKETS +ifdef NO_UNIX_SOCKETS + BASIC_CFLAGS += -DNO_UNIX_SOCKETS +else LIB_OBJS += unix-socket.o PROGRAM_OBJS += credential-cache.o PROGRAM_OBJS += credential-cache--daemon.o @@@ -2377,7 -2366,7 +2380,7 @@@ els # should _not_ be included here, since they are necessary even when # building an object for the first time. -$(OBJECTS): $(LIB_H) +$(OBJECTS): $(LIB_H) $(GENERATED_H) endif exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX @@@ -2750,10 -2739,7 +2753,10 @@@ $(SP_OBJ): %.sp: %.c GIT-CFLAGS FORC sparse: $(SP_OBJ) GEN_HDRS := command-list.h unicode-width.h -EXCEPT_HDRS := $(GEN_HDRS) compat% xdiff% +EXCEPT_HDRS := $(GEN_HDRS) compat/% xdiff/% +ifndef GCRYPT_SHA256 + EXCEPT_HDRS += sha256/gcrypt.h +endif CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(patsubst ./%,%,$(LIB_H))) HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))