Blame gmon/Makefile

Packit Service 82fcde
# Copyright (C) 1995-2018 Free Software Foundation, Inc.
Packit Service 82fcde
# This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
# The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
# modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
# License as published by the Free Software Foundation; either
Packit Service 82fcde
# version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
# The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
# Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
# You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
# License along with the GNU C Library; if not, see
Packit Service 82fcde
# <http://www.gnu.org/licenses/>.
Packit Service 82fcde
Packit Service 82fcde
#
Packit Service 82fcde
#	Sub-makefile for gmon portion of the library.
Packit Service 82fcde
#
Packit Service 82fcde
subdir	:= gmon
Packit Service 82fcde
Packit Service 82fcde
include ../Makeconfig
Packit Service 82fcde
Packit Service 82fcde
headers	:= sys/gmon.h sys/gmon_out.h sys/profil.h
Packit Service 82fcde
routines := gmon mcount profil sprofil prof-freq
Packit Service 82fcde
Packit Service 82fcde
tests	= tst-sprofil tst-gmon
Packit Service 82fcde
ifeq ($(build-profile),yes)
Packit Service 82fcde
tests	+= tst-profile-static
Packit Service 82fcde
tests-static	+= tst-profile-static
Packit Service 82fcde
Packit Service 82fcde
LDFLAGS-tst-profile-static = -profile
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
tests += tst-gmon-static
Packit Service 82fcde
tests-static += tst-gmon-static
Packit Service 82fcde
Packit Service 82fcde
ifeq (yesyes,$(have-fpie)$(build-shared))
Packit Service 82fcde
tests += tst-gmon-pie
Packit Service 82fcde
tests-pie += tst-gmon-pie
Packit Service 82fcde
ifeq (yes,$(enable-static-pie))
Packit Service 82fcde
tests += tst-gmon-static-pie
Packit Service 82fcde
tests-static += tst-gmon-static-pie
Packit Service 82fcde
endif
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
# The mcount code won't work without a frame pointer.
Packit Service 82fcde
CFLAGS-mcount.c := -fno-omit-frame-pointer
Packit Service 82fcde
Packit Service 82fcde
CFLAGS-tst-gmon.c := -fno-omit-frame-pointer -pg
Packit Service 82fcde
tst-gmon-no-pie = yes
Packit Service 82fcde
CRT-tst-gmon := $(csu-objpfx)gcrt1.o
Packit Service 82fcde
tst-gmon-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon.data
Packit Service 82fcde
ifeq ($(run-built-tests),yes)
Packit Service 82fcde
tests-special += $(objpfx)tst-gmon-gprof.out
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
CFLAGS-tst-gmon-static.c := $(PIE-ccflag) -fno-omit-frame-pointer -pg
Packit Service 82fcde
CRT-tst-gmon-static := $(csu-objpfx)gcrt1.o
Packit Service 82fcde
tst-gmon-static-no-pie = yes
Packit Service 82fcde
tst-gmon-static-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon-static.data
Packit Service 82fcde
ifeq ($(run-built-tests),yes)
Packit Service 82fcde
tests-special += $(objpfx)tst-gmon-static-gprof.out
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
CFLAGS-tst-gmon-pie.c := $(PIE-ccflag) -fno-omit-frame-pointer -pg
Packit Service 82fcde
CRT-tst-gmon-pie := $(csu-objpfx)gcrt1.o
Packit Service 82fcde
tst-gmon-pie-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon-pie.data
Packit Service 82fcde
ifeq ($(run-built-tests),yes)
Packit Service 82fcde
tests-special += $(objpfx)tst-gmon-pie-gprof.out
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
ifeq (yes,$(enable-static-pie))
Packit Service 82fcde
CFLAGS-tst-gmon-static-pie.c := $(PIE-ccflag) -fno-omit-frame-pointer -pg
Packit Service 82fcde
CRT-tst-gmon-static-pie := $(csu-objpfx)grcrt1.o
Packit Service 82fcde
tst-gmon-static-pie-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon-static-pie.data
Packit Service 82fcde
ifeq ($(run-built-tests),yes)
Packit Service 82fcde
tests-special += $(objpfx)tst-gmon-static-pie-gprof.out
Packit Service 82fcde
endif
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
Packit Service 82fcde
include ../Rules
Packit Service 82fcde
Packit Service 82fcde
# We cannot compile mcount.c with -pg because that would
Packit Service 82fcde
# create recursive calls.  Just copy the normal static object.
Packit Service 82fcde
# On systems where `profil' is not a system call, the same
Packit Service 82fcde
# problem exists for the internal functions in profil.c.
Packit Service 82fcde
Packit Service 82fcde
noprof := mcount $(sysdep_noprof)
Packit Service 82fcde
ifeq (,$(filter profil,$(unix-syscalls)))
Packit Service 82fcde
noprof += profil sprofil
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
$(noprof:%=$(objpfx)%.op): %.op: %.o
Packit Service 82fcde
	rm -f $@
Packit Service 82fcde
	ln $< $@
Packit Service 82fcde
Packit Service 82fcde
# GMON_OUTPUT_PREFIX only sets the output prefix.  The actual file
Packit Service 82fcde
# name contains the PID as well.
Packit Service 82fcde
$(objpfx)tst-gmon.out: clean-tst-gmon-data
Packit Service 82fcde
clean-tst-gmon-data:
Packit Service 82fcde
	rm -f $(objpfx)tst-gmon.data.*
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)tst-gmon-gprof.out: tst-gmon-gprof.sh $(objpfx)tst-gmon.out
Packit Service 82fcde
	$(SHELL) $< $(GPROF) $(objpfx)tst-gmon $(objpfx)tst-gmon.data.* > $@; \
Packit Service 82fcde
	$(evaluate-test)
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)tst-gmon-static.out: clean-tst-gmon-static-data
Packit Service 82fcde
clean-tst-gmon-static-data:
Packit Service 82fcde
	rm -f $(objpfx)tst-gmon-static.data.*
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)tst-gmon-static-gprof.out: tst-gmon-static-gprof.sh \
Packit Service 82fcde
				    $(objpfx)tst-gmon-static.out
Packit Service 82fcde
	$(SHELL) $< $(GPROF) $(objpfx)tst-gmon-static \
Packit Service 82fcde
		$(objpfx)tst-gmon-static.data.* > $@; \
Packit Service 82fcde
	$(evaluate-test)
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)tst-gmon-pie.out: clean-tst-gmon-pie-data
Packit Service 82fcde
clean-tst-gmon-pie-data:
Packit Service 82fcde
	rm -f $(objpfx)tst-gmon-pie.data.*
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)tst-gmon-pie-gprof.out: tst-gmon-gprof.sh $(objpfx)tst-gmon-pie.out
Packit Service 82fcde
	$(SHELL) $< $(GPROF) $(objpfx)tst-gmon-pie $(objpfx)tst-gmon-pie.data.* > $@; \
Packit Service 82fcde
	$(evaluate-test)
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)tst-gmon-static-pie.out: clean-tst-gmon-static-pie-data
Packit Service 82fcde
clean-tst-gmon-static-pie-data:
Packit Service 82fcde
	rm -f $(objpfx)tst-gmon-static-pie.data.*
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)tst-gmon-static-pie-gprof.out: tst-gmon-static-gprof.sh \
Packit Service 82fcde
					$(objpfx)tst-gmon-static-pie.out
Packit Service 82fcde
	$(SHELL) $< $(GPROF) $(objpfx)tst-gmon-static-pie \
Packit Service 82fcde
		$(objpfx)tst-gmon-static-pie.data.* > $@; \
Packit Service 82fcde
	$(evaluate-test)