Remove unneeded setting of errno after malloc failure
[glibc.git] / gmon / Makefile
blobd94593c9d8a882ebb0aa2337ce51407964ae4cf0
1 # Copyright (C) 1995-2018 Free Software Foundation, Inc.
2 # 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.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
19 # Sub-makefile for gmon portion of the library.
21 subdir := gmon
23 include ../Makeconfig
25 headers := sys/gmon.h sys/gmon_out.h sys/profil.h
26 routines := gmon mcount profil sprofil prof-freq
28 tests = tst-sprofil tst-gmon
29 ifeq ($(build-profile),yes)
30 tests += tst-profile-static
31 tests-static += tst-profile-static
33 LDFLAGS-tst-profile-static = -profile
34 endif
36 tests += tst-gmon-static
37 tests-static += tst-gmon-static
39 ifeq (yesyes,$(have-fpie)$(build-shared))
40 tests += tst-gmon-pie
41 tests-pie += tst-gmon-pie
42 ifeq (yes,$(enable-static-pie))
43 tests += tst-gmon-static-pie
44 tests-static += tst-gmon-static-pie
45 endif
46 endif
48 # The mcount code won't work without a frame pointer.
49 CFLAGS-mcount.c := -fno-omit-frame-pointer
51 CFLAGS-tst-gmon.c := -fno-omit-frame-pointer -pg
52 tst-gmon-no-pie = yes
53 CRT-tst-gmon := $(csu-objpfx)gcrt1.o
54 tst-gmon-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon.data
55 ifeq ($(run-built-tests),yes)
56 tests-special += $(objpfx)tst-gmon-gprof.out
57 endif
59 CFLAGS-tst-gmon-static.c := $(PIE-ccflag) -fno-omit-frame-pointer -pg
60 CRT-tst-gmon-static := $(csu-objpfx)gcrt1.o
61 tst-gmon-static-no-pie = yes
62 tst-gmon-static-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon-static.data
63 ifeq ($(run-built-tests),yes)
64 tests-special += $(objpfx)tst-gmon-static-gprof.out
65 endif
67 CFLAGS-tst-gmon-pie.c := $(PIE-ccflag) -fno-omit-frame-pointer -pg
68 CRT-tst-gmon-pie := $(csu-objpfx)gcrt1.o
69 tst-gmon-pie-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon-pie.data
70 ifeq ($(run-built-tests),yes)
71 tests-special += $(objpfx)tst-gmon-pie-gprof.out
72 endif
74 ifeq (yes,$(enable-static-pie))
75 CFLAGS-tst-gmon-static-pie.c := $(PIE-ccflag) -fno-omit-frame-pointer -pg
76 CRT-tst-gmon-static-pie := $(csu-objpfx)grcrt1.o
77 tst-gmon-static-pie-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon-static-pie.data
78 ifeq ($(run-built-tests),yes)
79 tests-special += $(objpfx)tst-gmon-static-pie-gprof.out
80 endif
81 endif
84 include ../Rules
86 # We cannot compile mcount.c with -pg because that would
87 # create recursive calls. Just copy the normal static object.
88 # On systems where `profil' is not a system call, the same
89 # problem exists for the internal functions in profil.c.
91 noprof := mcount $(sysdep_noprof)
92 ifeq (,$(filter profil,$(unix-syscalls)))
93 noprof += profil sprofil
94 endif
96 $(noprof:%=$(objpfx)%.op): %.op: %.o
97 rm -f $@
98 ln $< $@
100 # GMON_OUTPUT_PREFIX only sets the output prefix. The actual file
101 # name contains the PID as well.
102 $(objpfx)tst-gmon.out: clean-tst-gmon-data
103 clean-tst-gmon-data:
104 rm -f $(objpfx)tst-gmon.data.*
106 $(objpfx)tst-gmon-gprof.out: tst-gmon-gprof.sh $(objpfx)tst-gmon.out
107 $(SHELL) $< $(GPROF) $(objpfx)tst-gmon $(objpfx)tst-gmon.data.* > $@; \
108 $(evaluate-test)
110 $(objpfx)tst-gmon-static.out: clean-tst-gmon-static-data
111 clean-tst-gmon-static-data:
112 rm -f $(objpfx)tst-gmon-static.data.*
114 $(objpfx)tst-gmon-static-gprof.out: tst-gmon-static-gprof.sh \
115 $(objpfx)tst-gmon-static.out
116 $(SHELL) $< $(GPROF) $(objpfx)tst-gmon-static \
117 $(objpfx)tst-gmon-static.data.* > $@; \
118 $(evaluate-test)
120 $(objpfx)tst-gmon-pie.out: clean-tst-gmon-pie-data
121 clean-tst-gmon-pie-data:
122 rm -f $(objpfx)tst-gmon-pie.data.*
124 $(objpfx)tst-gmon-pie-gprof.out: tst-gmon-gprof.sh $(objpfx)tst-gmon-pie.out
125 $(SHELL) $< $(GPROF) $(objpfx)tst-gmon-pie $(objpfx)tst-gmon-pie.data.* > $@; \
126 $(evaluate-test)
128 $(objpfx)tst-gmon-static-pie.out: clean-tst-gmon-static-pie-data
129 clean-tst-gmon-static-pie-data:
130 rm -f $(objpfx)tst-gmon-static-pie.data.*
132 $(objpfx)tst-gmon-static-pie-gprof.out: tst-gmon-static-gprof.sh \
133 $(objpfx)tst-gmon-static-pie.out
134 $(SHELL) $< $(GPROF) $(objpfx)tst-gmon-static-pie \
135 $(objpfx)tst-gmon-static-pie.data.* > $@; \
136 $(evaluate-test)