Makeconfig 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493
  1. # Copyright (C) 1991-2026 Free Software Foundation, Inc.
  2. # Copyright The GNU Toolchain Authors.
  3. # This file is part of the GNU C Library.
  4. # The GNU C Library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Lesser General Public
  6. # License as published by the Free Software Foundation; either
  7. # version 2.1 of the License, or (at your option) any later version.
  8. # The GNU C Library is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. # Lesser General Public License for more details.
  12. # You should have received a copy of the GNU Lesser General Public
  13. # License along with the GNU C Library; if not, see
  14. # <https://www.gnu.org/licenses/>.
  15. #
  16. # Makefile configuration options for the GNU C library.
  17. #
  18. ifneq (,)
  19. This makefile requires GNU Make.
  20. endif
  21. all: # Make this the default goal
  22. ifneq "$(origin +included-Makeconfig)" "file"
  23. +included-Makeconfig := yes
  24. ifdef subdir
  25. .. := ../
  26. endif
  27. # $(common-objdir) is the place to put objects and
  28. # such that are not specific to a single subdir.
  29. ifdef objdir
  30. objpfx := $(patsubst %//,%/,$(objdir)/$(subdir)/)
  31. common-objpfx = $(objdir)/
  32. common-objdir = $(objdir)
  33. else
  34. $(error objdir must be defined by the build-directory Makefile)
  35. endif
  36. # Did we request 'make -s' run? "yes" or "no".
  37. # Starting from make-4.4 MAKEFLAGS now contains long
  38. # options like '--shuffle'. To detect presence of 's'
  39. # we pick first word with short options. Long options
  40. # are guaranteed to come after whitespace. We use '-'
  41. # prefix to always have a word before long options
  42. # even if no short options were passed.
  43. # Typical MAKEFLAGS values to watch for:
  44. # "rs --shuffle=42" (silent)
  45. # " --shuffle" (not silent)
  46. ifeq ($(findstring s, $(firstword -$(MAKEFLAGS))),)
  47. silent-make := no
  48. else
  49. silent-make := yes
  50. endif
  51. # Root of the sysdeps tree.
  52. sysdep_dir := $(..)sysdeps
  53. export sysdep_dir := $(sysdep_dir)
  54. # Get the values defined by options to `configure'.
  55. include $(common-objpfx)config.make
  56. # What flags to give to sources which call user provided callbacks
  57. uses-callbacks = -fexceptions
  58. # What flags to give to tests which test stack alignment
  59. stack-align-test-flags =
  60. # Complete path to sysdep dirs.
  61. # `configure' writes a definition of `config-sysdirs' in `config.make'.
  62. sysdirs := $(foreach D,$(config-sysdirs),$(firstword $(filter /%,$D) $(..)$D))
  63. +sysdep_dirs = $(sysdirs)
  64. ifdef objdir
  65. +sysdep_dirs := $(objdir) $(+sysdep_dirs)
  66. endif
  67. # Run config.status to update config.make and config.h. We don't show the
  68. # dependence of config.h to Make, because it is only touched when it
  69. # changes and so config.status would be run every time; the dependence of
  70. # config.make should suffice to force regeneration and re-exec, and the new
  71. # image will notice if config.h changed.
  72. $(common-objpfx)config.make: $(common-objpfx)config.status \
  73. $(..)config.make.in $(..)config.h.in
  74. cd $(<D); $(SHELL) $(<F)
  75. # Find all the sysdeps configure fragments, to make sure we re-run
  76. # configure when any of them changes.
  77. $(common-objpfx)config.status: $(..)version.h $(..)configure \
  78. $(foreach dir,$(sysdirs),\
  79. $(wildcard $(dir)/Implies) \
  80. $(patsubst %.ac,%,\
  81. $(firstword $(wildcard \
  82. $(addprefix $(dir)/,configure configure.ac))))) \
  83. $(patsubst %.ac,%,\
  84. $(wildcard $(..)sysdeps/*/preconfigure $(..)sysdeps/*/preconfigure.ac))
  85. @cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
  86. echo The GNU C library has not been configured. >&2; \
  87. echo Run \`configure\' to configure it before building. >&2; \
  88. echo Try \`configure --help\' for more details. >&2; \
  89. exit 1; fi
  90. # We don't want CPPFLAGS to be exported to the command running configure.
  91. unexport CPPFLAGS
  92. # Get the user's configuration parameters.
  93. ifneq ($(wildcard $(..)configparms),)
  94. include $(..)configparms
  95. endif
  96. ifneq ($(objpfx),)
  97. ifneq ($(wildcard $(common-objpfx)configparms),)
  98. include $(common-objpfx)configparms
  99. endif
  100. endif
  101. ####
  102. #### These are the configuration variables. You can define values for
  103. #### the variables below in the file `configparms'.
  104. #### Do NOT edit this file.
  105. ####
  106. # Common prefix for machine-independent installation directories.
  107. ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
  108. prefix = /usr/local
  109. endif
  110. # Decide whether we shall build the programs or not. We always do this
  111. # unless the user tells us (in configparms) or we are building for a
  112. # standalone target.
  113. ifndef build-programs
  114. ifneq ($(config-os),none)
  115. build-programs=yes
  116. else
  117. build-programs=no
  118. endif
  119. endif
  120. # Common prefix for machine-dependent installation directories.
  121. ifeq ($(origin exec_prefix),undefined)
  122. exec_prefix = $(prefix)
  123. endif
  124. # Where to install the library and object files.
  125. ifndef libdir
  126. libdir = $(exec_prefix)/lib
  127. endif
  128. inst_libdir = $(install_root)$(libdir)
  129. # Where to install the shared library.
  130. ifndef slibdir
  131. slibdir = $(exec_prefix)/lib
  132. endif
  133. inst_slibdir = $(install_root)$(slibdir)
  134. # Where to install the dynamic linker.
  135. ifndef rtlddir
  136. rtlddir = $(slibdir)
  137. endif
  138. inst_rtlddir = $(install_root)$(rtlddir)
  139. # Prefix to put on files installed in $(libdir). For libraries `libNAME.a',
  140. # the prefix is spliced between `lib' and the name, so the linker switch
  141. # `-l$(libprefix)NAME' finds the library; for other files the prefix is
  142. # just prepended to the whole file name.
  143. ifeq ($(origin libprefix),undefined)
  144. libprefix =
  145. endif
  146. # Where to install the header files.
  147. ifndef includedir
  148. includedir = $(prefix)/include
  149. endif
  150. inst_includedir = $(install_root)$(includedir)
  151. # Where to install machine-independent data files.
  152. # These are the timezone database, and the locale database.
  153. ifndef datadir
  154. datadir = $(prefix)/share
  155. endif
  156. inst_datadir = $(install_root)$(datadir)
  157. # Where to install the timezone data files (which are machine-independent).
  158. ifndef zonedir
  159. zonedir = $(datadir)/zoneinfo
  160. endif
  161. inst_zonedir = $(install_root)$(zonedir)
  162. # Where to install the compiled binary locale archive and compiled
  163. # binary locale files.
  164. ifndef complocaledir
  165. complocaledir = $(libdir)/locale
  166. endif
  167. inst_complocaledir = $(install_root)$(complocaledir)
  168. # Where to install the message catalog data files (which are
  169. # machine-independent).
  170. ifndef localedir
  171. localedir = $(datadir)/locale
  172. endif
  173. inst_localedir = $(install_root)$(localedir)
  174. # Where to install the locale charmap source files.
  175. ifndef i18ndir
  176. i18ndir = $(datadir)/i18n
  177. endif
  178. inst_i18ndir = $(install_root)$(i18ndir)
  179. # Where to install the shared object for charset transformation.
  180. ifndef gconvdir
  181. gconvdir = $(libdir)/gconv
  182. endif
  183. inst_gconvdir = $(install_root)$(gconvdir)
  184. # Where to install programs.
  185. ifndef bindir
  186. bindir = $(exec_prefix)/bin
  187. endif
  188. inst_bindir = $(install_root)$(bindir)
  189. # Where to install internal programs.
  190. ifndef libexecdir
  191. libexecdir = $(exec_prefix)/libexec
  192. endif
  193. inst_libexecdir = $(install_root)$(libexecdir)
  194. # Where to install administrative programs.
  195. ifndef rootsbindir
  196. rootsbindir = $(exec_prefix)/sbin
  197. endif
  198. inst_rootsbindir = $(install_root)$(rootsbindir)
  199. ifndef sbindir
  200. sbindir = $(exec_prefix)/sbin
  201. endif
  202. inst_sbindir = $(install_root)$(sbindir)
  203. # Where to install the Info files.
  204. ifndef infodir
  205. infodir = $(prefix)/info
  206. endif
  207. inst_infodir = $(install_root)$(infodir)
  208. # Where to install audit libraries.
  209. ifndef auditdir
  210. auditdir = $(libdir)/audit
  211. endif
  212. inst_auditdir = $(install_root)$(auditdir)
  213. # Where to install default configuration files. These include the local
  214. # timezone specification and network data base files.
  215. ifndef sysconfdir
  216. sysconfdir = $(prefix)/etc
  217. endif
  218. inst_sysconfdir = $(install_root)$(sysconfdir)
  219. # Directory for the database files and Makefile for nss_db.
  220. ifndef vardbdir
  221. vardbdir = $(localstatedir)/db
  222. endif
  223. inst_vardbdir = $(install_root)$(vardbdir)
  224. # Where to install the "localtime" timezone file; this is the file whose
  225. # contents $(localtime) specifies. If this is a relative pathname, it is
  226. # relative to $(zonedir). It is a good idea to put this somewhere
  227. # other than there, so the zoneinfo directory contains only universal data,
  228. # localizing the configuration data elsewhere.
  229. ifndef localtime-file
  230. localtime-file = $(sysconfdir)/localtime
  231. endif
  232. # What to use for leap second specifications in compiling the default
  233. # timezone files. Set this to `/dev/null' for no leap second handling as
  234. # 1003.1 requires, or to `leapseconds' for proper leap second handling.
  235. # Both zone flavors are always available as `posix/ZONE' and `right/ZONE'.
  236. # This variable determines the default: if it's `/dev/null',
  237. # ZONE==posix/ZONE; if it's `leapseconds', ZONE==right/ZONE.
  238. ifndef leapseconds
  239. leapseconds = /dev/null
  240. endif
  241. # What timezone's DST rules should be used when a POSIX-style TZ
  242. # environment variable doesn't specify any rules. For 1003.1 compliance
  243. # this timezone must use rules that are as U.S. federal law defines DST.
  244. # Run `make -C time echo-zonenames' to see a list of available zone names.
  245. # This setting can be changed with `zic -p TIMEZONE' at any time.
  246. # If you want POSIX.1 compatibility, use `America/New_York'.
  247. ifndef posixrules
  248. posixrules = America/New_York
  249. endif
  250. # Where to install the "posixrules" timezone file; this is file
  251. # whose contents $(posixrules) specifies. If this is a relative
  252. # pathname, it is relative to $(zonedir).
  253. ifndef posixrules-file
  254. posixrules-file = posixrules
  255. endif
  256. # Directory where your system's native header files live.
  257. # This is used on Unix systems to generate some GNU libc header files.
  258. ifndef sysincludedir
  259. sysincludedir = /usr/include
  260. endif
  261. # Commands to install files.
  262. ifndef INSTALL_DATA
  263. INSTALL_DATA = $(INSTALL) -m 644
  264. endif
  265. ifndef INSTALL_SCRIPT
  266. INSTALL_SCRIPT = $(INSTALL)
  267. endif
  268. ifndef INSTALL_PROGRAM
  269. INSTALL_PROGRAM = $(INSTALL)
  270. endif
  271. ifndef INSTALL
  272. INSTALL = install
  273. endif
  274. # The name of the C compiler.
  275. # If you've got GCC, and it works, use it.
  276. ifeq ($(origin CC),default)
  277. CC := gcc
  278. endif
  279. # The name of the C compiler to use for compilations of programs to run on
  280. # the host that is building the library. If you set CC to a
  281. # cross-compiler, you must set this to the normal compiler.
  282. ifndef BUILD_CC
  283. BUILD_CC = $(CC)
  284. endif
  285. # Default flags to pass the C compiler.
  286. ifndef default_cflags
  287. ifeq ($(release),stable)
  288. default_cflags := -g -O2
  289. else
  290. default_cflags := -g -O
  291. endif
  292. endif
  293. # Flags to pass the C compiler when assembling preprocessed assembly code
  294. # (`.S' files).
  295. ifndef asm-CPPFLAGS
  296. asm-CPPFLAGS =
  297. endif
  298. # Must be supported by the linker.
  299. no-whole-archive = -Wl,--no-whole-archive
  300. whole-archive = -Wl,--whole-archive
  301. # Installed name of the startup code.
  302. # The ELF convention is that the startfile is called crt1.o
  303. start-installed-name = crt1.o
  304. # Similar to crt1.o, but without _IO_stdin_used.
  305. start-name-2.0 = crt1-2.0.o
  306. # On systems that do not need a special startfile for statically linked
  307. # binaries, simply set it to the normal name.
  308. ifndef static-start-installed-name
  309. static-start-installed-name = $(start-installed-name)
  310. endif
  311. ifeq (yes,$(enable-static-pie))
  312. # Link with rcrt1.o, instead of crt1.o, to call _dl_relocate_static_pie
  313. # to relocate static PIE.
  314. real-static-start-installed-name = r$(static-start-installed-name)
  315. else
  316. real-static-start-installed-name = $(static-start-installed-name)
  317. endif
  318. relro-LDFLAGS = -Wl,-z,relro
  319. LDFLAGS.so += $(relro-LDFLAGS)
  320. LDFLAGS-rtld += $(relro-LDFLAGS)
  321. # Linker options to enable and disable DT_RELR.
  322. ifeq ($(have-dt-relr),yes)
  323. dt-relr-ldflag = -Wl,-z,pack-relative-relocs
  324. no-dt-relr-ldflag = -Wl,-z,nopack-relative-relocs
  325. else
  326. dt-relr-ldflag =
  327. no-dt-relr-ldflag =
  328. endif
  329. ifeq (no,$(build-pie-default))
  330. pie-default = $(no-pie-ccflag)
  331. else # build-pie-default
  332. pic-default = -DPIC
  333. # Compile libc.a and libc_p.a with -fPIE/-fpie for static PIE.
  334. pie-default = $(pie-ccflag)
  335. ifeq (yes,$(enable-static-pie))
  336. static-pie-dt-relr-ldflag = $(dt-relr-ldflag)
  337. ifeq (yes,$(have-static-pie))
  338. static-pie-ldflag = -static-pie
  339. else
  340. # Static PIE can't have dynamic relocations in read-only segments since
  341. # static PIE is mapped into memory by kernel. --eh-frame-hdr is needed
  342. # for PIE to support exception.
  343. static-pie-ldflag = -Wl,-pie,--no-dynamic-linker,--eh-frame-hdr,-z,text
  344. endif # have-static-pie
  345. endif # enable-static-pie
  346. endif # build-pie-default
  347. # If lazy relocations are disabled, add the -z now flag. Use
  348. # LDFLAGS-lib.so instead of LDFLAGS.so, to avoid adding the flag to
  349. # test modules.
  350. ifeq ($(bind-now),yes)
  351. LDFLAGS-lib.so += -Wl,-z,now
  352. # Extra flags for dynamically linked non-test main programs.
  353. link-extra-flags += -Wl,-z,now
  354. endif
  355. # Command to run after every final link (executable or shared object).
  356. # This is invoked with $(call after-link,...), so it should operate on
  357. # the file $1. This can be set to do some sort of post-processing on
  358. # binaries, or to perform some sort of static sanity check.
  359. ifndef after-link
  360. after-link =
  361. endif
  362. # Additional libraries to link into every test.
  363. link-extra-libs-tests = $(libsupport)
  364. # Command for linking PIE programs with the C library.
  365. ifndef +link-pie
  366. +link-pie-before-inputs = $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \
  367. $(if $($(@F)-no-dt-relr),$(no-dt-relr-ldflag),$(dt-relr-ldflag)) \
  368. -Wl,-O1 -nostdlib -nostartfiles \
  369. $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
  370. $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
  371. $(firstword $(CRT-$(@F)) $(csu-objpfx)S$(start-installed-name)) \
  372. $(+preinit) $(+prectorS)
  373. +link-pie-before-libc = -o $@ $(+link-pie-before-inputs) \
  374. $(filter-out $(addprefix $(csu-objpfx),start.o \
  375. S$(start-installed-name))\
  376. $(+preinit) $(link-extra-libs) \
  377. $(common-objpfx)libc% $(+postinit) \
  378. $(+nolink-deps),$^) \
  379. $(link-extra-libs)
  380. +link-pie-after-libc = $(+postctorS) $(+postinit)
  381. define +link-pie
  382. $(CC) $(link-libc-rpath-link) $(+link-pie-before-libc) $(rtld-LDFLAGS) \
  383. $(link-extra-flags) $(link-libc) $(+link-pie-after-libc)
  384. $(call after-link,$@)
  385. endef
  386. define +link-pie-tests
  387. $(CC) $(+link-pie-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
  388. $(+link-pie-after-libc)
  389. $(call after-link,$@)
  390. endef
  391. define +link-pie-printers-tests
  392. $(CC) $(+link-pie-before-libc) $(built-rtld-LDFLAGS) \
  393. $(link-libc-printers-tests) $(+link-pie-after-libc)
  394. $(call after-link,$@)
  395. endef
  396. endif
  397. # Command for statically linking programs with the C library.
  398. ifndef +link-static
  399. +link-static-before-inputs = -nostdlib -nostartfiles -static \
  400. $(if $($(@F)-no-pie),$(no-pie-ldflag),$(static-pie-ldflag)) \
  401. $(if $($(@F)-no-dt-relr),$(no-dt-relr-ldflag),$(static-pie-dt-relr-ldflag)) \
  402. $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
  403. $(firstword $(CRT-$(@F)) $(csu-objpfx)$(real-static-start-installed-name)) \
  404. $(+preinit) $(+prectorT)
  405. +link-static-before-libc = -o $@ $(+link-static-before-inputs) \
  406. $(filter-out $(addprefix $(csu-objpfx),start.o \
  407. $(start-installed-name))\
  408. $(+preinit) $(link-extra-libs-static) \
  409. $(common-objpfx)libc% $(+postinit) \
  410. $(+nolink-deps), $^) \
  411. $(link-extra-libs-static)
  412. +link-static-after-libc = $(+postctorT) $(+postinit)
  413. define +link-static
  414. $(CC) $(+link-static-before-libc) $(link-extra-flags) $(link-libc-static) \
  415. $(+link-static-after-libc)
  416. $(call after-link,$@)
  417. endef
  418. define +link-static-tests
  419. $(CC) $(+link-static-before-libc) $(link-libc-static-tests) \
  420. $(+link-static-after-libc)
  421. $(call after-link,$@)
  422. endef
  423. endif
  424. # Commands for linking programs with the C library.
  425. ifndef +link
  426. ifeq (yes,$(build-shared))
  427. ifeq (yes,$(cc-pie-default))
  428. no-pie-ldflag = -no-pie
  429. endif
  430. ifeq (yes,$(build-pie-default))
  431. +link = $(+link-pie)
  432. +link-tests = $(+link-pie-tests)
  433. +link-tests-before-inputs = $(+link-pie-before-inputs) $(rtld-tests-LDFLAGS)
  434. +link-tests-after-inputs = $(link-libc-tests) $(+link-pie-after-libc)
  435. +link-printers-tests = $(+link-pie-printers-tests)
  436. else # not build-pie-default
  437. +link-before-inputs = -nostdlib -nostartfiles $(no-pie-ldflag) \
  438. $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
  439. $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
  440. $(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \
  441. $(+preinit) $(+prector)
  442. +link-before-libc = -o $@ $(+link-before-inputs) \
  443. $(filter-out $(addprefix $(csu-objpfx),start.o \
  444. $(start-installed-name))\
  445. $(+preinit) $(link-extra-libs) \
  446. $(common-objpfx)libc% $(+postinit) \
  447. $(+nolink-deps),$^) \
  448. $(link-extra-libs)
  449. +link-after-libc = $(+postctor) $(+postinit)
  450. define +link
  451. $(CC) $(link-libc-rpath-link) $(+link-before-libc) $(rtld-LDFLAGS) \
  452. $(link-extra-flags) $(link-libc) $(+link-after-libc)
  453. $(call after-link,$@)
  454. endef
  455. +link-tests-before-inputs = $(+link-before-inputs) $(rtld-tests-LDFLAGS)
  456. +link-tests-after-inputs = $(link-libc-tests) $(+link-after-libc)
  457. define +link-tests
  458. $(CC) $(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
  459. $(+link-after-libc)
  460. $(call after-link,$@)
  461. endef
  462. define +link-printers-tests
  463. $(CC) $(+link-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \
  464. $(+link-after-libc)
  465. $(call after-link,$@)
  466. endef
  467. endif # build-pie-default
  468. else # build-static
  469. +link = $(+link-static)
  470. +link-tests = $(+link-static-tests)
  471. +link-tests-before-inputs = $(+link-static-before-inputs)
  472. +link-tests-after-inputs = $(link-libc-static-tests) $(+link-static-after-libc)
  473. +link-printers-tests = $(+link-static-tests)
  474. endif # build-shared
  475. endif # +link
  476. # Command for linking test programs with crt1.o from glibc 2.0.
  477. +link-2.0-before-inputs = -nostdlib -nostartfiles $(no-pie-ldflag) \
  478. $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
  479. $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
  480. $(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-name-2.0)) \
  481. $(+preinit) $(+prector)
  482. +link-2.0-before-libc = -o $@ $(+link-2.0-before-inputs) \
  483. $(filter-out $(addprefix $(csu-objpfx),start.o \
  484. $(start-name-2.0))\
  485. $(+preinit) $(link-extra-libs) \
  486. $(common-objpfx)libc% $(+postinit) \
  487. $(+nolink-deps),$^) \
  488. $(link-extra-libs)
  489. +link-after-libc = $(+postctor) $(+postinit)
  490. define +link-2.0-tests
  491. $(CC) $(+link-2.0-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
  492. $(+link-after-libc)
  493. $(call after-link,$@)
  494. endef
  495. # The pretty printer test programs need to be compiled without optimizations
  496. # so they won't confuse gdb. We could use either the 'GCC optimize' pragma
  497. # or the 'optimize' function attribute to achieve this; however, at least on
  498. # ARM, gcc always produces different debugging symbols when invoked with
  499. # a -O greater than 0 than when invoked with -O0, regardless of anything else
  500. # we're using to suppress optimizations. Therefore, we need to explicitly pass
  501. # -O0 to it through CFLAGS. As a result, any fortification needs to be disabled
  502. # as it needs -O greater than 0.
  503. # Additionally, the build system will try to -include $(common-objpfx)/config.h
  504. # when compiling the tests, which will throw an error if some special macros
  505. # (such as __OPTIMIZE__ and IS_IN_build) aren't defined. To avoid this, we
  506. # tell gcc to define IS_IN_build.
  507. CFLAGS-printers-tests := -O0 -ggdb3 -DIS_IN_build $(no-fortify-source)
  508. ifeq (yes,$(build-shared))
  509. # These indicate whether to link using the built ld.so or the installed one.
  510. installed-rtld-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name)
  511. built-rtld-LDFLAGS = -Wl,-dynamic-linker=$(elf-objpfx)ld.so
  512. ifndef rtld-LDFLAGS
  513. rtld-LDFLAGS = $(installed-rtld-LDFLAGS)
  514. endif
  515. ifndef rtld-tests-LDFLAGS
  516. ifeq (yes,$(build-hardcoded-path-in-tests))
  517. rtld-tests-LDFLAGS = $(built-rtld-LDFLAGS)
  518. else
  519. rtld-tests-LDFLAGS = $(installed-rtld-LDFLAGS)
  520. endif # build-hardcoded-path-in-tests
  521. endif # rtld-tests-LDFLAGS
  522. endif # build-shared
  523. ifndef link-libc
  524. ifeq (yes,$(build-shared))
  525. # We need the versioned name of libc.so in the deps of $(others) et al
  526. # so that the symlink to libc.so is created before anything tries to
  527. # run the linked programs.
  528. link-libc-rpath = -Wl,-rpath=$(rpath-link)
  529. link-libc-rpath-link = -Wl,-rpath-link=$(rpath-link)
  530. # For programs which are not tests, $(link-libc-rpath-link) is added
  531. # directly in $(+link), $(+link-pie) above, so that -Wl,-rpath-link
  532. # comes before the expansion of LDLIBS-* and affects libraries added
  533. # there. For shared objects, -Wl,-rpath-link is added via
  534. # $(build-shlib-helper) and $(build-module-helper) in Makerules (also
  535. # before the expansion of LDLIBS-* variables).
  536. # Tests use -Wl,-rpath instead of -Wl,-rpath-link for
  537. # build-hardcoded-path-in-tests. Add -Wl,--disable-new-dtags to force
  538. # DT_RPATH instead of DT_RUNPATH which only applies to DT_NEEDED entries
  539. # in the executable and doesn't applies to DT_NEEDED entries in shared
  540. # libraries which are loaded via DT_NEEDED entries in the executable.
  541. ifeq (yes,$(build-hardcoded-path-in-tests))
  542. link-libc-tests-rpath-link = $(link-libc-rpath) -Wl,--disable-new-dtags
  543. link-test-modules-rpath-link = $(link-libc-rpath) -Wl,--disable-new-dtags
  544. else
  545. link-libc-tests-rpath-link = $(link-libc-rpath-link)
  546. link-test-modules-rpath-link =
  547. endif # build-hardcoded-path-in-tests
  548. link-libc-between-gnulib = $(common-objpfx)libc.so$(libc.so-version) \
  549. $(common-objpfx)$(patsubst %,$(libtype.oS),c) \
  550. -Wl,--as-needed $(elf-objpfx)ld.so \
  551. -Wl,--no-as-needed
  552. link-libc = $(link-libc-between-gnulib) $(gnulib)
  553. link-libc-tests-after-rpath-link = $(gnulib-tests) $(link-libc-between-gnulib) $(gnulib-tests)
  554. link-libc-tests = $(link-libc-tests-rpath-link) \
  555. $(link-libc-tests-after-rpath-link)
  556. # Pretty printer test programs always require rpath instead of rpath-link.
  557. link-libc-printers-tests = $(link-libc-rpath) \
  558. $(link-libc-tests-after-rpath-link)
  559. # This is how to find at build-time things that will be installed there.
  560. rpath-dirs = math elf dlfcn nss nis rt resolv mathvec support misc debug
  561. rpath-link = \
  562. $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%))):$(gnulib-extralibdir)
  563. else # build-static
  564. link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
  565. link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests)
  566. endif # build-shared
  567. endif # link-libc
  568. # Differences in the linkers on the various platforms.
  569. LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN'
  570. LDFLAGS-soname-fname = -Wl,-soname,$(@F)
  571. LDFLAGS-rdynamic = -rdynamic
  572. LDFLAGS-Bsymbolic = -Bsymbolic
  573. # Choose the default search path for the dynamic linker based on
  574. # where we will install libraries.
  575. ifneq ($(libdir),$(slibdir))
  576. default-rpath = $(slibdir):$(libdir)
  577. else
  578. default-rpath = $(libdir)
  579. endif
  580. ifndef link-extra-libs
  581. link-extra-libs = $(LDLIBS-$(@F))
  582. link-extra-libs-static = $(link-extra-libs)
  583. endif
  584. # The static libraries.
  585. link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group
  586. link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib-tests) -Wl,--end-group
  587. # How to link against libgcc. Some libgcc functions, such as those
  588. # for "long long" arithmetic or software floating point, can always be
  589. # built without use of C library headers and do not have any global
  590. # state so can safely be linked statically into any executable or
  591. # shared library requiring them; these functions are in libgcc.a.
  592. # Other functions, relating to exception handling, may require C
  593. # library headers to build and it may not be safe to have more than
  594. # one copy of them in a process; these functions are only in
  595. # libgcc_s.so and libgcc_eh.a.
  596. #
  597. # To avoid circular dependencies when bootstrapping, it is desirable
  598. # to avoid use of libgcc_s and libgcc_eh in building glibc. Where any
  599. # glibc functionality (in particular, thread cancellation) requires
  600. # exception handling, this is implemented through dlopen of libgcc_s
  601. # to avoid unnecessary dependencies on libgcc_s by programs not using
  602. # that functionality; executables built with glibc do not use
  603. # exception handling other than through thread cancellation.
  604. #
  605. # Undefined references to functions from libgcc_eh or libgcc_s may
  606. # arise for code built with -fexceptions. In the case of statically
  607. # linked programs installed by glibc, unwinding will never actually
  608. # occur at runtime and the use of elf/static-stubs.c to resolve these
  609. # references is safe. In the case of statically linked test programs
  610. # and test programs built with -fexceptions, unwinding may occur in
  611. # some cases and it is preferable to link with libgcc_eh or libgcc_s
  612. # so that the testing is as similar as possible to how programs will
  613. # be built with the installed glibc.
  614. # This leads to moderate difficulties, also since distributions may
  615. # install libgcc_s.so in directories only found via ld.so.conf, e.g.
  616. # to be able to switch between gcc versions. We need to add the
  617. # corresponding directory to the library search path to make sure
  618. # our test programs can find it.
  619. #
  620. # Some architectures have architecture-specific systems for exception
  621. # handling that may involve undefined references to
  622. # architecture-specific functions. On those architectures,
  623. # gnulib-arch and static-gnulib-arch may be defined in sysdeps
  624. # makefiles to use additional libraries for linking executables and
  625. # shared libraries built by glibc.
  626. ifndef gnulib
  627. ifneq ($(have-cc-with-libunwind),yes)
  628. libunwind =
  629. else
  630. libunwind = -lunwind
  631. endif
  632. libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
  633. gnulib-arch =
  634. gnulib = -lgcc $(gnulib-arch)
  635. gnulib-tests := -lgcc $(libgcc_eh)
  636. gnulib-extralibdir = $(dir $(shell $(CC) -print-file-name=libgcc_s.so$(libgcc_s.so-version)))
  637. static-gnulib-arch =
  638. # By default, elf/static-stubs.o, instead of -lgcc_eh, is used to
  639. # statically link programs. When --disable-shared is used, we use
  640. # -lgcc_eh since elf/static-stubs.o isn't sufficient.
  641. ifeq (yes,$(build-shared))
  642. static-gnulib = -lgcc $(static-gnulib-arch)
  643. else
  644. static-gnulib = -lgcc -lgcc_eh $(static-gnulib-arch)
  645. endif
  646. static-gnulib-tests := -lgcc -lgcc_eh $(libunwind)
  647. libc.so-gnulib := -lgcc
  648. endif
  649. +preinit = $(addprefix $(csu-objpfx),crti.o)
  650. +postinit = $(addprefix $(csu-objpfx),crtn.o)
  651. +prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o`
  652. +postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
  653. # Variants of the two previous definitions for linking PIE programs.
  654. +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
  655. +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
  656. # Variants of the two previous definitions for statically linking programs.
  657. static-prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
  658. static-postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
  659. ifeq (yes,$(enable-static-pie))
  660. # Static PIE must use PIE variants.
  661. +prectorT = $(if $($(@F)-no-pie),$(static-prector),$(+prectorS))
  662. +postctorT = $(if $($(@F)-no-pie),$(static-postctor),$(+postctorS))
  663. else
  664. +prectorT = $(static-prector)
  665. +postctorT =$(static-postctor)
  666. endif
  667. csu-objpfx = $(common-objpfx)csu/
  668. elf-objpfx = $(common-objpfx)elf/
  669. # A command that, prepended to the name and arguments of a program,
  670. # and run on the build system, causes that program with those
  671. # arguments to be run on the host for which the library is built.
  672. ifndef test-wrapper
  673. test-wrapper =
  674. endif
  675. # Likewise, but the name of the program is preceded by
  676. # <variable>=<value> assignments for environment variables.
  677. ifndef test-wrapper-env
  678. test-wrapper-env = $(test-wrapper) env
  679. endif
  680. # Likewise, but the program's environment will be empty except for any
  681. # explicit <variable>=<value> assignments preceding the program name.
  682. ifndef test-wrapper-env-only
  683. test-wrapper-env-only = $(test-wrapper) env -i
  684. endif
  685. # Whether to run test programs built for the library's host system.
  686. ifndef run-built-tests
  687. ifeq (yes|,$(cross-compiling)|$(test-wrapper))
  688. run-built-tests = no
  689. else
  690. run-built-tests = yes
  691. endif
  692. endif
  693. # Whether to build the static math tests
  694. ifndef build-math-static-tests
  695. build-math-static-tests = no
  696. endif
  697. # Whether to stop immediately when a test fails. Nonempty means to
  698. # stop, empty means not to stop.
  699. ifndef stop-on-test-failure
  700. stop-on-test-failure =
  701. endif
  702. # How to run a program we just linked with our library.
  703. # The program binary is assumed to be $(word 2,$^).
  704. # We may require additional libraries from gcc (e.g. libgcc_s.so for exception
  705. # handling), which unfortunately somewhat breaks the isolation.
  706. built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
  707. rtld-prefix = $(elf-objpfx)$(rtld-installed-name) \
  708. --library-path \
  709. $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)):$(gnulib-extralibdir)
  710. ifeq (yes,$(build-shared))
  711. comma = ,
  712. sysdep-library-path = \
  713. $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
  714. $(filter -Wl$(comma)-rpath-link=%,\
  715. $(sysdep-LDFLAGS)))))
  716. # $(run-via-rtld-prefix) is a command that, when prepended to the name
  717. # of a program built with the newly built library, produces a command
  718. # that, executed on the host for which the library is built, runs that
  719. # program. For tests listed in tests-static or xtests-static, it is
  720. # empty.
  721. run-via-rtld-prefix = \
  722. $(if $(strip $(filter $(notdir $(built-program-file)), \
  723. $(tests-static) $(xtests-static))),, $(rtld-prefix))
  724. else
  725. run-via-rtld-prefix =
  726. endif
  727. # $(run-program-env) is the default environment variable settings to
  728. # use when running a program built with the newly built library.
  729. run-program-env = GCONV_PATH=$(common-objpfx)iconvdata \
  730. LOCPATH=$(common-objpfx)localedata LC_ALL=C
  731. # $(run-program-prefix) is a command that, when prepended to the name
  732. # of a program built with the newly built library, produces a command
  733. # that, executed on the build system on which "make" is run, runs that
  734. # program. $(run-program-prefix-before-env) and
  735. # $(run-program-prefix-after-env) are similar, but separate parts
  736. # before and after a list of environment variables.
  737. run-program-prefix-before-env = $(test-wrapper-env)
  738. run-program-prefix-after-env = $(run-via-rtld-prefix)
  739. run-program-prefix = $(run-program-prefix-before-env) $(run-program-env) \
  740. $(run-program-prefix-after-env)
  741. # $(built-program-cmd) is a command that, executed on the build system
  742. # on which "make" is run, runs the newly built program that is the
  743. # second dependency of the makefile target in which
  744. # $(built-program-cmd) is used. $(built-program-cmd-before-env) and
  745. # $(built-program-cmd-after-env) are similar, before and after a list
  746. # of environment variables.
  747. built-program-cmd-before-env = $(test-wrapper-env)
  748. built-program-cmd-after-env = $(run-via-rtld-prefix) $(built-program-file)
  749. built-program-cmd = $(built-program-cmd-before-env) $(run-program-env) \
  750. $(built-program-cmd-after-env)
  751. # $(host-built-program-cmd) is a command that, executed on the host
  752. # for which the library is built, runs the newly built program that is
  753. # the second dependency of the makefile target in which
  754. # $(host-built-program-cmd) is used.
  755. host-built-program-cmd = $(run-via-rtld-prefix) $(built-program-file)
  756. # $(ld-library-path) is the common content to be set in LD_LIBRARY_PATH
  757. # for running static binaries that may load dynamic objects.
  758. ld-library-path = $(objpfx):$(common-objpfx)$(addprefix :,$(sysdep-ld-library-path))
  759. ifndef LD
  760. LD := ld -X
  761. endif
  762. # $(test-via-rtld-prefix) is a command that, when prepended to the name
  763. # of a test program built with the newly built library, produces a command
  764. # that, executed on the host for which the library is built, runs that
  765. # program. For tests listed in tests-static or xtests-static as well
  766. # as when test programs are hardcoded to the newly built libraries, it
  767. # is empty.
  768. # $(test-program-prefix) is a command that, when prepended to the name
  769. # of a test program built with the newly built library, produces a command
  770. # that, executed on the build system on which "make" is run, runs that
  771. # test program. $(test-program-prefix-before-env) and
  772. # $(test-program-prefix-after-env) are similar, before and after a
  773. # list of environment variables.
  774. # $(test-program-cmd) is a command that, executed on the build system
  775. # on which "make" is run, runs the newly built test program that is the
  776. # second dependency of the makefile target in which
  777. # $(test-program-cmd) is used. $(test-program-cmd-before-env) and
  778. # $(test-program-cmd-after-env) are similar, before and after a list
  779. # of environment variables.
  780. # $(host-test-program-cmd) is a command that, executed on the host
  781. # for which the library is built, runs the newly built test program that
  782. # is the second dependency of the makefile target in which
  783. # $(host-test-program-cmd) is used.
  784. ifeq (yes,$(build-hardcoded-path-in-tests))
  785. test-via-rtld-prefix =
  786. test-program-prefix-before-env = $(test-wrapper-env)
  787. test-program-prefix-after-env =
  788. test-program-prefix = $(test-program-prefix-before-env) $(run-program-env) \
  789. $(test-program-prefix-after-env)
  790. test-program-cmd-before-env = $(test-wrapper-env)
  791. test-program-cmd-after-env = $(built-program-file)
  792. test-program-cmd = $(test-program-cmd-before-env) $(run-program-env) \
  793. $(test-program-cmd-after-env)
  794. host-test-program-cmd = $(built-program-file)
  795. else
  796. test-via-rtld-prefix = $(run-via-rtld-prefix)
  797. test-program-prefix-before-env = $(run-program-prefix-before-env)
  798. test-program-prefix-after-env = $(run-program-prefix-after-env)
  799. test-program-prefix = $(run-program-prefix)
  800. test-program-cmd-before-env = $(built-program-cmd-before-env)
  801. test-program-cmd-after-env = $(built-program-cmd-after-env)
  802. test-program-cmd = $(built-program-cmd)
  803. host-test-program-cmd = $(host-built-program-cmd)
  804. endif
  805. # Extra flags to pass to GCC.
  806. +gccwarn := -Wall -Wwrite-strings -Wundef $(cc-option-wimplicit-fallthrough)
  807. ifeq ($(enable-werror),yes)
  808. +gccwarn += -Werror
  809. endif
  810. +gccwarn-c = -Wstrict-prototypes -Wold-style-definition \
  811. $(cc-option-wfree-labels) $(cc-option-wmissing-parameter-name)
  812. # We do not depend on the address of constants in different files to be
  813. # actually different, so allow the compiler to merge them all.
  814. +merge-constants = -fmerge-all-constants
  815. # We have to assume that glibc functions are called in any rounding
  816. # mode and also change the rounding mode in a few functions. So,
  817. # disable any optimization that assume default rounding mode.
  818. +math-flags = -frounding-math
  819. # We have to assume that glibc functions might generate user-visible traps.
  820. +math-flags += -ftrapping-math
  821. # Logically only "libnldbl", "nonlib" and "testsuite" should be using
  822. # -fno-math-errno. However due to GCC bug #88576, only "libm" and
  823. # "libmvec" can use -fno-math-errno.
  824. +extra-math-flags = $(if $(filter libmvec libm,$(in-module)),\
  825. -fno-math-errno,-fmath-errno)
  826. # Use 64 bit time_t support for installed programs
  827. installed-modules = nonlib nscd ldconfig locale_programs \
  828. iconvprogs libnss_files libnss_compat libnss_db libnss_hesiod \
  829. libutil libpcprofile libnsl
  830. +extra-time-flags = $(if $(filter $(installed-modules),\
  831. $(in-module)),-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64)
  832. # We might want to compile with some stack-protection flag.
  833. ifneq ($(stack-protector),)
  834. +stack-protector=$(stack-protector)
  835. endif
  836. # Some routines are unsafe to build with stack-protection since they're called
  837. # before the stack check guard is set up. Provide a way to disable stack
  838. # protector. The first argument is the extension (.o, .os, .oS) and the second
  839. # is a list of routines that this path should be applied to.
  840. define elide-stack-protector
  841. $(if $(filter $(@F),$(patsubst %,%$(1),$(2))), $(no-stack-protector))
  842. endef
  843. # We might want to compile with fortify-source
  844. ifneq ($(fortify-source),)
  845. +fortify-source=$(fortify-source)
  846. endif
  847. # Some routine can't be fortified like the ones used by fortify
  848. define elide-fortify-source
  849. $(if $(filter $(@F),$(patsubst %,%$(1),$(2))), $(no-fortify-source))
  850. endef
  851. # The program that makes Emacs-style TAGS files.
  852. ETAGS := etags
  853. # The `xgettext' program for producing .pot files from sources.
  854. ifndef XGETTEXT
  855. XGETTEXT = xgettext
  856. endif
  857. # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
  858. # perhaps others) to preprocess assembly code in some cases.
  859. M4 = m4
  860. # To force installation of files even if they are older than the
  861. # installed files. This variable is included in the dependency list
  862. # of all installation targets.
  863. ifeq ($(force-install),yes)
  864. +force = force-install
  865. else
  866. +force =
  867. endif
  868. ####
  869. #### End of configuration variables.
  870. ####
  871. # This tells some versions of GNU make before 3.63 not to export all variables.
  872. .NOEXPORT:
  873. # We want to echo the commands we're running without
  874. # umpteen zillion filenames along with it (we use `...' instead)
  875. # but we don't want this echoing done when the user has said
  876. # he doesn't want to see commands echoed by using -s.
  877. ifeq ($(silent-make),yes) # if -s
  878. +cmdecho := echo >/dev/null
  879. else # not -s
  880. +cmdecho := echo
  881. endif # -s
  882. # These are the flags given to the compiler to tell
  883. # it what sort of optimization and/or debugging output to do.
  884. ifndef +cflags
  885. # If `CFLAGS' was defined, use that.
  886. ifdef CFLAGS
  887. +cflags := $(filter-out -I%,$(CFLAGS))
  888. endif # CFLAGS
  889. endif # +cflags
  890. # If none of the above worked, default to "-g -O".
  891. ifeq "$(strip $(+cflags))" ""
  892. +cflags := $(default_cflags)
  893. endif # $(+cflags) == ""
  894. # Force building with -fno-common because hidden_def, compat_symbol
  895. # and other constructs do not work for common symbols (and would
  896. # otherwise require specifying __attribute__ ((nocommon)) on a
  897. # case-by-case basis).
  898. +cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags) \
  899. $(+stack-protector) -fno-common
  900. +gcc-nowarn := -w
  901. # We must filter out elf because the early bootstrap of the dynamic loader
  902. # cannot be fortified. Likewise we exclude dlfcn because it is entangled
  903. # with the loader. We must filter out csu because early startup, like the
  904. # loader, cannot be fortified. Lastly debug is the fortification routines
  905. # themselves and they cannot be fortified.
  906. do-fortify = $(filter-out elf dlfcn csu debug,$(subdir))
  907. ifeq ($(do-fortify),$(subdir))
  908. +cflags += $(+fortify-source)
  909. else
  910. +cflags += $(no-fortify-source)
  911. endif
  912. # Filter out LFS flags if compiler defines it by default.
  913. +cflags += $(no-file-offset-bits-source)
  914. # Filter out 64 bit time_t flags if compiler defines it by default.
  915. +cflags += $(no-time-bits-source)
  916. # Enable SFrame while compiling for stack backtracing.
  917. ifeq ($(enable-gsframe),yes)
  918. as-sframe = -Wa,--gsframe
  919. endif
  920. +cflags += $(as-sframe)
  921. # Each sysdeps directory can contain header files that both will be
  922. # used to compile and will be installed. Each can also contain an
  923. # include/ subdirectory, whose header files will be used to compile
  924. # but will not be installed, and will take precedence over the
  925. # installed files. This mirrors the top-level include/ subdirectory.
  926. +sysdep-includes := $(foreach dir,$(+sysdep_dirs),\
  927. $(addprefix -I,$(wildcard $(dir)/include) $(dir)))
  928. # These are flags given to the C compiler to tell it to look for
  929. # include files (including ones given in angle brackets) in the parent
  930. # library source directory, in the include directory, and in the
  931. # current directory.
  932. +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
  933. $(+sysdep-includes) $(includes) \
  934. $(patsubst %/,-I%,$(..)) $(libio-include) \
  935. $(if $($(<F)-no-include-dot),,-I.) $(sysincludes)
  936. # Since libio has several internal header files, we use a -I instead
  937. # of many little headers in the include directory.
  938. libio-include = -I$(..)libio
  939. # List of non-library modules that we build.
  940. built-modules = iconvprogs iconvdata ldconfig libmemusage \
  941. libpcprofile librpcsvc locale-programs \
  942. memusagestat nonlib nscd extramodules libnldbl libsupport \
  943. testsuite testsuite-internal
  944. in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \
  945. $(libof-$(<F)) \
  946. $(libof-$(@F)) \
  947. libc))
  948. # Build ld.so, libc.so and libpthread.so with -ftls-model=initial-exec
  949. tls-model = $(if $(filter libpthread rtld \
  950. libc,$(in-module)),-ftls-model=initial-exec,)
  951. module-cppflags-real = -include $(common-objpfx)libc-modules.h \
  952. -DMODULE_NAME=$(in-module)
  953. # We don't need libc-modules.h and the MODULE_NAME definition for .v.i
  954. # files. These targets don't (and will likely never need to) use the IS_IN
  955. # facility. In fact, shlib-versions should not use it because that will
  956. # create a circular dependency as libc-modules.h is generated from
  957. # shlib-versions.
  958. module-cppflags = $(if $(filter %.mk.i %.v.i,$(@F)),,$(module-cppflags-real))
  959. # These are the variables that the implicit compilation rules use.
  960. # Note that we can't use -std=* in CPPFLAGS, because it overrides
  961. # the implicit -lang-asm and breaks cpp behavior for .S files--notably
  962. # it causes cpp to stop predefining __ASSEMBLER__.
  963. CPPFLAGS = $(config-extra-cppflags) $(CPPFLAGS-config) \
  964. $($(subdir)-CPPFLAGS) \
  965. $(+includes) $(defines) $(module-cppflags) \
  966. -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
  967. $(CPPFLAGS-$(suffix $@)) \
  968. $(foreach lib,$(libof-$(basename $(@F))) \
  969. $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
  970. $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F))) \
  971. -DTOP_NAMESPACE=glibc
  972. override CFLAGS = -std=gnu11 -fgnu89-inline $(config-extra-cflags) \
  973. $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
  974. $(+extra-math-flags) $(+extra-time-flags) \
  975. $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
  976. $(CFLAGS-$(@F)) $(tls-model) \
  977. $(foreach lib,$(libof-$(basename $(@F))) \
  978. $(libof-$(<F)) $(libof-$(@F)),$(CFLAGS-$(lib)))
  979. # Use our copies of cstdlib and cmath.
  980. override CXXFLAGS = -I$(common-objpfx) $(c++-sysincludes) \
  981. $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
  982. $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
  983. # If everything is compiled with -fPIC (implicitly) we must tell this by
  984. # defining the PIC symbol.
  985. ifeq (yes,$(build-pic-default))
  986. pic-default = -DPIC
  987. endif
  988. # Enable object files for different versions of the library.
  989. # Various things use $(object-suffixes) to know what all to make.
  990. # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
  991. # to pass different flags for each flavor.
  992. libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
  993. # .op may be added to all-object-suffixes below.
  994. all-object-suffixes := .o .os .oS
  995. object-suffixes :=
  996. CPPFLAGS-.o = $(pic-default)
  997. # libc.a must be compiled with -fPIE/-fpie for static PIE.
  998. CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) $(pie-default)
  999. CFLAGS-.o += $(call elide-fortify-source,.o,$(routines_no_fortify))
  1000. CFLAGS-.o += $(call elide-fortify-source,_chk.o,$(routines_no_fortify))
  1001. libtype.o := lib%.a
  1002. object-suffixes += .o
  1003. ifeq (yes,$(build-shared))
  1004. # Under --enable-shared, we will build a shared library of PIC objects.
  1005. # The PIC object files are named foo.os.
  1006. object-suffixes += .os
  1007. pic-cppflags = -DPIC -DSHARED
  1008. CPPFLAGS-.os = $(pic-cppflags)
  1009. CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
  1010. CFLAGS-.os += $(call elide-fortify-source,.os,$(routines_no_fortify))
  1011. CFLAGS-.os += $(call elide-fortify-source,_chk.os,$(routines_no_fortify))
  1012. libtype.os := lib%_pic.a
  1013. # This can be changed by a sysdep makefile
  1014. pic-ccflag = -fPIC
  1015. # This one should always stay like this unless there is a very good reason.
  1016. PIC-ccflag = -fPIC
  1017. endif
  1018. # This can be changed by a sysdep makefile
  1019. pie-ccflag = -fPIE
  1020. no-pie-ccflag = -fno-pie
  1021. # This one should always stay like this unless there is a very good reason.
  1022. PIE-ccflag = -fPIE
  1023. ifeq (yes,$(build-profile))
  1024. # Under --enable-profile, we will build a static library of profiled objects.
  1025. # The profiled object files are named foo.op.
  1026. all-object-suffixes += .op
  1027. object-suffixes += .op
  1028. CPPFLAGS-.op = -DPROF $(pic-default)
  1029. # libc_p.a must be compiled with -fPIE/-fpie for static PIE.
  1030. CFLAGS-.op = -pg $(pie-default)
  1031. CFLAGS-.op += $(call elide-fortify-source,.op,$(routines_no_fortify))
  1032. CFLAGS-.op += $(call elide-fortify-source,_chk.op,$(routines_no_fortify))
  1033. libtype.op = lib%_p.a
  1034. endif
  1035. # Convenience variable for when we want to treat shared-library cases
  1036. # differently from the rest.
  1037. object-suffixes-noshared := $(filter-out .os,$(object-suffixes))
  1038. object-suffixes-for-libc := $(object-suffixes)
  1039. ifeq (yes,$(build-shared))
  1040. # Build special library that contains the static-only routines for libc.
  1041. object-suffixes-for-libc += .oS
  1042. # Must build the routines as PIC, though, because they can end up in (users')
  1043. # shared objects. We don't want to use CFLAGS-os because users may, for
  1044. # example, make that processor-specific.
  1045. CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) $(extra-nonshared-cflags)
  1046. CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
  1047. libtype.oS = lib%_nonshared.a
  1048. endif
  1049. # The assembler can generate debug information too.
  1050. ifndef ASFLAGS
  1051. ASFLAGS := $(filter -g% -fdebug-prefix-map=% -m%,$(CFLAGS))
  1052. endif
  1053. override ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu) $(as-sframe)
  1054. move-if-change = $(SHELL) $(..)scripts/move-if-change
  1055. -include $(common-objpfx)sysd-sorted
  1056. subdirs = $(sorted-subdirs)
  1057. subdir-srcdirs = $(foreach dir,$(subdirs),\
  1058. $(firstword $($(dir)-srcdir) $(..)$(dir)))
  1059. # This is a pair of implicit rules to preprocess a file with # comments,
  1060. # %ifdef et al, based on config.h settings or other %include'd files.
  1061. # We use chained rules instead of a pipeline here so that we can properly
  1062. # check the exit status of cpp rather than using its bad output when there
  1063. # is a preprocessing error. Another rule should depend on the output file
  1064. # `FOO.v', and along with that `FOO.v.i' should be given dependencies
  1065. # listing both its input files, and any header files that it may reference
  1066. # (but no commands).
  1067. %.v.i: $(common-objpfx)config.h $(..)Makeconfig
  1068. sed '/^[ ]*%/!s/#.*$$//;/^[ ]*$$/d;s/^[ ]*%/#/' \
  1069. $(filter-out FORCE %.h $(..)Makeconfig,$^) \
  1070. | $(CC) -E -undef $(CPPFLAGS) -x assembler-with-cpp - \
  1071. > $@T
  1072. mv -f $@T $@
  1073. %.v: %.v.i
  1074. sed '/^[ ]*#/d;/^[ ]*$$/d' $< > $@T
  1075. mv -f $@T $@
  1076. ifeq (yes, $(build-shared))
  1077. # To generate a header to support more than one ABI for different
  1078. # architecture variants, the CPU/Makefile defines abi-variants to be a
  1079. # list of names for those variants (e.g. 32 64), and, for each variant,
  1080. # defines abi-$(variant)-condition to be the condition for those options
  1081. # to use in a C #if condition. abi-includes may be defined to a list of
  1082. # headers to include in the generated header, if the default does not
  1083. # suffice. default-abi is defined to be the ABI for the current glibc
  1084. # build.
  1085. ifndef abi-includes
  1086. abi-includes := bits/wordsize.h
  1087. endif
  1088. # Process the shlib-versions file, which tells us what shared library
  1089. # version numbers to use when we install shared objects on this system.
  1090. # We need to wait until $(subdirs) is complete.
  1091. ifeq ($(sysd-sorted-done),t)
  1092. -include $(common-objpfx)soversions.mk
  1093. ifndef avoid-generated
  1094. $(common-objpfx)shlib-versions.v.i: \
  1095. $(wildcard $(+sysdep_dirs:=/shlib-versions) \
  1096. $(subdir-srcdirs:=/shlib-versions)) \
  1097. $(..)shlib-versions
  1098. $(common-objpfx)soversions.i: $(..)scripts/soversions.awk \
  1099. $(common-objpfx)shlib-versions.v
  1100. $(AWK) -f $^ > $@T
  1101. mv -f $@T $@
  1102. $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig
  1103. (while read which lib number setname; do \
  1104. eval seen_$$which=1; \
  1105. test x"$$which" = xDEFAULT || continue; \
  1106. case $$number in \
  1107. [0-9]*) echo "$$lib.so-version=.$$number"; \
  1108. echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\
  1109. *) echo "$$lib.so-version=$$number"; \
  1110. echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\
  1111. esac; \
  1112. done; \
  1113. echo soversions.mk-done = t;) < $< > $@T; exit 0
  1114. mv -f $@T $@
  1115. endif
  1116. endif
  1117. postclean-generated += soversions.mk soversions.i \
  1118. shlib-versions.v shlib-versions.v.i
  1119. before-compile += $(common-objpfx)libc-modules.h
  1120. common-generated += libc-modules.h libc-modules.stmp
  1121. ifeq ($(soversions.mk-done),t)
  1122. # Generate a header with macro definitions for use with the IS_IN macro.
  1123. # These are the possible values for the MODULE_NAME macro defined when building
  1124. # sources, to identify which module the translation unit is going to be built
  1125. # into.
  1126. $(common-objpfx)libc-modules.h: $(common-objpfx)libc-modules.stmp; @:
  1127. $(common-objpfx)libc-modules.stmp: $(..)scripts/gen-libc-modules.awk \
  1128. $(common-objpfx)soversions.i
  1129. $(AWK) -v buildlist="$(subst -,_,$(built-modules))" -f $^ > ${@:stmp=T}
  1130. $(move-if-change) ${@:stmp=T} ${@:stmp=h}
  1131. touch $@
  1132. endif
  1133. # Build the tunables list header early since it could be used by any module in
  1134. # glibc.
  1135. before-compile += $(common-objpfx)dl-tunable-list.h
  1136. common-generated += dl-tunable-list.h dl-tunable-list.stmp
  1137. $(common-objpfx)dl-tunable-list.h: $(common-objpfx)dl-tunable-list.stmp; @:
  1138. $(common-objpfx)dl-tunable-list.stmp: \
  1139. $(..)scripts/gen-tunables.awk \
  1140. $(..)elf/dl-tunables.list \
  1141. $(wildcard $(subdirs:%=$(..)%/dl-tunables.list)) \
  1142. $(wildcard $(sysdirs:%=%/dl-tunables.list))
  1143. LC_ALL=C $(AWK) -f $^ > ${@:stmp=T}
  1144. $(move-if-change) ${@:stmp=T} ${@:stmp=h}
  1145. touch $@
  1146. # Dump the GCC macros used by the default compiler flags to a header
  1147. # file, so that they can be inspected when using different compiler
  1148. # flags. Add the GCCMACRO prefix to make these macro names unique.
  1149. $(common-objpfx)gcc-macros.h.in: $(common-objpfx)config.status
  1150. $(CC) $(CFLAGS) $(CPPFLAGS) -E -dM -x c -o $@ /dev/null
  1151. $(common-objpfx)gcc-macros.h: $(common-objpfx)gcc-macros.h.in
  1152. sed 's/^#define /#define GCCMACRO/' < $< > $@
  1153. before-compile += $(common-objpfx)gcc-macros.h
  1154. # Generate version maps, but wait until sysdep-subdirs is known
  1155. ifeq ($(sysd-sorted-done),t)
  1156. ifeq ($(build-shared),yes)
  1157. -include $(common-objpfx)sysd-versions
  1158. -include $(common-objpfx)Versions.mk
  1159. $(addprefix $(common-objpfx),$(version-maps)): $(common-objpfx)sysd-versions
  1160. common-generated += $(version-maps)
  1161. postclean-generated += sysd-versions Versions.all abi-versions.h \
  1162. Versions.def Versions.v.i Versions.v Versions.mk
  1163. ifndef avoid-generated
  1164. ifneq ($(sysd-versions-subdirs),$(sorted-subdirs) $(config-sysdirs))
  1165. sysd-versions-force = FORCE
  1166. FORCE:
  1167. endif
  1168. $(common-objpfx)Versions.def: $(..)scripts/versionlist.awk \
  1169. $(common-objpfx)Versions.v
  1170. LC_ALL=C $(AWK) -f $^ > $@T
  1171. mv -f $@T $@
  1172. $(common-objpfx)Versions.all: $(..)scripts/firstversions.awk \
  1173. $(common-objpfx)soversions.i \
  1174. $(common-objpfx)Versions.def
  1175. { while read which lib version setname; do \
  1176. test x"$$which" = xDEFAULT || continue; \
  1177. test -z "$$setname" || echo "$$lib : $$setname"; \
  1178. done < $(word 2,$^); \
  1179. cat $(word 3,$^); \
  1180. } | LC_ALL=C $(AWK) -f $< > $@T
  1181. mv -f $@T $@
  1182. $(common-objpfx)Versions.mk: $(..)scripts/haveversions.awk \
  1183. $(common-objpfx)Versions.all
  1184. $(AWK) -f $^ > $@T
  1185. mv -f $@T $@
  1186. # See %.v/%.v.i implicit rules in Makeconfig.
  1187. $(common-objpfx)Versions.v.i: $(wildcard $(subdirs:%=$(..)%/Versions)) \
  1188. $(wildcard $(sysdirs:%=%/Versions)) \
  1189. $(sysd-versions-force)
  1190. $(common-objpfx)sysd-versions: $(common-objpfx)versions.stmp
  1191. $(common-objpfx)versions.stmp: $(common-objpfx)Versions.all \
  1192. $(common-objpfx)Versions.v \
  1193. $(..)scripts/versions.awk
  1194. ( echo 'sysd-versions-subdirs = $(subdirs) $(config-sysdirs)' ; \
  1195. cat $(word 2,$^) \
  1196. | LC_ALL=C $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \
  1197. -v move_if_change='$(move-if-change)' \
  1198. -f $(word 3,$^); \
  1199. ) > $(common-objpfx)sysd-versionsT
  1200. mv -f $(common-objpfx)sysd-versionsT $(common-objpfx)sysd-versions
  1201. touch $@
  1202. endif # avoid-generated
  1203. endif # $(build-shared) = yes
  1204. -include $(common-objpfx)time64-compat.mk
  1205. postclean-generated += time64-compat.mk
  1206. $(common-objpfx)time64-compat.mk: $(common-objpfx)time64-compat.mk.i \
  1207. $(sysd-versions-force)
  1208. sed '/^[ ]*#/d;/^[ ]*$$/d' $< > $@T
  1209. mv -f $@T $@
  1210. $(common-objpfx)time64-compat.mk.i: $(..)Makeconfig
  1211. printf "#include <time64-compat.h>\n#ifdef TIME64_NON_DEFAULT\nhave-time64-compat = yes\n#endif" \
  1212. | $(CC) -E -undef $(CPPFLAGS) -x assembler-with-cpp - > $@T
  1213. mv -f $@T $@
  1214. endif # sysd-sorted-done
  1215. # The name under which the run-time dynamic linker is installed.
  1216. # We are currently going for the convention that `/lib/ld.so.1'
  1217. # names the SVR4/ELF ABI-compliant dynamic linker.
  1218. ifndef rtld-installed-name
  1219. ifdef ld.so-version
  1220. rtld-installed-name = $(ld.so-version)
  1221. else
  1222. rtld-installed-name = ld.so.1
  1223. endif
  1224. endif
  1225. ifndef rtld-version-installed-name
  1226. rtld-version-installed-name = ld-$(version).so
  1227. endif
  1228. endif # build-shared
  1229. ifeq ($(build-shared),yes)
  1230. libm = $(common-objpfx)math/libm.so$(libm.so-version)
  1231. libmvec = $(common-objpfx)mathvec/libmvec.so$(libmvec.so-version)
  1232. else
  1233. libm = $(common-objpfx)math/libm.a
  1234. libmvec = $(common-objpfx)mathvec/libmvec.a
  1235. endif
  1236. ifeq ($(build-shared),yes)
  1237. libsupport = $(common-objpfx)support/libsupport_nonshared.a
  1238. else
  1239. libsupport = $(common-objpfx)support/libsupport.a
  1240. endif
  1241. # This is a partial list of subdirectories containing the library source.
  1242. # The order is more or less arbitrary. The sorting step will take care of the
  1243. # dependencies and generate sorted-subdirs dynamically.
  1244. all-subdirs = csu assert ctype locale intl catgets math setjmp signal \
  1245. stdlib stdio-common libio malloc string wcsmbs time dirent \
  1246. posix io termios resource misc socket sysvipc gmon \
  1247. gnulib iconv iconvdata wctype manual po argp \
  1248. localedata timezone rt conform debug mathvec support \
  1249. dlfcn elf
  1250. ifndef avoid-generated
  1251. # sysd-sorted itself will contain rules making the sysd-sorted target
  1252. # depend on Depend files. But if you just added a Depend file to an
  1253. # existing directory not in all-subdirs, then sysd-sorted needs to
  1254. # be regenerated, so it depends on existing $(sorted-subdirs:=/Depend) files.
  1255. all-Depend-files := $(wildcard $(sort \
  1256. $(foreach dir,$(all-subdirs),\
  1257. $(firstword $($(dir)-srcdir) \
  1258. $(..)$(dir))/Depend) \
  1259. $(sorted-subdirs:=/Depend)))
  1260. $(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk \
  1261. $(common-objpfx)config.make $(..)Makeconfig \
  1262. $(wildcard $(sysdirs:=/Subdirs)) \
  1263. $(all-Depend-files)
  1264. $(AWK) -f $< \
  1265. -v subdirs='$(all-subdirs)' \
  1266. -v srcpfx='$(..)' \
  1267. $(filter %/Subdirs %/Depend,$^) > $@-tmp
  1268. mv -f $@-tmp $@
  1269. $(all-Depend-files): ;
  1270. endif
  1271. # This gives partial TARGET:SOURCE pattern pairs to have rules
  1272. # emitted into sysd-rules. A sysdeps Makeconfig fragment can
  1273. # add its own special object file prefix to this list with e.g. foo-%:%
  1274. # to have foo-*.? compiled from *.? using $(foo-CPPFLAGS).
  1275. sysd-rules-patterns := %:% rtld-%:rtld-% rtld-%:% m_%:s_%
  1276. # Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
  1277. sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig))
  1278. ifneq (,$(sysdep-makeconfigs))
  1279. include $(sysdep-makeconfigs)
  1280. endif
  1281. # Compute just the target patterns. Makeconfig has set sysd-rules-patterns.
  1282. sysd-rules-targets := $(sort $(foreach p,$(sysd-rules-patterns),\
  1283. $(firstword $(subst :, ,$p))))
  1284. # $(libpthread-routines-var) and $(librt-routines-var) are the make
  1285. # variable to which pthread routines need to be added to land in the
  1286. # right library.
  1287. ifeq ($(pthread-in-libc),yes)
  1288. libpthread-routines-var = routines
  1289. librt-routines-var = routines
  1290. libanl-routines-var = routines
  1291. else
  1292. libpthread-routines-var = libpthread-routines
  1293. librt-routines-var = librt-routines
  1294. libanl-routines-var = libanl-routines
  1295. endif
  1296. # A sysdeps Makeconfig fragment may set libc-reentrant to yes.
  1297. ifeq (yes,$(libc-reentrant))
  1298. defines += -D_LIBC_REENTRANT
  1299. libio-mtsafe = -D_IO_MTSAFE_IO
  1300. endif
  1301. # The name to give to a test in test results summaries.
  1302. test-name = $(strip $(patsubst %.out, %, $(patsubst $(common-objpfx)%, %, $@)))
  1303. # Likewise, in XFAIL variable names.
  1304. test-xfail-name = $(strip $(patsubst %.out, %, $(patsubst $(objpfx)%, %, $@)))
  1305. # Command to output a test status line (such as PASS: test-name). If
  1306. # test-xfail-$(test-xfail-name) has a nonempty value, the status will be
  1307. # XPASS or XFAIL rather than PASS or FAIL.
  1308. evaluate-test = $(..)scripts/evaluate-test.sh $(test-name) $$? \
  1309. $(if $(test-xfail-$(test-xfail-name)),true,false) \
  1310. $(if $(stop-on-test-failure),true,false) \
  1311. > $(common-objpfx)$(test-name).test-result
  1312. endif # Makeconfig not yet included
  1313. # Local Variables:
  1314. # mode: makefile
  1315. # End: