Makefile 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731
  1. # The default target of this Makefile is...
  2. all::
  3. # Define V=1 to have a more verbose compile.
  4. #
  5. # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
  6. # or vsnprintf() return -1 instead of number of characters which would
  7. # have been written to the final string if enough space had been available.
  8. #
  9. # Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
  10. # when attempting to read from an fopen'ed directory.
  11. #
  12. # Define NO_OPENSSL environment variable if you do not have OpenSSL.
  13. # This also implies MOZILLA_SHA1.
  14. #
  15. # Define NO_CURL if you do not have libcurl installed. git-http-pull and
  16. # git-http-push are not built, and you cannot use http:// and https://
  17. # transports.
  18. #
  19. # Define CURLDIR=/foo/bar if your curl header and library files are in
  20. # /foo/bar/include and /foo/bar/lib directories.
  21. #
  22. # Define NO_EXPAT if you do not have expat installed. git-http-push is
  23. # not built, and you cannot push using http:// and https:// transports.
  24. #
  25. # Define EXPATDIR=/foo/bar if your expat header and library files are in
  26. # /foo/bar/include and /foo/bar/lib directories.
  27. #
  28. # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
  29. #
  30. # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
  31. # d_type in struct dirent (latest Cygwin -- will be fixed soonish).
  32. #
  33. # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
  34. # do not support the 'size specifiers' introduced by C99, namely ll, hh,
  35. # j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
  36. # some C compilers supported these specifiers prior to C99 as an extension.
  37. #
  38. # Define NO_STRCASESTR if you don't have strcasestr.
  39. #
  40. # Define NO_MEMMEM if you don't have memmem.
  41. #
  42. # Define NO_STRLCPY if you don't have strlcpy.
  43. #
  44. # Define NO_STRTOUMAX if you don't have strtoumax in the C library.
  45. # If your compiler also does not support long long or does not have
  46. # strtoull, define NO_STRTOULL.
  47. #
  48. # Define NO_SETENV if you don't have setenv in the C library.
  49. #
  50. # Define NO_UNSETENV if you don't have unsetenv in the C library.
  51. #
  52. # Define NO_MKDTEMP if you don't have mkdtemp in the C library.
  53. #
  54. # Define NO_SYS_SELECT_H if you don't have sys/select.h.
  55. #
  56. # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
  57. # Enable it on Windows. By default, symrefs are still used.
  58. #
  59. # Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
  60. # tests. These tests take up a significant amount of the total test time
  61. # but are not needed unless you plan to talk to SVN repos.
  62. #
  63. # Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
  64. # installed in /sw, but don't want GIT to link against any libraries
  65. # installed there. If defined you may specify your own (or Fink's)
  66. # include directories and library directories by defining CFLAGS
  67. # and LDFLAGS appropriately.
  68. #
  69. # Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
  70. # have DarwinPorts installed in /opt/local, but don't want GIT to
  71. # link against any libraries installed there. If defined you may
  72. # specify your own (or DarwinPort's) include directories and
  73. # library directories by defining CFLAGS and LDFLAGS appropriately.
  74. #
  75. # Define PPC_SHA1 environment variable when running make to make use of
  76. # a bundled SHA1 routine optimized for PowerPC.
  77. #
  78. # Define ARM_SHA1 environment variable when running make to make use of
  79. # a bundled SHA1 routine optimized for ARM.
  80. #
  81. # Define MOZILLA_SHA1 environment variable when running make to make use of
  82. # a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
  83. # on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
  84. # choice) has very fast version optimized for i586.
  85. #
  86. # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
  87. #
  88. # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
  89. #
  90. # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
  91. # Patrick Mauritz).
  92. #
  93. # Define NO_MMAP if you want to avoid mmap.
  94. #
  95. # Define NO_PTHREADS if you do not have or do not want to use Pthreads.
  96. #
  97. # Define NO_PREAD if you have a problem with pread() system call (e.g.
  98. # cygwin.dll before v1.5.22).
  99. #
  100. # Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
  101. # generally faster on your platform than accessing the working directory.
  102. #
  103. # Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
  104. # the executable mode bit, but doesn't really do so.
  105. #
  106. # Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
  107. #
  108. # Define NO_SOCKADDR_STORAGE if your platform does not have struct
  109. # sockaddr_storage.
  110. #
  111. # Define NO_ICONV if your libc does not properly support iconv.
  112. #
  113. # Define OLD_ICONV if your library has an old iconv(), where the second
  114. # (input buffer pointer) parameter is declared with type (const char **).
  115. #
  116. # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
  117. #
  118. # Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
  119. # that tells runtime paths to dynamic libraries;
  120. # "-Wl,-rpath=/path/lib" is used instead.
  121. #
  122. # Define USE_NSEC below if you want git to care about sub-second file mtimes
  123. # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
  124. # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
  125. # randomly break unless your underlying filesystem supports those sub-second
  126. # times (my ext3 doesn't).
  127. #
  128. # Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
  129. # "st_ctim"
  130. #
  131. # Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
  132. # available. This automatically turns USE_NSEC off.
  133. #
  134. # Define USE_STDEV below if you want git to care about the underlying device
  135. # change being considered an inode change from the update-index perspective.
  136. #
  137. # Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
  138. # field that counts the on-disk footprint in 512-byte blocks.
  139. #
  140. # Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
  141. #
  142. # Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
  143. #
  144. # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
  145. # MakeMaker (e.g. using ActiveState under Cygwin).
  146. #
  147. # Define NO_PERL if you do not want Perl scripts or libraries at all.
  148. #
  149. # Define NO_TCLTK if you do not want Tcl/Tk GUI.
  150. #
  151. # The TCL_PATH variable governs the location of the Tcl interpreter
  152. # used to optimize git-gui for your system. Only used if NO_TCLTK
  153. # is not set. Defaults to the bare 'tclsh'.
  154. #
  155. # The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
  156. # If not set it defaults to the bare 'wish'. If it is set to the empty
  157. # string then NO_TCLTK will be forced (this is used by configure script).
  158. #
  159. # Define THREADED_DELTA_SEARCH if you have pthreads and wish to exploit
  160. # parallel delta searching when packing objects.
  161. #
  162. # Define INTERNAL_QSORT to use Git's implementation of qsort(), which
  163. # is a simplified version of the merge sort used in glibc. This is
  164. # recommended if Git triggers O(n^2) behavior in your platform's qsort().
  165. #
  166. # Define NO_EXTERNAL_GREP if you don't want "git grep" to ever call
  167. # your external grep (e.g., if your system lacks grep, if its grep is
  168. # broken, or spawning external process is slower than built-in grep git has).
  169. GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
  170. @$(SHELL_PATH) ./GIT-VERSION-GEN
  171. -include GIT-VERSION-FILE
  172. uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
  173. uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
  174. uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
  175. uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
  176. uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
  177. uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
  178. # CFLAGS and LDFLAGS are for the users to override from the command line.
  179. CFLAGS = -g -O2 -Wall
  180. LDFLAGS =
  181. ALL_CFLAGS = $(CFLAGS)
  182. ALL_LDFLAGS = $(LDFLAGS)
  183. STRIP ?= strip
  184. # Among the variables below, these:
  185. # gitexecdir
  186. # template_dir
  187. # mandir
  188. # infodir
  189. # htmldir
  190. # ETC_GITCONFIG (but not sysconfdir)
  191. # can be specified as a relative path some/where/else;
  192. # this is interpreted as relative to $(prefix) and "git" at
  193. # runtime figures out where they are based on the path to the executable.
  194. # This can help installing the suite in a relocatable way.
  195. prefix = $(HOME)
  196. bindir_relative = bin
  197. bindir = $(prefix)/$(bindir_relative)
  198. mandir = share/man
  199. infodir = share/info
  200. gitexecdir = libexec/git-core
  201. sharedir = $(prefix)/share
  202. template_dir = share/git-core/templates
  203. htmldir = share/doc/git-doc
  204. ifeq ($(prefix),/usr)
  205. sysconfdir = /etc
  206. ETC_GITCONFIG = $(sysconfdir)/gitconfig
  207. else
  208. sysconfdir = $(prefix)/etc
  209. ETC_GITCONFIG = etc/gitconfig
  210. endif
  211. lib = lib
  212. # DESTDIR=
  213. # default configuration for gitweb
  214. GITWEB_CONFIG = gitweb_config.perl
  215. GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf
  216. GITWEB_HOME_LINK_STR = projects
  217. GITWEB_SITENAME =
  218. GITWEB_PROJECTROOT = /pub/git
  219. GITWEB_PROJECT_MAXDEPTH = 2007
  220. GITWEB_EXPORT_OK =
  221. GITWEB_STRICT_EXPORT =
  222. GITWEB_BASE_URL =
  223. GITWEB_LIST =
  224. GITWEB_HOMETEXT = indextext.html
  225. GITWEB_CSS = gitweb.css
  226. GITWEB_LOGO = git-logo.png
  227. GITWEB_FAVICON = git-favicon.png
  228. GITWEB_SITE_HEADER =
  229. GITWEB_SITE_FOOTER =
  230. export prefix bindir sharedir sysconfdir
  231. CC = gcc
  232. AR = ar
  233. RM = rm -f
  234. TAR = tar
  235. FIND = find
  236. INSTALL = install
  237. RPMBUILD = rpmbuild
  238. TCL_PATH = tclsh
  239. TCLTK_PATH = wish
  240. PTHREAD_LIBS = -lpthread
  241. export TCL_PATH TCLTK_PATH
  242. # sparse is architecture-neutral, which means that we need to tell it
  243. # explicitly what architecture to check for. Fix this up for yours..
  244. SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
  245. ### --- END CONFIGURATION SECTION ---
  246. # Those must not be GNU-specific; they are shared with perl/ which may
  247. # be built by a different compiler. (Note that this is an artifact now
  248. # but it still might be nice to keep that distinction.)
  249. BASIC_CFLAGS =
  250. BASIC_LDFLAGS =
  251. # Guard against environment variables
  252. BUILTIN_OBJS =
  253. BUILT_INS =
  254. COMPAT_CFLAGS =
  255. COMPAT_OBJS =
  256. LIB_H =
  257. LIB_OBJS =
  258. PROGRAMS =
  259. SCRIPT_PERL =
  260. SCRIPT_SH =
  261. TEST_PROGRAMS =
  262. SCRIPT_SH += git-am.sh
  263. SCRIPT_SH += git-bisect.sh
  264. SCRIPT_SH += git-difftool--helper.sh
  265. SCRIPT_SH += git-filter-branch.sh
  266. SCRIPT_SH += git-lost-found.sh
  267. SCRIPT_SH += git-merge-octopus.sh
  268. SCRIPT_SH += git-merge-one-file.sh
  269. SCRIPT_SH += git-merge-resolve.sh
  270. SCRIPT_SH += git-mergetool.sh
  271. SCRIPT_SH += git-mergetool--lib.sh
  272. SCRIPT_SH += git-parse-remote.sh
  273. SCRIPT_SH += git-pull.sh
  274. SCRIPT_SH += git-quiltimport.sh
  275. SCRIPT_SH += git-rebase--interactive.sh
  276. SCRIPT_SH += git-rebase.sh
  277. SCRIPT_SH += git-repack.sh
  278. SCRIPT_SH += git-request-pull.sh
  279. SCRIPT_SH += git-sh-setup.sh
  280. SCRIPT_SH += git-stash.sh
  281. SCRIPT_SH += git-submodule.sh
  282. SCRIPT_SH += git-web--browse.sh
  283. SCRIPT_PERL += git-add--interactive.perl
  284. SCRIPT_PERL += git-difftool.perl
  285. SCRIPT_PERL += git-archimport.perl
  286. SCRIPT_PERL += git-cvsexportcommit.perl
  287. SCRIPT_PERL += git-cvsimport.perl
  288. SCRIPT_PERL += git-cvsserver.perl
  289. SCRIPT_PERL += git-relink.perl
  290. SCRIPT_PERL += git-send-email.perl
  291. SCRIPT_PERL += git-svn.perl
  292. SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
  293. $(patsubst %.perl,%,$(SCRIPT_PERL)) \
  294. git-instaweb
  295. # Empty...
  296. EXTRA_PROGRAMS =
  297. # ... and all the rest that could be moved out of bindir to gitexecdir
  298. PROGRAMS += $(EXTRA_PROGRAMS)
  299. PROGRAMS += git-fast-import$X
  300. PROGRAMS += git-hash-object$X
  301. PROGRAMS += git-index-pack$X
  302. PROGRAMS += git-merge-index$X
  303. PROGRAMS += git-merge-tree$X
  304. PROGRAMS += git-mktag$X
  305. PROGRAMS += git-mktree$X
  306. PROGRAMS += git-pack-redundant$X
  307. PROGRAMS += git-patch-id$X
  308. PROGRAMS += git-shell$X
  309. PROGRAMS += git-show-index$X
  310. PROGRAMS += git-unpack-file$X
  311. PROGRAMS += git-update-server-info$X
  312. PROGRAMS += git-upload-pack$X
  313. PROGRAMS += git-var$X
  314. # List built-in command $C whose implementation cmd_$C() is not in
  315. # builtin-$C.o but is linked in as part of some other command.
  316. BUILT_INS += $(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
  317. BUILT_INS += git-cherry$X
  318. BUILT_INS += git-cherry-pick$X
  319. BUILT_INS += git-format-patch$X
  320. BUILT_INS += git-fsck-objects$X
  321. BUILT_INS += git-get-tar-commit-id$X
  322. BUILT_INS += git-init$X
  323. BUILT_INS += git-merge-subtree$X
  324. BUILT_INS += git-peek-remote$X
  325. BUILT_INS += git-repo-config$X
  326. BUILT_INS += git-show$X
  327. BUILT_INS += git-stage$X
  328. BUILT_INS += git-status$X
  329. BUILT_INS += git-whatchanged$X
  330. # what 'all' will build and 'install' will install, in gitexecdir
  331. ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
  332. # what 'all' will build but not install in gitexecdir
  333. OTHER_PROGRAMS = git$X
  334. ifndef NO_PERL
  335. OTHER_PROGRAMS += gitweb/gitweb.cgi
  336. endif
  337. # Set paths to tools early so that they can be used for version tests.
  338. ifndef SHELL_PATH
  339. SHELL_PATH = /bin/sh
  340. endif
  341. ifndef PERL_PATH
  342. PERL_PATH = /usr/bin/perl
  343. endif
  344. export PERL_PATH
  345. LIB_FILE=libgit.a
  346. XDIFF_LIB=xdiff/lib.a
  347. LIB_H += archive.h
  348. LIB_H += attr.h
  349. LIB_H += blob.h
  350. LIB_H += builtin.h
  351. LIB_H += cache.h
  352. LIB_H += cache-tree.h
  353. LIB_H += commit.h
  354. LIB_H += compat/cygwin.h
  355. LIB_H += compat/mingw.h
  356. LIB_H += csum-file.h
  357. LIB_H += decorate.h
  358. LIB_H += delta.h
  359. LIB_H += diffcore.h
  360. LIB_H += diff.h
  361. LIB_H += dir.h
  362. LIB_H += fsck.h
  363. LIB_H += git-compat-util.h
  364. LIB_H += graph.h
  365. LIB_H += grep.h
  366. LIB_H += hash.h
  367. LIB_H += help.h
  368. LIB_H += levenshtein.h
  369. LIB_H += list-objects.h
  370. LIB_H += ll-merge.h
  371. LIB_H += log-tree.h
  372. LIB_H += mailmap.h
  373. LIB_H += merge-recursive.h
  374. LIB_H += object.h
  375. LIB_H += pack.h
  376. LIB_H += pack-refs.h
  377. LIB_H += pack-revindex.h
  378. LIB_H += parse-options.h
  379. LIB_H += patch-ids.h
  380. LIB_H += pkt-line.h
  381. LIB_H += progress.h
  382. LIB_H += quote.h
  383. LIB_H += reflog-walk.h
  384. LIB_H += refs.h
  385. LIB_H += remote.h
  386. LIB_H += rerere.h
  387. LIB_H += revision.h
  388. LIB_H += run-command.h
  389. LIB_H += sha1-lookup.h
  390. LIB_H += sideband.h
  391. LIB_H += sigchain.h
  392. LIB_H += strbuf.h
  393. LIB_H += string-list.h
  394. LIB_H += tag.h
  395. LIB_H += transport.h
  396. LIB_H += tree.h
  397. LIB_H += tree-walk.h
  398. LIB_H += unpack-trees.h
  399. LIB_H += userdiff.h
  400. LIB_H += utf8.h
  401. LIB_H += wt-status.h
  402. LIB_OBJS += abspath.o
  403. LIB_OBJS += alias.o
  404. LIB_OBJS += alloc.o
  405. LIB_OBJS += archive.o
  406. LIB_OBJS += archive-tar.o
  407. LIB_OBJS += archive-zip.o
  408. LIB_OBJS += attr.o
  409. LIB_OBJS += base85.o
  410. LIB_OBJS += bisect.o
  411. LIB_OBJS += blob.o
  412. LIB_OBJS += branch.o
  413. LIB_OBJS += bundle.o
  414. LIB_OBJS += cache-tree.o
  415. LIB_OBJS += color.o
  416. LIB_OBJS += combine-diff.o
  417. LIB_OBJS += commit.o
  418. LIB_OBJS += config.o
  419. LIB_OBJS += connect.o
  420. LIB_OBJS += convert.o
  421. LIB_OBJS += copy.o
  422. LIB_OBJS += csum-file.o
  423. LIB_OBJS += ctype.o
  424. LIB_OBJS += date.o
  425. LIB_OBJS += decorate.o
  426. LIB_OBJS += diffcore-break.o
  427. LIB_OBJS += diffcore-delta.o
  428. LIB_OBJS += diffcore-order.o
  429. LIB_OBJS += diffcore-pickaxe.o
  430. LIB_OBJS += diffcore-rename.o
  431. LIB_OBJS += diff-delta.o
  432. LIB_OBJS += diff-lib.o
  433. LIB_OBJS += diff-no-index.o
  434. LIB_OBJS += diff.o
  435. LIB_OBJS += dir.o
  436. LIB_OBJS += editor.o
  437. LIB_OBJS += entry.o
  438. LIB_OBJS += environment.o
  439. LIB_OBJS += exec_cmd.o
  440. LIB_OBJS += fsck.o
  441. LIB_OBJS += graph.o
  442. LIB_OBJS += grep.o
  443. LIB_OBJS += hash.o
  444. LIB_OBJS += help.o
  445. LIB_OBJS += ident.o
  446. LIB_OBJS += levenshtein.o
  447. LIB_OBJS += list-objects.o
  448. LIB_OBJS += ll-merge.o
  449. LIB_OBJS += lockfile.o
  450. LIB_OBJS += log-tree.o
  451. LIB_OBJS += mailmap.o
  452. LIB_OBJS += match-trees.o
  453. LIB_OBJS += merge-file.o
  454. LIB_OBJS += merge-recursive.o
  455. LIB_OBJS += name-hash.o
  456. LIB_OBJS += object.o
  457. LIB_OBJS += pack-check.o
  458. LIB_OBJS += pack-refs.o
  459. LIB_OBJS += pack-revindex.o
  460. LIB_OBJS += pack-write.o
  461. LIB_OBJS += pager.o
  462. LIB_OBJS += parse-options.o
  463. LIB_OBJS += patch-delta.o
  464. LIB_OBJS += patch-ids.o
  465. LIB_OBJS += path.o
  466. LIB_OBJS += pkt-line.o
  467. LIB_OBJS += preload-index.o
  468. LIB_OBJS += pretty.o
  469. LIB_OBJS += progress.o
  470. LIB_OBJS += quote.o
  471. LIB_OBJS += reachable.o
  472. LIB_OBJS += read-cache.o
  473. LIB_OBJS += reflog-walk.o
  474. LIB_OBJS += refs.o
  475. LIB_OBJS += remote.o
  476. LIB_OBJS += rerere.o
  477. LIB_OBJS += revision.o
  478. LIB_OBJS += run-command.o
  479. LIB_OBJS += server-info.o
  480. LIB_OBJS += setup.o
  481. LIB_OBJS += sha1-lookup.o
  482. LIB_OBJS += sha1_file.o
  483. LIB_OBJS += sha1_name.o
  484. LIB_OBJS += shallow.o
  485. LIB_OBJS += sideband.o
  486. LIB_OBJS += sigchain.o
  487. LIB_OBJS += strbuf.o
  488. LIB_OBJS += string-list.o
  489. LIB_OBJS += symlinks.o
  490. LIB_OBJS += tag.o
  491. LIB_OBJS += trace.o
  492. LIB_OBJS += transport.o
  493. LIB_OBJS += tree-diff.o
  494. LIB_OBJS += tree.o
  495. LIB_OBJS += tree-walk.o
  496. LIB_OBJS += unpack-trees.o
  497. LIB_OBJS += usage.o
  498. LIB_OBJS += userdiff.o
  499. LIB_OBJS += utf8.o
  500. LIB_OBJS += walker.o
  501. LIB_OBJS += wrapper.o
  502. LIB_OBJS += write_or_die.o
  503. LIB_OBJS += ws.o
  504. LIB_OBJS += wt-status.o
  505. LIB_OBJS += xdiff-interface.o
  506. BUILTIN_OBJS += builtin-add.o
  507. BUILTIN_OBJS += builtin-annotate.o
  508. BUILTIN_OBJS += builtin-apply.o
  509. BUILTIN_OBJS += builtin-archive.o
  510. BUILTIN_OBJS += builtin-bisect--helper.o
  511. BUILTIN_OBJS += builtin-blame.o
  512. BUILTIN_OBJS += builtin-branch.o
  513. BUILTIN_OBJS += builtin-bundle.o
  514. BUILTIN_OBJS += builtin-cat-file.o
  515. BUILTIN_OBJS += builtin-check-attr.o
  516. BUILTIN_OBJS += builtin-check-ref-format.o
  517. BUILTIN_OBJS += builtin-checkout-index.o
  518. BUILTIN_OBJS += builtin-checkout.o
  519. BUILTIN_OBJS += builtin-clean.o
  520. BUILTIN_OBJS += builtin-clone.o
  521. BUILTIN_OBJS += builtin-commit-tree.o
  522. BUILTIN_OBJS += builtin-commit.o
  523. BUILTIN_OBJS += builtin-config.o
  524. BUILTIN_OBJS += builtin-count-objects.o
  525. BUILTIN_OBJS += builtin-describe.o
  526. BUILTIN_OBJS += builtin-diff-files.o
  527. BUILTIN_OBJS += builtin-diff-index.o
  528. BUILTIN_OBJS += builtin-diff-tree.o
  529. BUILTIN_OBJS += builtin-diff.o
  530. BUILTIN_OBJS += builtin-fast-export.o
  531. BUILTIN_OBJS += builtin-fetch--tool.o
  532. BUILTIN_OBJS += builtin-fetch-pack.o
  533. BUILTIN_OBJS += builtin-fetch.o
  534. BUILTIN_OBJS += builtin-fmt-merge-msg.o
  535. BUILTIN_OBJS += builtin-for-each-ref.o
  536. BUILTIN_OBJS += builtin-fsck.o
  537. BUILTIN_OBJS += builtin-gc.o
  538. BUILTIN_OBJS += builtin-grep.o
  539. BUILTIN_OBJS += builtin-help.o
  540. BUILTIN_OBJS += builtin-init-db.o
  541. BUILTIN_OBJS += builtin-log.o
  542. BUILTIN_OBJS += builtin-ls-files.o
  543. BUILTIN_OBJS += builtin-ls-remote.o
  544. BUILTIN_OBJS += builtin-ls-tree.o
  545. BUILTIN_OBJS += builtin-mailinfo.o
  546. BUILTIN_OBJS += builtin-mailsplit.o
  547. BUILTIN_OBJS += builtin-merge.o
  548. BUILTIN_OBJS += builtin-merge-base.o
  549. BUILTIN_OBJS += builtin-merge-file.o
  550. BUILTIN_OBJS += builtin-merge-ours.o
  551. BUILTIN_OBJS += builtin-merge-recursive.o
  552. BUILTIN_OBJS += builtin-mv.o
  553. BUILTIN_OBJS += builtin-name-rev.o
  554. BUILTIN_OBJS += builtin-pack-objects.o
  555. BUILTIN_OBJS += builtin-pack-refs.o
  556. BUILTIN_OBJS += builtin-prune-packed.o
  557. BUILTIN_OBJS += builtin-prune.o
  558. BUILTIN_OBJS += builtin-push.o
  559. BUILTIN_OBJS += builtin-read-tree.o
  560. BUILTIN_OBJS += builtin-receive-pack.o
  561. BUILTIN_OBJS += builtin-reflog.o
  562. BUILTIN_OBJS += builtin-remote.o
  563. BUILTIN_OBJS += builtin-rerere.o
  564. BUILTIN_OBJS += builtin-reset.o
  565. BUILTIN_OBJS += builtin-rev-list.o
  566. BUILTIN_OBJS += builtin-rev-parse.o
  567. BUILTIN_OBJS += builtin-revert.o
  568. BUILTIN_OBJS += builtin-rm.o
  569. BUILTIN_OBJS += builtin-send-pack.o
  570. BUILTIN_OBJS += builtin-shortlog.o
  571. BUILTIN_OBJS += builtin-show-branch.o
  572. BUILTIN_OBJS += builtin-show-ref.o
  573. BUILTIN_OBJS += builtin-stripspace.o
  574. BUILTIN_OBJS += builtin-symbolic-ref.o
  575. BUILTIN_OBJS += builtin-tag.o
  576. BUILTIN_OBJS += builtin-tar-tree.o
  577. BUILTIN_OBJS += builtin-unpack-objects.o
  578. BUILTIN_OBJS += builtin-update-index.o
  579. BUILTIN_OBJS += builtin-update-ref.o
  580. BUILTIN_OBJS += builtin-upload-archive.o
  581. BUILTIN_OBJS += builtin-verify-pack.o
  582. BUILTIN_OBJS += builtin-verify-tag.o
  583. BUILTIN_OBJS += builtin-write-tree.o
  584. GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
  585. EXTLIBS =
  586. #
  587. # Platform specific tweaks
  588. #
  589. # We choose to avoid "if .. else if .. else .. endif endif"
  590. # because maintaining the nesting to match is a pain. If
  591. # we had "elif" things would have been much nicer...
  592. ifeq ($(uname_S),Linux)
  593. NO_STRLCPY = YesPlease
  594. THREADED_DELTA_SEARCH = YesPlease
  595. endif
  596. ifeq ($(uname_S),GNU/kFreeBSD)
  597. NO_STRLCPY = YesPlease
  598. THREADED_DELTA_SEARCH = YesPlease
  599. endif
  600. ifeq ($(uname_S),UnixWare)
  601. CC = cc
  602. NEEDS_SOCKET = YesPlease
  603. NEEDS_NSL = YesPlease
  604. NEEDS_SSL_WITH_CRYPTO = YesPlease
  605. NEEDS_LIBICONV = YesPlease
  606. SHELL_PATH = /usr/local/bin/bash
  607. NO_IPV6 = YesPlease
  608. NO_HSTRERROR = YesPlease
  609. BASIC_CFLAGS += -Kthread
  610. BASIC_CFLAGS += -I/usr/local/include
  611. BASIC_LDFLAGS += -L/usr/local/lib
  612. INSTALL = ginstall
  613. TAR = gtar
  614. NO_STRCASESTR = YesPlease
  615. NO_MEMMEM = YesPlease
  616. endif
  617. ifeq ($(uname_S),SCO_SV)
  618. ifeq ($(uname_R),3.2)
  619. CFLAGS = -O2
  620. endif
  621. ifeq ($(uname_R),5)
  622. CC = cc
  623. BASIC_CFLAGS += -Kthread
  624. endif
  625. NEEDS_SOCKET = YesPlease
  626. NEEDS_NSL = YesPlease
  627. NEEDS_SSL_WITH_CRYPTO = YesPlease
  628. NEEDS_LIBICONV = YesPlease
  629. SHELL_PATH = /usr/bin/bash
  630. NO_IPV6 = YesPlease
  631. NO_HSTRERROR = YesPlease
  632. BASIC_CFLAGS += -I/usr/local/include
  633. BASIC_LDFLAGS += -L/usr/local/lib
  634. NO_STRCASESTR = YesPlease
  635. NO_MEMMEM = YesPlease
  636. INSTALL = ginstall
  637. TAR = gtar
  638. endif
  639. ifeq ($(uname_S),Darwin)
  640. NEEDS_SSL_WITH_CRYPTO = YesPlease
  641. NEEDS_LIBICONV = YesPlease
  642. ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
  643. OLD_ICONV = UnfortunatelyYes
  644. endif
  645. ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
  646. NO_STRLCPY = YesPlease
  647. endif
  648. NO_MEMMEM = YesPlease
  649. THREADED_DELTA_SEARCH = YesPlease
  650. USE_ST_TIMESPEC = YesPlease
  651. endif
  652. ifeq ($(uname_S),SunOS)
  653. NEEDS_SOCKET = YesPlease
  654. NEEDS_NSL = YesPlease
  655. SHELL_PATH = /bin/bash
  656. NO_STRCASESTR = YesPlease
  657. NO_MEMMEM = YesPlease
  658. NO_HSTRERROR = YesPlease
  659. NO_MKDTEMP = YesPlease
  660. OLD_ICONV = UnfortunatelyYes
  661. ifeq ($(uname_R),5.8)
  662. NO_UNSETENV = YesPlease
  663. NO_SETENV = YesPlease
  664. NO_C99_FORMAT = YesPlease
  665. NO_STRTOUMAX = YesPlease
  666. endif
  667. ifeq ($(uname_R),5.9)
  668. NO_UNSETENV = YesPlease
  669. NO_SETENV = YesPlease
  670. NO_C99_FORMAT = YesPlease
  671. NO_STRTOUMAX = YesPlease
  672. endif
  673. INSTALL = ginstall
  674. TAR = gtar
  675. BASIC_CFLAGS += -D__EXTENSIONS__
  676. endif
  677. ifeq ($(uname_O),Cygwin)
  678. NO_D_TYPE_IN_DIRENT = YesPlease
  679. NO_D_INO_IN_DIRENT = YesPlease
  680. NO_STRCASESTR = YesPlease
  681. NO_MEMMEM = YesPlease
  682. NO_SYMLINK_HEAD = YesPlease
  683. NEEDS_LIBICONV = YesPlease
  684. NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
  685. NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
  686. OLD_ICONV = UnfortunatelyYes
  687. # There are conflicting reports about this.
  688. # On some boxes NO_MMAP is needed, and not so elsewhere.
  689. # Try commenting this out if you suspect MMAP is more efficient
  690. NO_MMAP = YesPlease
  691. NO_IPV6 = YesPlease
  692. X = .exe
  693. endif
  694. ifeq ($(uname_S),FreeBSD)
  695. NEEDS_LIBICONV = YesPlease
  696. NO_MEMMEM = YesPlease
  697. BASIC_CFLAGS += -I/usr/local/include
  698. BASIC_LDFLAGS += -L/usr/local/lib
  699. DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
  700. USE_ST_TIMESPEC = YesPlease
  701. THREADED_DELTA_SEARCH = YesPlease
  702. ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
  703. PTHREAD_LIBS = -pthread
  704. NO_UINTMAX_T = YesPlease
  705. NO_STRTOUMAX = YesPlease
  706. endif
  707. endif
  708. ifeq ($(uname_S),OpenBSD)
  709. NO_STRCASESTR = YesPlease
  710. NO_MEMMEM = YesPlease
  711. NEEDS_LIBICONV = YesPlease
  712. BASIC_CFLAGS += -I/usr/local/include
  713. BASIC_LDFLAGS += -L/usr/local/lib
  714. THREADED_DELTA_SEARCH = YesPlease
  715. endif
  716. ifeq ($(uname_S),NetBSD)
  717. ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
  718. NEEDS_LIBICONV = YesPlease
  719. endif
  720. BASIC_CFLAGS += -I/usr/pkg/include
  721. BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
  722. THREADED_DELTA_SEARCH = YesPlease
  723. endif
  724. ifeq ($(uname_S),AIX)
  725. NO_STRCASESTR=YesPlease
  726. NO_MEMMEM = YesPlease
  727. NO_MKDTEMP = YesPlease
  728. NO_STRLCPY = YesPlease
  729. NO_NSEC = YesPlease
  730. FREAD_READS_DIRECTORIES = UnfortunatelyYes
  731. INTERNAL_QSORT = UnfortunatelyYes
  732. NEEDS_LIBICONV=YesPlease
  733. BASIC_CFLAGS += -D_LARGE_FILES
  734. ifneq ($(shell expr "$(uname_V)" : '[1234]'),1)
  735. THREADED_DELTA_SEARCH = YesPlease
  736. else
  737. NO_PTHREADS = YesPlease
  738. endif
  739. endif
  740. ifeq ($(uname_S),GNU)
  741. # GNU/Hurd
  742. NO_STRLCPY=YesPlease
  743. endif
  744. ifeq ($(uname_S),IRIX64)
  745. NO_IPV6=YesPlease
  746. NO_SETENV=YesPlease
  747. NO_STRCASESTR=YesPlease
  748. NO_MEMMEM = YesPlease
  749. NO_STRLCPY = YesPlease
  750. NO_SOCKADDR_STORAGE=YesPlease
  751. SHELL_PATH=/usr/gnu/bin/bash
  752. BASIC_CFLAGS += -DPATH_MAX=1024
  753. # for now, build 32-bit version
  754. BASIC_LDFLAGS += -L/usr/lib32
  755. endif
  756. ifeq ($(uname_S),HP-UX)
  757. NO_IPV6=YesPlease
  758. NO_SETENV=YesPlease
  759. NO_STRCASESTR=YesPlease
  760. NO_MEMMEM = YesPlease
  761. NO_STRLCPY = YesPlease
  762. NO_MKDTEMP = YesPlease
  763. NO_UNSETENV = YesPlease
  764. NO_HSTRERROR = YesPlease
  765. NO_SYS_SELECT_H = YesPlease
  766. SNPRINTF_RETURNS_BOGUS = YesPlease
  767. endif
  768. ifneq (,$(findstring CYGWIN,$(uname_S)))
  769. COMPAT_OBJS += compat/cygwin.o
  770. endif
  771. ifneq (,$(findstring MINGW,$(uname_S)))
  772. NO_PREAD = YesPlease
  773. NO_OPENSSL = YesPlease
  774. NO_CURL = YesPlease
  775. NO_SYMLINK_HEAD = YesPlease
  776. NO_IPV6 = YesPlease
  777. NO_SETENV = YesPlease
  778. NO_UNSETENV = YesPlease
  779. NO_STRCASESTR = YesPlease
  780. NO_STRLCPY = YesPlease
  781. NO_MEMMEM = YesPlease
  782. NO_PTHREADS = YesPlease
  783. NEEDS_LIBICONV = YesPlease
  784. OLD_ICONV = YesPlease
  785. NO_C99_FORMAT = YesPlease
  786. NO_STRTOUMAX = YesPlease
  787. NO_MKDTEMP = YesPlease
  788. SNPRINTF_RETURNS_BOGUS = YesPlease
  789. NO_SVN_TESTS = YesPlease
  790. NO_PERL_MAKEMAKER = YesPlease
  791. RUNTIME_PREFIX = YesPlease
  792. NO_POSIX_ONLY_PROGRAMS = YesPlease
  793. NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
  794. NO_NSEC = YesPlease
  795. USE_WIN32_MMAP = YesPlease
  796. COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch
  797. COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1
  798. COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
  799. COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o
  800. EXTLIBS += -lws2_32
  801. X = .exe
  802. endif
  803. ifneq (,$(findstring arm,$(uname_M)))
  804. ARM_SHA1 = YesPlease
  805. endif
  806. -include config.mak.autogen
  807. -include config.mak
  808. ifeq ($(uname_S),Darwin)
  809. ifndef NO_FINK
  810. ifeq ($(shell test -d /sw/lib && echo y),y)
  811. BASIC_CFLAGS += -I/sw/include
  812. BASIC_LDFLAGS += -L/sw/lib
  813. endif
  814. endif
  815. ifndef NO_DARWIN_PORTS
  816. ifeq ($(shell test -d /opt/local/lib && echo y),y)
  817. BASIC_CFLAGS += -I/opt/local/include
  818. BASIC_LDFLAGS += -L/opt/local/lib
  819. endif
  820. endif
  821. PTHREAD_LIBS =
  822. endif
  823. ifndef CC_LD_DYNPATH
  824. ifdef NO_R_TO_GCC_LINKER
  825. # Some gcc does not accept and pass -R to the linker to specify
  826. # the runtime dynamic library path.
  827. CC_LD_DYNPATH = -Wl,-rpath,
  828. else
  829. CC_LD_DYNPATH = -R
  830. endif
  831. endif
  832. ifdef NO_CURL
  833. BASIC_CFLAGS += -DNO_CURL
  834. else
  835. ifdef CURLDIR
  836. # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
  837. BASIC_CFLAGS += -I$(CURLDIR)/include
  838. CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
  839. else
  840. CURL_LIBCURL = -lcurl
  841. endif
  842. BUILTIN_OBJS += builtin-http-fetch.o
  843. EXTLIBS += $(CURL_LIBCURL)
  844. LIB_OBJS += http.o http-walker.o
  845. curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
  846. ifeq "$(curl_check)" "070908"
  847. ifndef NO_EXPAT
  848. PROGRAMS += git-http-push$X
  849. endif
  850. endif
  851. ifndef NO_EXPAT
  852. ifdef EXPATDIR
  853. BASIC_CFLAGS += -I$(EXPATDIR)/include
  854. EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
  855. else
  856. EXPAT_LIBEXPAT = -lexpat
  857. endif
  858. endif
  859. endif
  860. ifdef ZLIB_PATH
  861. BASIC_CFLAGS += -I$(ZLIB_PATH)/include
  862. EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
  863. endif
  864. EXTLIBS += -lz
  865. ifndef NO_POSIX_ONLY_PROGRAMS
  866. PROGRAMS += git-daemon$X
  867. PROGRAMS += git-imap-send$X
  868. endif
  869. ifndef NO_OPENSSL
  870. OPENSSL_LIBSSL = -lssl
  871. ifdef OPENSSLDIR
  872. BASIC_CFLAGS += -I$(OPENSSLDIR)/include
  873. OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
  874. else
  875. OPENSSL_LINK =
  876. endif
  877. else
  878. BASIC_CFLAGS += -DNO_OPENSSL
  879. MOZILLA_SHA1 = 1
  880. OPENSSL_LIBSSL =
  881. endif
  882. ifdef NEEDS_SSL_WITH_CRYPTO
  883. LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
  884. else
  885. LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
  886. endif
  887. ifdef NEEDS_LIBICONV
  888. ifdef ICONVDIR
  889. BASIC_CFLAGS += -I$(ICONVDIR)/include
  890. ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
  891. else
  892. ICONV_LINK =
  893. endif
  894. EXTLIBS += $(ICONV_LINK) -liconv
  895. endif
  896. ifdef NEEDS_SOCKET
  897. EXTLIBS += -lsocket
  898. endif
  899. ifdef NEEDS_NSL
  900. EXTLIBS += -lnsl
  901. endif
  902. ifdef NO_D_TYPE_IN_DIRENT
  903. BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
  904. endif
  905. ifdef NO_D_INO_IN_DIRENT
  906. BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
  907. endif
  908. ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
  909. BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
  910. endif
  911. ifdef USE_NSEC
  912. BASIC_CFLAGS += -DUSE_NSEC
  913. endif
  914. ifdef USE_ST_TIMESPEC
  915. BASIC_CFLAGS += -DUSE_ST_TIMESPEC
  916. endif
  917. ifdef NO_NSEC
  918. BASIC_CFLAGS += -DNO_NSEC
  919. endif
  920. ifdef NO_C99_FORMAT
  921. BASIC_CFLAGS += -DNO_C99_FORMAT
  922. endif
  923. ifdef SNPRINTF_RETURNS_BOGUS
  924. COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
  925. COMPAT_OBJS += compat/snprintf.o
  926. endif
  927. ifdef FREAD_READS_DIRECTORIES
  928. COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
  929. COMPAT_OBJS += compat/fopen.o
  930. endif
  931. ifdef NO_SYMLINK_HEAD
  932. BASIC_CFLAGS += -DNO_SYMLINK_HEAD
  933. endif
  934. ifdef NO_STRCASESTR
  935. COMPAT_CFLAGS += -DNO_STRCASESTR
  936. COMPAT_OBJS += compat/strcasestr.o
  937. endif
  938. ifdef NO_STRLCPY
  939. COMPAT_CFLAGS += -DNO_STRLCPY
  940. COMPAT_OBJS += compat/strlcpy.o
  941. endif
  942. ifdef NO_STRTOUMAX
  943. COMPAT_CFLAGS += -DNO_STRTOUMAX
  944. COMPAT_OBJS += compat/strtoumax.o
  945. endif
  946. ifdef NO_STRTOULL
  947. COMPAT_CFLAGS += -DNO_STRTOULL
  948. endif
  949. ifdef NO_SETENV
  950. COMPAT_CFLAGS += -DNO_SETENV
  951. COMPAT_OBJS += compat/setenv.o
  952. endif
  953. ifdef NO_MKDTEMP
  954. COMPAT_CFLAGS += -DNO_MKDTEMP
  955. COMPAT_OBJS += compat/mkdtemp.o
  956. endif
  957. ifdef NO_UNSETENV
  958. COMPAT_CFLAGS += -DNO_UNSETENV
  959. COMPAT_OBJS += compat/unsetenv.o
  960. endif
  961. ifdef NO_SYS_SELECT_H
  962. BASIC_CFLAGS += -DNO_SYS_SELECT_H
  963. endif
  964. ifdef NO_MMAP
  965. COMPAT_CFLAGS += -DNO_MMAP
  966. COMPAT_OBJS += compat/mmap.o
  967. else
  968. ifdef USE_WIN32_MMAP
  969. COMPAT_CFLAGS += -DUSE_WIN32_MMAP
  970. COMPAT_OBJS += compat/win32mmap.o
  971. endif
  972. endif
  973. ifdef NO_PREAD
  974. COMPAT_CFLAGS += -DNO_PREAD
  975. COMPAT_OBJS += compat/pread.o
  976. endif
  977. ifdef NO_FAST_WORKING_DIRECTORY
  978. BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
  979. endif
  980. ifdef NO_TRUSTABLE_FILEMODE
  981. BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
  982. endif
  983. ifdef NO_IPV6
  984. BASIC_CFLAGS += -DNO_IPV6
  985. endif
  986. ifdef NO_UINTMAX_T
  987. BASIC_CFLAGS += -Duintmax_t=uint32_t
  988. endif
  989. ifdef NO_SOCKADDR_STORAGE
  990. ifdef NO_IPV6
  991. BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
  992. else
  993. BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
  994. endif
  995. endif
  996. ifdef NO_INET_NTOP
  997. LIB_OBJS += compat/inet_ntop.o
  998. endif
  999. ifdef NO_INET_PTON
  1000. LIB_OBJS += compat/inet_pton.o
  1001. endif
  1002. ifdef NO_ICONV
  1003. BASIC_CFLAGS += -DNO_ICONV
  1004. endif
  1005. ifdef OLD_ICONV
  1006. BASIC_CFLAGS += -DOLD_ICONV
  1007. endif
  1008. ifdef NO_DEFLATE_BOUND
  1009. BASIC_CFLAGS += -DNO_DEFLATE_BOUND
  1010. endif
  1011. ifdef PPC_SHA1
  1012. SHA1_HEADER = "ppc/sha1.h"
  1013. LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
  1014. else
  1015. ifdef ARM_SHA1
  1016. SHA1_HEADER = "arm/sha1.h"
  1017. LIB_OBJS += arm/sha1.o arm/sha1_arm.o
  1018. else
  1019. ifdef MOZILLA_SHA1
  1020. SHA1_HEADER = "mozilla-sha1/sha1.h"
  1021. LIB_OBJS += mozilla-sha1/sha1.o
  1022. else
  1023. SHA1_HEADER = <openssl/sha.h>
  1024. EXTLIBS += $(LIB_4_CRYPTO)
  1025. endif
  1026. endif
  1027. endif
  1028. ifdef NO_PERL_MAKEMAKER
  1029. export NO_PERL_MAKEMAKER
  1030. endif
  1031. ifdef NO_HSTRERROR
  1032. COMPAT_CFLAGS += -DNO_HSTRERROR
  1033. COMPAT_OBJS += compat/hstrerror.o
  1034. endif
  1035. ifdef NO_MEMMEM
  1036. COMPAT_CFLAGS += -DNO_MEMMEM
  1037. COMPAT_OBJS += compat/memmem.o
  1038. endif
  1039. ifdef INTERNAL_QSORT
  1040. COMPAT_CFLAGS += -DINTERNAL_QSORT
  1041. COMPAT_OBJS += compat/qsort.o
  1042. endif
  1043. ifdef RUNTIME_PREFIX
  1044. COMPAT_CFLAGS += -DRUNTIME_PREFIX
  1045. endif
  1046. ifdef NO_PTHREADS
  1047. THREADED_DELTA_SEARCH =
  1048. BASIC_CFLAGS += -DNO_PTHREADS
  1049. else
  1050. EXTLIBS += $(PTHREAD_LIBS)
  1051. endif
  1052. ifdef THREADED_DELTA_SEARCH
  1053. BASIC_CFLAGS += -DTHREADED_DELTA_SEARCH
  1054. LIB_OBJS += thread-utils.o
  1055. endif
  1056. ifdef DIR_HAS_BSD_GROUP_SEMANTICS
  1057. COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
  1058. endif
  1059. ifdef NO_EXTERNAL_GREP
  1060. BASIC_CFLAGS += -DNO_EXTERNAL_GREP
  1061. endif
  1062. ifeq ($(TCLTK_PATH),)
  1063. NO_TCLTK=NoThanks
  1064. endif
  1065. ifeq ($(PERL_PATH),)
  1066. NO_PERL=NoThanks
  1067. endif
  1068. QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
  1069. QUIET_SUBDIR1 =
  1070. ifneq ($(findstring $(MAKEFLAGS),w),w)
  1071. PRINT_DIR = --no-print-directory
  1072. else # "make -w"
  1073. NO_SUBDIR = :
  1074. endif
  1075. ifneq ($(findstring $(MAKEFLAGS),s),s)
  1076. ifndef V
  1077. QUIET_CC = @echo ' ' CC $@;
  1078. QUIET_AR = @echo ' ' AR $@;
  1079. QUIET_LINK = @echo ' ' LINK $@;
  1080. QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
  1081. QUIET_GEN = @echo ' ' GEN $@;
  1082. QUIET_SUBDIR0 = +@subdir=
  1083. QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
  1084. $(MAKE) $(PRINT_DIR) -C $$subdir
  1085. export V
  1086. export QUIET_GEN
  1087. export QUIET_BUILT_IN
  1088. endif
  1089. endif
  1090. ifdef ASCIIDOC8
  1091. export ASCIIDOC8
  1092. endif
  1093. # Shell quote (do not use $(call) to accommodate ancient setups);
  1094. SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
  1095. ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
  1096. DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
  1097. bindir_SQ = $(subst ','\'',$(bindir))
  1098. bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
  1099. mandir_SQ = $(subst ','\'',$(mandir))
  1100. infodir_SQ = $(subst ','\'',$(infodir))
  1101. gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
  1102. template_dir_SQ = $(subst ','\'',$(template_dir))
  1103. htmldir_SQ = $(subst ','\'',$(htmldir))
  1104. prefix_SQ = $(subst ','\'',$(prefix))
  1105. SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
  1106. PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
  1107. TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
  1108. LIBS = $(GITLIBS) $(EXTLIBS)
  1109. BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
  1110. $(COMPAT_CFLAGS)
  1111. LIB_OBJS += $(COMPAT_OBJS)
  1112. ALL_CFLAGS += $(BASIC_CFLAGS)
  1113. ALL_LDFLAGS += $(BASIC_LDFLAGS)
  1114. export TAR INSTALL DESTDIR SHELL_PATH
  1115. ### Build rules
  1116. SHELL = $(SHELL_PATH)
  1117. all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
  1118. ifneq (,$X)
  1119. $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$p' -ef '$p$X' || $(RM) '$p';)
  1120. endif
  1121. all::
  1122. ifndef NO_TCLTK
  1123. $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
  1124. $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
  1125. endif
  1126. ifndef NO_PERL
  1127. $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
  1128. endif
  1129. $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1)
  1130. please_set_SHELL_PATH_to_a_more_modern_shell:
  1131. @$$(:)
  1132. shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
  1133. strip: $(PROGRAMS) git$X
  1134. $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
  1135. git.o: git.c common-cmds.h GIT-CFLAGS
  1136. $(QUIET_CC)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
  1137. '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
  1138. $(ALL_CFLAGS) -c $(filter %.c,$^)
  1139. git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
  1140. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
  1141. $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
  1142. builtin-help.o: builtin-help.c common-cmds.h GIT-CFLAGS
  1143. $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \
  1144. '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
  1145. '-DGIT_MAN_PATH="$(mandir_SQ)"' \
  1146. '-DGIT_INFO_PATH="$(infodir_SQ)"' $<
  1147. $(BUILT_INS): git$X
  1148. $(QUIET_BUILT_IN)$(RM) $@ && \
  1149. ln git$X $@ 2>/dev/null || \
  1150. ln -s git$X $@ 2>/dev/null || \
  1151. cp git$X $@
  1152. common-cmds.h: ./generate-cmdlist.sh command-list.txt
  1153. common-cmds.h: $(wildcard Documentation/git-*.txt)
  1154. $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
  1155. $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
  1156. $(QUIET_GEN)$(RM) $@ $@+ && \
  1157. sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
  1158. -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
  1159. -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
  1160. -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
  1161. -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
  1162. $@.sh >$@+ && \
  1163. chmod +x $@+ && \
  1164. mv $@+ $@
  1165. ifndef NO_PERL
  1166. $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
  1167. perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
  1168. $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
  1169. $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
  1170. $(QUIET_GEN)$(RM) $@ $@+ && \
  1171. INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
  1172. sed -e '1{' \
  1173. -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
  1174. -e ' h' \
  1175. -e ' s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
  1176. -e ' H' \
  1177. -e ' x' \
  1178. -e '}' \
  1179. -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
  1180. -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
  1181. $@.perl >$@+ && \
  1182. chmod +x $@+ && \
  1183. mv $@+ $@
  1184. gitweb/gitweb.cgi: gitweb/gitweb.perl
  1185. $(QUIET_GEN)$(RM) $@ $@+ && \
  1186. sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
  1187. -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
  1188. -e 's|++GIT_BINDIR++|$(bindir)|g' \
  1189. -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
  1190. -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
  1191. -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
  1192. -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
  1193. -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
  1194. -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
  1195. -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
  1196. -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
  1197. -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
  1198. -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
  1199. -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
  1200. -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
  1201. -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
  1202. -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
  1203. -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
  1204. -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
  1205. $< >$@+ && \
  1206. chmod +x $@+ && \
  1207. mv $@+ $@
  1208. git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
  1209. $(QUIET_GEN)$(RM) $@ $@+ && \
  1210. sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
  1211. -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
  1212. -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
  1213. -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \
  1214. -e '/@@GITWEB_CGI@@/d' \
  1215. -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
  1216. -e '/@@GITWEB_CSS@@/d' \
  1217. -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
  1218. $@.sh > $@+ && \
  1219. chmod +x $@+ && \
  1220. mv $@+ $@
  1221. else # NO_PERL
  1222. $(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
  1223. $(QUIET_GEN)$(RM) $@ $@+ && \
  1224. sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
  1225. -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
  1226. unimplemented.sh >$@+ && \
  1227. chmod +x $@+ && \
  1228. mv $@+ $@
  1229. endif # NO_PERL
  1230. configure: configure.ac
  1231. $(QUIET_GEN)$(RM) $@ $<+ && \
  1232. sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
  1233. $< > $<+ && \
  1234. autoconf -o $@ $<+ && \
  1235. $(RM) $<+
  1236. # These can record GIT_VERSION
  1237. git.o git.spec \
  1238. $(patsubst %.sh,%,$(SCRIPT_SH)) \
  1239. $(patsubst %.perl,%,$(SCRIPT_PERL)) \
  1240. : GIT-VERSION-FILE
  1241. %.o: %.c GIT-CFLAGS
  1242. $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
  1243. %.s: %.c GIT-CFLAGS
  1244. $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
  1245. %.o: %.S
  1246. $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
  1247. exec_cmd.o: exec_cmd.c GIT-CFLAGS
  1248. $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \
  1249. '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
  1250. '-DBINDIR="$(bindir_relative_SQ)"' \
  1251. '-DPREFIX="$(prefix_SQ)"' \
  1252. $<
  1253. builtin-init-db.o: builtin-init-db.c GIT-CFLAGS
  1254. $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
  1255. config.o: config.c GIT-CFLAGS
  1256. $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"' $<
  1257. http.o: http.c GIT-CFLAGS
  1258. $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $<
  1259. ifdef NO_EXPAT
  1260. http-walker.o: http-walker.c http.h GIT-CFLAGS
  1261. $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_EXPAT $<
  1262. endif
  1263. git-%$X: %.o $(GITLIBS)
  1264. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
  1265. git-imap-send$X: imap-send.o $(GITLIBS)
  1266. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
  1267. $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)
  1268. http.o http-walker.o http-push.o transport.o: http.h
  1269. git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
  1270. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
  1271. $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
  1272. $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
  1273. $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
  1274. builtin-revert.o wt-status.o: wt-status.h
  1275. $(LIB_FILE): $(LIB_OBJS)
  1276. $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
  1277. XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
  1278. xdiff/xmerge.o xdiff/xpatience.o
  1279. $(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
  1280. xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
  1281. $(XDIFF_LIB): $(XDIFF_OBJS)
  1282. $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
  1283. doc:
  1284. $(MAKE) -C Documentation all
  1285. man:
  1286. $(MAKE) -C Documentation man
  1287. html:
  1288. $(MAKE) -C Documentation html
  1289. info:
  1290. $(MAKE) -C Documentation info
  1291. pdf:
  1292. $(MAKE) -C Documentation pdf
  1293. TAGS:
  1294. $(RM) TAGS
  1295. $(FIND) . -name '*.[hcS]' -print | xargs etags -a
  1296. tags:
  1297. $(RM) tags
  1298. $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
  1299. cscope:
  1300. $(RM) cscope*
  1301. $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
  1302. ### Detect prefix changes
  1303. TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
  1304. $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
  1305. GIT-CFLAGS: .FORCE-GIT-CFLAGS
  1306. @FLAGS='$(TRACK_CFLAGS)'; \
  1307. if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
  1308. echo 1>&2 " * new build flags or prefix"; \
  1309. echo "$$FLAGS" >GIT-CFLAGS; \
  1310. fi
  1311. # We need to apply sq twice, once to protect from the shell
  1312. # that runs GIT-BUILD-OPTIONS, and then again to protect it
  1313. # and the first level quoting from the shell that runs "echo".
  1314. GIT-BUILD-OPTIONS: .FORCE-GIT-BUILD-OPTIONS
  1315. @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
  1316. @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
  1317. @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
  1318. @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
  1319. ### Detect Tck/Tk interpreter path changes
  1320. ifndef NO_TCLTK
  1321. TRACK_VARS = $(subst ','\'',-DTCLTK_PATH='$(TCLTK_PATH_SQ)')
  1322. GIT-GUI-VARS: .FORCE-GIT-GUI-VARS
  1323. @VARS='$(TRACK_VARS)'; \
  1324. if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
  1325. echo 1>&2 " * new Tcl/Tk interpreter location"; \
  1326. echo "$$VARS" >$@; \
  1327. fi
  1328. .PHONY: .FORCE-GIT-GUI-VARS
  1329. endif
  1330. ### Testing rules
  1331. TEST_PROGRAMS += test-chmtime$X
  1332. TEST_PROGRAMS += test-ctype$X
  1333. TEST_PROGRAMS += test-date$X
  1334. TEST_PROGRAMS += test-delta$X
  1335. TEST_PROGRAMS += test-dump-cache-tree$X
  1336. TEST_PROGRAMS += test-genrandom$X
  1337. TEST_PROGRAMS += test-match-trees$X
  1338. TEST_PROGRAMS += test-parse-options$X
  1339. TEST_PROGRAMS += test-path-utils$X
  1340. TEST_PROGRAMS += test-sha1$X
  1341. TEST_PROGRAMS += test-sigchain$X
  1342. all:: $(TEST_PROGRAMS)
  1343. # GNU make supports exporting all variables by "export" without parameters.
  1344. # However, the environment gets quite big, and some programs have problems
  1345. # with that.
  1346. export NO_SVN_TESTS
  1347. test: all
  1348. $(MAKE) -C t/ all
  1349. test-ctype$X: ctype.o
  1350. test-date$X: date.o ctype.o
  1351. test-delta$X: diff-delta.o patch-delta.o
  1352. test-parse-options$X: parse-options.o
  1353. .PRECIOUS: $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
  1354. test-%$X: test-%.o $(GITLIBS)
  1355. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
  1356. check-sha1:: test-sha1$X
  1357. ./test-sha1.sh
  1358. check: common-cmds.h
  1359. if sparse; \
  1360. then \
  1361. for i in *.c; \
  1362. do \
  1363. sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
  1364. done; \
  1365. else \
  1366. echo 2>&1 "Did you mean 'make test'?"; \
  1367. exit 1; \
  1368. fi
  1369. remove-dashes:
  1370. ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)
  1371. ### Installation rules
  1372. ifneq ($(filter /%,$(firstword $(template_dir))),)
  1373. template_instdir = $(template_dir)
  1374. else
  1375. template_instdir = $(prefix)/$(template_dir)
  1376. endif
  1377. export template_instdir
  1378. ifneq ($(filter /%,$(firstword $(gitexecdir))),)
  1379. gitexec_instdir = $(gitexecdir)
  1380. else
  1381. gitexec_instdir = $(prefix)/$(gitexecdir)
  1382. endif
  1383. gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
  1384. export gitexec_instdir
  1385. install: all
  1386. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
  1387. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
  1388. $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
  1389. $(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X git-shell$X git-cvsserver '$(DESTDIR_SQ)$(bindir_SQ)'
  1390. $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
  1391. $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
  1392. ifndef NO_TCLTK
  1393. $(MAKE) -C gitk-git install
  1394. $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
  1395. endif
  1396. ifneq (,$X)
  1397. $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)
  1398. endif
  1399. bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
  1400. execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
  1401. { $(RM) "$$execdir/git-add$X" && \
  1402. ln "$$bindir/git$X" "$$execdir/git-add$X" 2>/dev/null || \
  1403. cp "$$bindir/git$X" "$$execdir/git-add$X"; } && \
  1404. { for p in $(filter-out git-add$X,$(BUILT_INS)); do \
  1405. $(RM) "$$execdir/$$p" && \
  1406. ln "$$execdir/git-add$X" "$$execdir/$$p" 2>/dev/null || \
  1407. ln -s "git-add$X" "$$execdir/$$p" 2>/dev/null || \
  1408. cp "$$execdir/git-add$X" "$$execdir/$$p" || exit; \
  1409. done } && \
  1410. ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
  1411. install-doc:
  1412. $(MAKE) -C Documentation install
  1413. install-man:
  1414. $(MAKE) -C Documentation install-man
  1415. install-html:
  1416. $(MAKE) -C Documentation install-html
  1417. install-info:
  1418. $(MAKE) -C Documentation install-info
  1419. install-pdf:
  1420. $(MAKE) -C Documentation install-pdf
  1421. quick-install-doc:
  1422. $(MAKE) -C Documentation quick-install
  1423. quick-install-man:
  1424. $(MAKE) -C Documentation quick-install-man
  1425. quick-install-html:
  1426. $(MAKE) -C Documentation quick-install-html
  1427. ### Maintainer's dist rules
  1428. git.spec: git.spec.in
  1429. sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+
  1430. mv $@+ $@
  1431. GIT_TARNAME=git-$(GIT_VERSION)
  1432. dist: git.spec git-archive$(X) configure
  1433. ./git-archive --format=tar \
  1434. --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
  1435. @mkdir -p $(GIT_TARNAME)
  1436. @cp git.spec configure $(GIT_TARNAME)
  1437. @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
  1438. @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
  1439. $(TAR) rf $(GIT_TARNAME).tar \
  1440. $(GIT_TARNAME)/git.spec \
  1441. $(GIT_TARNAME)/configure \
  1442. $(GIT_TARNAME)/version \
  1443. $(GIT_TARNAME)/git-gui/version
  1444. @$(RM) -r $(GIT_TARNAME)
  1445. gzip -f -9 $(GIT_TARNAME).tar
  1446. rpm: dist
  1447. $(RPMBUILD) -ta $(GIT_TARNAME).tar.gz
  1448. htmldocs = git-htmldocs-$(GIT_VERSION)
  1449. manpages = git-manpages-$(GIT_VERSION)
  1450. dist-doc:
  1451. $(RM) -r .doc-tmp-dir
  1452. mkdir .doc-tmp-dir
  1453. $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
  1454. cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
  1455. gzip -n -9 -f $(htmldocs).tar
  1456. :
  1457. $(RM) -r .doc-tmp-dir
  1458. mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
  1459. $(MAKE) -C Documentation DESTDIR=./ \
  1460. man1dir=../.doc-tmp-dir/man1 \
  1461. man5dir=../.doc-tmp-dir/man5 \
  1462. man7dir=../.doc-tmp-dir/man7 \
  1463. install
  1464. cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
  1465. gzip -n -9 -f $(manpages).tar
  1466. $(RM) -r .doc-tmp-dir
  1467. ### Cleaning rules
  1468. distclean: clean
  1469. $(RM) configure
  1470. clean:
  1471. $(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \
  1472. $(LIB_FILE) $(XDIFF_LIB)
  1473. $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
  1474. $(RM) $(TEST_PROGRAMS)
  1475. $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
  1476. $(RM) -r autom4te.cache
  1477. $(RM) config.log config.mak.autogen config.mak.append config.status config.cache
  1478. $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
  1479. $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
  1480. $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
  1481. $(MAKE) -C Documentation/ clean
  1482. ifndef NO_PERL
  1483. $(RM) gitweb/gitweb.cgi
  1484. $(MAKE) -C perl clean
  1485. endif
  1486. $(MAKE) -C templates/ clean
  1487. $(MAKE) -C t/ clean
  1488. ifndef NO_TCLTK
  1489. $(MAKE) -C gitk-git clean
  1490. $(MAKE) -C git-gui clean
  1491. endif
  1492. $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
  1493. .PHONY: all install clean strip
  1494. .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
  1495. .PHONY: .FORCE-GIT-VERSION-FILE TAGS tags cscope .FORCE-GIT-CFLAGS
  1496. .PHONY: .FORCE-GIT-BUILD-OPTIONS
  1497. ### Check documentation
  1498. #
  1499. check-docs::
  1500. @(for v in $(ALL_PROGRAMS) $(BUILT_INS) git gitk; \
  1501. do \
  1502. case "$$v" in \
  1503. git-merge-octopus | git-merge-ours | git-merge-recursive | \
  1504. git-merge-resolve | git-merge-subtree | \
  1505. git-fsck-objects | git-init-db | \
  1506. git-?*--?* ) continue ;; \
  1507. esac ; \
  1508. test -f "Documentation/$$v.txt" || \
  1509. echo "no doc: $$v"; \
  1510. sed -e '/^#/d' command-list.txt | \
  1511. grep -q "^$$v[ ]" || \
  1512. case "$$v" in \
  1513. git) ;; \
  1514. *) echo "no link: $$v";; \
  1515. esac ; \
  1516. done; \
  1517. ( \
  1518. sed -e '/^#/d' \
  1519. -e 's/[ ].*//' \
  1520. -e 's/^/listed /' command-list.txt; \
  1521. ls -1 Documentation/git*txt | \
  1522. sed -e 's|Documentation/|documented |' \
  1523. -e 's/\.txt//'; \
  1524. ) | while read how cmd; \
  1525. do \
  1526. case "$$how,$$cmd" in \
  1527. *,git-citool | \
  1528. *,git-gui | \
  1529. *,git-help | \
  1530. documented,gitattributes | \
  1531. documented,gitignore | \
  1532. documented,gitmodules | \
  1533. documented,gitcli | \
  1534. documented,git-tools | \
  1535. documented,gitcore-tutorial | \
  1536. documented,gitcvs-migration | \
  1537. documented,gitdiffcore | \
  1538. documented,gitglossary | \
  1539. documented,githooks | \
  1540. documented,gitrepository-layout | \
  1541. documented,gittutorial | \
  1542. documented,gittutorial-2 | \
  1543. sentinel,not,matching,is,ok ) continue ;; \
  1544. esac; \
  1545. case " $(ALL_PROGRAMS) $(BUILT_INS) git gitk " in \
  1546. *" $$cmd "*) ;; \
  1547. *) echo "removed but $$how: $$cmd" ;; \
  1548. esac; \
  1549. done ) | sort
  1550. ### Make sure built-ins do not have dups and listed in git.c
  1551. #
  1552. check-builtins::
  1553. ./check-builtins.sh
  1554. ### Test suite coverage testing
  1555. #
  1556. .PHONY: coverage coverage-clean coverage-build coverage-report
  1557. coverage:
  1558. $(MAKE) coverage-build
  1559. $(MAKE) coverage-report
  1560. coverage-clean:
  1561. rm -f *.gcda *.gcno
  1562. COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
  1563. COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
  1564. coverage-build: coverage-clean
  1565. $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
  1566. $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
  1567. -j1 test
  1568. coverage-report:
  1569. gcov -b *.c
  1570. grep '^function.*called 0 ' *.c.gcov \
  1571. | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
  1572. | tee coverage-untested-functions