2.5-18.1
[glibc.git] / debug / Makefile
blob9d9b6ac96afb3a6efb25e14bcbba07e184ef6989
1 # Copyright (C) 1998-2001,2004,2005,2006 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, write to the Free
16 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 # 02111-1307 USA.
20 # Sub-makefile for debug portion of the library.
22 subdir := debug
24 headers := execinfo.h
25 distribute = sigcontextinfo.h register-dump.h frame.h
27 routines = backtrace backtracesyms backtracesymsfd noophooks \
28 memcpy_chk memmove_chk mempcpy_chk memset_chk stpcpy_chk \
29 strcat_chk strcpy_chk strncat_chk strncpy_chk stpncpy_chk \
30 sprintf_chk vsprintf_chk snprintf_chk vsnprintf_chk \
31 printf_chk fprintf_chk vprintf_chk vfprintf_chk \
32 gets_chk chk_fail readonly-area fgets_chk fgets_u_chk \
33 read_chk pread_chk pread64_chk recv_chk recvfrom_chk \
34 readlink_chk readlinkat_chk getwd_chk getcwd_chk \
35 realpath_chk ptsname_r_chk \
36 wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
37 wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
38 wcpncpy_chk \
39 swprintf_chk vswprintf_chk wprintf_chk fwprintf_chk \
40 vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk \
41 confstr_chk getgroups_chk ttyname_r_chk getlogin_r_chk \
42 gethostname_chk getdomainname_chk wcrtomb_chk mbsnrtowcs_chk \
43 wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
44 wcstombs_chk \
45 stack_chk_fail \
46 $(static-only-routines)
47 static-only-routines := warning-nop stack_chk_fail_local
49 CFLAGS-backtrace.c = -fno-omit-frame-pointer
50 CFLAGS-sprintf_chk.c = -D_IO_MTSAFE_IO
51 CFLAGS-snprintf_chk.c = -D_IO_MTSAFE_IO
52 CFLAGS-vsprintf_chk.c = -D_IO_MTSAFE_IO
53 CFLAGS-vsnprintf_chk.c = -D_IO_MTSAFE_IO
54 CFLAGS-printf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
55 CFLAGS-fprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
56 CFLAGS-vprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
57 CFLAGS-vfprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
58 CFLAGS-gets_chk.c = -D_IO_MTSAFE_IO $(exceptions)
59 CFLAGS-fgets_chk.c = -D_IO_MTSAFE_IO $(exceptions)
60 CFLAGS-fgets_u_chk.c = -D_IO_MTSAFE_IO $(exceptions)
61 CFLAGS-swprintf_chk.c = -D_IO_MTSAFE_IO
62 CFLAGS-vswprintf_chk.c = -D_IO_MTSAFE_IO
63 CFLAGS-wprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
64 CFLAGS-fwprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
65 CFLAGS-vwprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
66 CFLAGS-vfwprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
67 CFLAGS-fgetws_chk.c = -D_IO_MTSAFE_IO $(exceptions)
68 CFLAGS-fgetws_u_chk.c = -D_IO_MTSAFE_IO $(exceptions)
69 CFLAGS-read_chk.c = -fexceptions -fasynchronous-unwind-tables
70 CFLAGS-pread_chk.c = -fexceptions -fasynchronous-unwind-tables
71 CFLAGS-pread64_chk.c = -fexceptions -fasynchronous-unwind-tables
72 CFLAGS-recv_chk.c = -fexceptions -fasynchronous-unwind-tables
73 CFLAGS-recvfrom_chk.c = -fexceptions -fasynchronous-unwind-tables
75 tst-chk1-ENV = LOCPATH=$(common-objpfx)localedata
76 tst-chk2-ENV = LOCPATH=$(common-objpfx)localedata
77 tst-chk3-ENV = LOCPATH=$(common-objpfx)localedata
78 tst-lfschk1-ENV = LOCPATH=$(common-objpfx)localedata
79 tst-lfschk2-ENV = LOCPATH=$(common-objpfx)localedata
80 tst-lfschk3-ENV = LOCPATH=$(common-objpfx)localedata
82 tests = backtrace-tst tst-chk1 tst-chk2 tst-chk3 \
83 tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk
85 extra-libs = libSegFault libpcprofile
86 extra-libs-others = $(extra-libs)
88 libSegFault-routines = segfault
89 libSegFault-inhibit-o = $(filter-out .os,$(object-suffixes))
91 libpcprofile-routines = pcprofile
92 libpcprofile-inhibit-o = $(filter-out .os,$(object-suffixes))
94 others = pcprofiledump
95 install-bin = pcprofiledump
96 install-bin-script = xtrace
98 include ../Makeconfig
100 distribute += catchsegv.sh xtrace.sh
101 ifeq ($(elf),yes)
102 ifeq ($(build-shared),yes)
103 install-bin-script += catchsegv
104 endif
105 endif
106 generated = catchsegv xtrace
108 include ../Rules
110 sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,')
112 $(objpfx)catchsegv: catchsegv.sh $(common-objpfx)soversions.mk \
113 $(common-objpfx)config.make
114 slibpfx=`echo $(slibdir)|sed 's/lib\(64\|\)$$/\\\\\\\\$$LIB/'`; \
115 sed -e 's|@VERSION@|$(version)|' -e "s|@SLIB@|$$slibpfx|" $< > $@.new
116 chmod 555 $@.new
117 mv -f $@.new $@
119 $(objpfx)pcprofiledump: $(objpfx)pcprofiledump.o
121 $(objpfx)xtrace: xtrace.sh
122 rm -f $@.new
123 sed -e 's|@BASH@|$(BASH)|' -e 's|@VERSION@|$(version)|' \
124 -e 's|@SLIBDIR@|$(sLIBdir)|' -e 's|@BINDIR@|$(bindir)|' $^ > $@.new \
125 && rm -f $@ && mv $@.new $@ && chmod +x $@
127 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
128 # This ensures they will load libc.so for needed symbols if loaded by
129 # a statically-linked program that hasn't already loaded it.
130 $(objpfx)libSegFault.so: $(common-objpfx)libc.so \
131 $(common-objpfx)libc_nonshared.a \
132 $(elf-objpfx)$(rtld-installed-name)
133 $(objpfx)libpcprofile.so: $(common-objpfx)libc.so \
134 $(common-objpfx)libc_nonshared.a \
135 $(elf-objpfx)$(rtld-installed-name)