H.J. Lu 8497f4cc42 gprof: Always compile tests with -g
Always compile gprof testsuite with -g for line number info checked by
tst-gmon-gprof-l.sh.

	PR gprof/32779
	* testsuite/Makefile.am (GPROF_FLAGS): Add -g.
	(COMPILE): Set to "$(CC) $(AM_CFLAGS) $(GPROF_FLAGS)".
	(LINK) Set to "$(CC) $(AM_CFLAGS) $(GPROF_FLAGS) $(AM_LDFLAGS)
	$(LDFLAGS) -o $@".
	* testsuite/Makefile.in: Regenerated.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-29 07:03:46 -07:00

44 lines
1.3 KiB
Makefile

# Process this file with automake to generate Makefile.in
AUTOMAKE_OPTIONS = foreign
GPROF = ../gprof$(EXEEXT)
# NB: -O2 -fno-omit-frame-pointer is needed for expected call graph. See
# https://sourceware.org/bugzilla/show_bug.cgi?id=32768
# -g is needed for line number info checked by tst-gmon-gprof-l.sh. See
# https://sourceware.org/bugzilla/show_bug.cgi?id=32779
GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg -g
COMPILE = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS)
LINK = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
# We will add to these later, for each individual test. Note
# that we add each test under check_SCRIPTS;
# the TESTS variable is automatically populated from these.
check_SCRIPTS =
check_DATA =
MOSTLYCLEANFILES =
TESTS = $(check_SCRIPTS)
if NATIVE
check_SCRIPTS += tst-gmon-gprof.sh
check_DATA += tst-gmon-gprof.out
MOSTLYCLEANFILES += tst-gmon.$(OBJEXT) tst-gmon$(EXEEXT) gmon.out
tst-gmon.$(OBJEXT): tst-gmon.c
$(COMPILE) -c -o $@ $<
tst-gmon: tst-gmon.$(OBJEXT)
$(LINK) tst-gmon.$(OBJEXT)
tst-gmon-gprof.out: tst-gmon$(EXEEXT) $(GPROF)
$(srcdir)/tst-gmon-gprof.sh $(GPROF) tst-gmon$(EXEEXT)
check_SCRIPTS += tst-gmon-gprof-l.sh
check_DATA += tst-gmon-gprof-l.out
tst-gmon-gprof-l.out: tst-gmon$(EXEEXT) $(GPROF)
$(srcdir)/tst-gmon-gprof-l.sh $(GPROF) tst-gmon$(EXEEXT)
endif NATIVE