Blame gmon/Makefile

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