Skip to content

Commit f2301be

Browse files
pks-tgitster
authored andcommitted
Makefile: reorder sources after includes
In an upcoming change we'll make some of the sources compile conditionally based on whether or not `WITH_RUST` is defined. To let developers specify that flag in their "config.mak" we'll thus have to reorder our sources so that they come after the include of that file. Do so. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c184795 commit f2301be

File tree

1 file changed

+88
-88
lines changed

1 file changed

+88
-88
lines changed

Makefile

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,94 @@ LIB_FILE = libgit.a
919919
XDIFF_LIB = xdiff/lib.a
920920
REFTABLE_LIB = reftable/libreftable.a
921921

922+
# xdiff and reftable libs may in turn depend on what is in libgit.a
923+
GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
924+
EXTLIBS =
925+
926+
GIT_USER_AGENT = git/$(GIT_VERSION)
927+
928+
ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/sha1.h)
929+
DC_SHA1_SUBMODULE = auto
930+
endif
931+
932+
# Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
933+
# tweaked by config.* below as well as the command-line, both of
934+
# which'll override these defaults.
935+
# Older versions of GCC may require adding "-std=gnu99" at the end.
936+
CFLAGS = -g -O2 -Wall
937+
LDFLAGS =
938+
CC_LD_DYNPATH = -Wl,-rpath,
939+
BASIC_CFLAGS = -I.
940+
BASIC_LDFLAGS =
941+
942+
# library flags
943+
ARFLAGS = rcs
944+
PTHREAD_CFLAGS =
945+
946+
# For the 'sparse' target
947+
SPARSE_FLAGS ?= -std=gnu99 -D__STDC_NO_VLA__
948+
SP_EXTRA_FLAGS =
949+
950+
# For informing GIT-BUILD-OPTIONS of the SANITIZE=leak,address targets
951+
SANITIZE_LEAK =
952+
SANITIZE_ADDRESS =
953+
954+
# For the 'coccicheck' target
955+
SPATCH_INCLUDE_FLAGS = --all-includes
956+
SPATCH_FLAGS =
957+
SPATCH_TEST_FLAGS =
958+
959+
# If *.o files are present, have "coccicheck" depend on them, with
960+
# COMPUTE_HEADER_DEPENDENCIES this will speed up the common-case of
961+
# only needing to re-generate coccicheck results for the users of a
962+
# given API if it's changed, and not all files in the project. If
963+
# COMPUTE_HEADER_DEPENDENCIES=no this will be unset too.
964+
SPATCH_USE_O_DEPENDENCIES = YesPlease
965+
966+
# Set SPATCH_CONCAT_COCCI to concatenate the contrib/cocci/*.cocci
967+
# files into a single contrib/cocci/ALL.cocci before running
968+
# "coccicheck".
969+
#
970+
# Pros:
971+
#
972+
# - Speeds up a one-shot run of "make coccicheck", as we won't have to
973+
# parse *.[ch] files N times for the N *.cocci rules
974+
#
975+
# Cons:
976+
#
977+
# - Will make incremental development of *.cocci slower, as
978+
# e.g. changing strbuf.cocci will re-run all *.cocci.
979+
#
980+
# - Makes error and performance analysis harder, as rules will be
981+
# applied from a monolithic ALL.cocci, rather than
982+
# e.g. strbuf.cocci. To work around this either undefine this, or
983+
# generate a specific patch, e.g. this will always use strbuf.cocci,
984+
# not ALL.cocci:
985+
#
986+
# make contrib/coccinelle/strbuf.cocci.patch
987+
SPATCH_CONCAT_COCCI = YesPlease
988+
989+
# Rebuild 'coccicheck' if $(SPATCH), its flags etc. change
990+
TRACK_SPATCH_DEFINES =
991+
TRACK_SPATCH_DEFINES += $(SPATCH)
992+
TRACK_SPATCH_DEFINES += $(SPATCH_INCLUDE_FLAGS)
993+
TRACK_SPATCH_DEFINES += $(SPATCH_FLAGS)
994+
TRACK_SPATCH_DEFINES += $(SPATCH_TEST_FLAGS)
995+
GIT-SPATCH-DEFINES: FORCE
996+
@FLAGS='$(TRACK_SPATCH_DEFINES)'; \
997+
if test x"$$FLAGS" != x"`cat GIT-SPATCH-DEFINES 2>/dev/null`" ; then \
998+
echo >&2 " * new spatch flags"; \
999+
echo "$$FLAGS" >GIT-SPATCH-DEFINES; \
1000+
fi
1001+
1002+
include config.mak.uname
1003+
-include config.mak.autogen
1004+
-include config.mak
1005+
1006+
ifdef DEVELOPER
1007+
include config.mak.dev
1008+
endif
1009+
9221010
GENERATED_H += command-list.h
9231011
GENERATED_H += config-list.h
9241012
GENERATED_H += hook-list.h
@@ -1387,94 +1475,6 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o
13871475

13881476
UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o
13891477

1390-
# xdiff and reftable libs may in turn depend on what is in libgit.a
1391-
GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
1392-
EXTLIBS =
1393-
1394-
GIT_USER_AGENT = git/$(GIT_VERSION)
1395-
1396-
ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/sha1.h)
1397-
DC_SHA1_SUBMODULE = auto
1398-
endif
1399-
1400-
# Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
1401-
# tweaked by config.* below as well as the command-line, both of
1402-
# which'll override these defaults.
1403-
# Older versions of GCC may require adding "-std=gnu99" at the end.
1404-
CFLAGS = -g -O2 -Wall
1405-
LDFLAGS =
1406-
CC_LD_DYNPATH = -Wl,-rpath,
1407-
BASIC_CFLAGS = -I.
1408-
BASIC_LDFLAGS =
1409-
1410-
# library flags
1411-
ARFLAGS = rcs
1412-
PTHREAD_CFLAGS =
1413-
1414-
# For the 'sparse' target
1415-
SPARSE_FLAGS ?= -std=gnu99 -D__STDC_NO_VLA__
1416-
SP_EXTRA_FLAGS =
1417-
1418-
# For informing GIT-BUILD-OPTIONS of the SANITIZE=leak,address targets
1419-
SANITIZE_LEAK =
1420-
SANITIZE_ADDRESS =
1421-
1422-
# For the 'coccicheck' target
1423-
SPATCH_INCLUDE_FLAGS = --all-includes
1424-
SPATCH_FLAGS =
1425-
SPATCH_TEST_FLAGS =
1426-
1427-
# If *.o files are present, have "coccicheck" depend on them, with
1428-
# COMPUTE_HEADER_DEPENDENCIES this will speed up the common-case of
1429-
# only needing to re-generate coccicheck results for the users of a
1430-
# given API if it's changed, and not all files in the project. If
1431-
# COMPUTE_HEADER_DEPENDENCIES=no this will be unset too.
1432-
SPATCH_USE_O_DEPENDENCIES = YesPlease
1433-
1434-
# Set SPATCH_CONCAT_COCCI to concatenate the contrib/cocci/*.cocci
1435-
# files into a single contrib/cocci/ALL.cocci before running
1436-
# "coccicheck".
1437-
#
1438-
# Pros:
1439-
#
1440-
# - Speeds up a one-shot run of "make coccicheck", as we won't have to
1441-
# parse *.[ch] files N times for the N *.cocci rules
1442-
#
1443-
# Cons:
1444-
#
1445-
# - Will make incremental development of *.cocci slower, as
1446-
# e.g. changing strbuf.cocci will re-run all *.cocci.
1447-
#
1448-
# - Makes error and performance analysis harder, as rules will be
1449-
# applied from a monolithic ALL.cocci, rather than
1450-
# e.g. strbuf.cocci. To work around this either undefine this, or
1451-
# generate a specific patch, e.g. this will always use strbuf.cocci,
1452-
# not ALL.cocci:
1453-
#
1454-
# make contrib/coccinelle/strbuf.cocci.patch
1455-
SPATCH_CONCAT_COCCI = YesPlease
1456-
1457-
# Rebuild 'coccicheck' if $(SPATCH), its flags etc. change
1458-
TRACK_SPATCH_DEFINES =
1459-
TRACK_SPATCH_DEFINES += $(SPATCH)
1460-
TRACK_SPATCH_DEFINES += $(SPATCH_INCLUDE_FLAGS)
1461-
TRACK_SPATCH_DEFINES += $(SPATCH_FLAGS)
1462-
TRACK_SPATCH_DEFINES += $(SPATCH_TEST_FLAGS)
1463-
GIT-SPATCH-DEFINES: FORCE
1464-
@FLAGS='$(TRACK_SPATCH_DEFINES)'; \
1465-
if test x"$$FLAGS" != x"`cat GIT-SPATCH-DEFINES 2>/dev/null`" ; then \
1466-
echo >&2 " * new spatch flags"; \
1467-
echo "$$FLAGS" >GIT-SPATCH-DEFINES; \
1468-
fi
1469-
1470-
include config.mak.uname
1471-
-include config.mak.autogen
1472-
-include config.mak
1473-
1474-
ifdef DEVELOPER
1475-
include config.mak.dev
1476-
endif
1477-
14781478
GIT-VERSION-FILE: FORCE
14791479
@OLD=$$(cat $@ 2>/dev/null || :) && \
14801480
$(call version_gen,"$(shell pwd)",GIT-VERSION-FILE.in,$@) && \

0 commit comments

Comments
 (0)