|
Packit |
577717 |
#
|
|
Packit |
577717 |
# Copyright (c) 2002-2006 Hewlett-Packard Development Company, L.P.
|
|
Packit |
577717 |
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
Packit |
577717 |
# of this software and associated documentation files (the "Software"), to deal
|
|
Packit |
577717 |
# in the Software without restriction, including without limitation the rights
|
|
Packit |
577717 |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
Packit |
577717 |
# of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
Packit |
577717 |
# subject to the following conditions:
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# The above copyright notice and this permission notice shall be included in all
|
|
Packit |
577717 |
# copies or substantial portions of the Software.
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
Packit |
577717 |
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
Packit |
577717 |
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
Packit |
577717 |
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
Packit |
577717 |
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
|
Packit |
577717 |
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# This file is part of libpfm, a performance monitoring support library for
|
|
Packit |
577717 |
# applications on Linux.
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# This file defines the global compilation settings.
|
|
Packit |
577717 |
# It is included by every Makefile
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
SYS := $(shell uname -s)
|
|
Packit |
577717 |
ARCH := $(shell uname -m)
|
|
Packit |
577717 |
ifeq (i686,$(findstring i686,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=i386
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (i586,$(findstring i586,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=i386
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (i486,$(findstring i486,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=i386
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (i386,$(findstring i386,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=i386
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (i86pc,$(findstring i86pc,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=i386
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (x86,$(findstring x86,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=x86_64
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq ($(ARCH),x86_64)
|
|
Packit |
577717 |
override ARCH=x86_64
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq ($(ARCH),amd64)
|
|
Packit |
577717 |
override ARCH=x86_64
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (ppc,$(findstring ppc,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=powerpc
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (sparc64,$(findstring sparc64,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=sparc
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (armv6,$(findstring armv6,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=arm
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (armv7,$(findstring armv7,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=arm
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (armv7,$(findstring armv7,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=arm
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (aarch32,$(findstring aarch32,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=arm
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (armv8l,$(findstring armv8l,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=arm
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (mips64,$(findstring mips64,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=mips
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
ifeq (mips,$(findstring mips,$(ARCH)))
|
|
Packit |
577717 |
override ARCH=mips
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq (MINGW,$(findstring MINGW,$(SYS)))
|
|
Packit |
577717 |
override SYS=WINDOWS
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# CONFIG_PFMLIB_SHARED: y=compile static and shared versions, n=static only
|
|
Packit |
577717 |
# CONFIG_PFMLIB_DEBUG: enable debugging output support
|
|
Packit |
577717 |
# CONFIG_PFMLIB_NOPYTHON: do not generate the python support, incompatible
|
|
Packit |
577717 |
# with PFMLIB_SHARED=n
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
CONFIG_PFMLIB_SHARED?=y
|
|
Packit |
577717 |
CONFIG_PFMLIB_DEBUG?=y
|
|
Packit |
577717 |
CONFIG_PFMLIB_NOPYTHON?=y
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# Cell Broadband Engine is reported as PPC but needs special handling.
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
ifeq ($(SYS),Linux)
|
|
Packit |
577717 |
MACHINE := $(shell grep -q 'Cell Broadband Engine' /proc/cpuinfo && echo cell)
|
|
Packit |
577717 |
ifeq (cell,$(MACHINE))
|
|
Packit |
577717 |
override ARCH=cell
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# Library version
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
VERSION=4
|
|
Packit |
577717 |
REVISION=8
|
|
Packit |
577717 |
AGE=0
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# Where should things (lib, headers, man) go in the end.
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
PREFIX=/usr/local
|
|
Packit |
577717 |
LIBDIR=$(PREFIX)/lib
|
|
Packit |
577717 |
INCDIR=$(PREFIX)/include
|
|
Packit |
577717 |
MANDIR=$(PREFIX)/share/man
|
|
Packit |
577717 |
DOCDIR=$(PREFIX)/share/doc/libpfm-$(VERSION).$(REVISION).$(AGE)
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# System header files
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# SYSINCDIR : where to find standard header files (default to .)
|
|
Packit |
577717 |
SYSINCDIR=.
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# Configuration Paramaters for libpfm library
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
ifeq ($(ARCH),ia64)
|
|
Packit |
577717 |
CONFIG_PFMLIB_ARCH_IA64=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(ARCH),x86_64)
|
|
Packit |
577717 |
CONFIG_PFMLIB_ARCH_X86_64=y
|
|
Packit |
577717 |
CONFIG_PFMLIB_ARCH_X86=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(ARCH),i386)
|
|
Packit |
577717 |
CONFIG_PFMLIB_ARCH_I386=y
|
|
Packit |
577717 |
CONFIG_PFMLIB_ARCH_X86=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(ARCH),mips)
|
|
Packit |
577717 |
CONFIG_PFMLIB_ARCH_MIPS=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(ARCH),powerpc)
|
|
Packit |
577717 |
CONFIG_PFMLIB_ARCH_POWERPC=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(ARCH),sparc)
|
|
Packit |
577717 |
CONFIG_PFMLIB_ARCH_SPARC=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(ARCH),arm)
|
|
Packit |
577717 |
CONFIG_PFMLIB_ARCH_ARM=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(ARCH),aarch64)
|
|
Packit |
577717 |
CONFIG_PFMLIB_ARCH_ARM64=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(ARCH),arm64)
|
|
Packit |
577717 |
CONFIG_PFMLIB_ARCH_ARM64=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(ARCH),s390x)
|
|
Packit |
577717 |
CONFIG_PFMLIB_ARCH_S390X=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(ARCH),cell)
|
|
Packit |
577717 |
CONFIG_PFMLIB_CELL=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# you shouldn't have to touch anything beyond this point
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# The entire package can be compiled using
|
|
Packit |
577717 |
# icc the Intel Itanium Compiler (7.x,8.x, 9.x)
|
|
Packit |
577717 |
# or GNU C
|
|
Packit |
577717 |
#CC=icc
|
|
Packit |
577717 |
CC?=gcc
|
|
Packit |
577717 |
LIBS=
|
|
Packit |
577717 |
INSTALL=install
|
|
Packit |
577717 |
LDCONFIG=ldconfig
|
|
Packit |
577717 |
LN?=ln -sf
|
|
Packit |
577717 |
PFMINCDIR=$(TOPDIR)/include
|
|
Packit |
577717 |
PFMLIBDIR=$(TOPDIR)/lib
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# -Wextra: to enable extra compiler sanity checks (e.g., signed vs. unsigned)
|
|
Packit |
577717 |
# -Wno-unused-parameter: to avoid warnings on unused foo(void *this) parameter
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
DBG?=-g -Wall -Werror -Wextra -Wno-unused-parameter
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(SYS),Darwin)
|
|
Packit |
577717 |
# older gcc-4.2 does not like -Wextra and some of our initialization code
|
|
Packit |
577717 |
# Xcode uses a gcc version which is too old for some static initializers
|
|
Packit |
577717 |
CC=clang
|
|
Packit |
577717 |
DBG?=-g -Wall -Werror
|
|
Packit |
577717 |
LDCONFIG=true
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(SYS),FreeBSD)
|
|
Packit |
577717 |
# gcc-4.2 does not like -Wextra and some of our initialization code
|
|
Packit |
577717 |
DBG=-g -Wall -Werror
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
CFLAGS+=$(OPTIM) $(DBG) -I$(SYSINCDIR) -I$(PFMINCDIR)
|
|
Packit |
577717 |
MKDEP=makedepend
|
|
Packit |
577717 |
PFMLIB=$(PFMLIBDIR)/libpfm.a
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(CONFIG_PFMLIB_DEBUG),y)
|
|
Packit |
577717 |
CFLAGS += -DCONFIG_PFMLIB_DEBUG
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
CTAGS?=ctags
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# Python is for use with perf_events
|
|
Packit |
577717 |
# so it only works on Linux
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
ifneq ($(SYS),Linux)
|
|
Packit |
577717 |
CONFIG_PFMLIB_NOPYTHON=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# mark that we are compiling on Linux
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
ifeq ($(SYS),Linux)
|
|
Packit |
577717 |
CFLAGS+= -DCONFIG_PFMLIB_OS_LINUX
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
# compile examples statically if library is
|
|
Packit |
577717 |
# compile static
|
|
Packit |
577717 |
# not compatible with python support, so disable for now
|
|
Packit |
577717 |
#
|
|
Packit |
577717 |
ifeq ($(CONFIG_PFMLIB_SHARED),n)
|
|
Packit |
577717 |
LDFLAGS+= -static
|
|
Packit |
577717 |
CONFIG_PFMLIB_NOPYTHON=y
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
ifeq ($(SYS),WINDOWS)
|
|
Packit |
577717 |
CFLAGS +=-DPFMLIB_WINDOWS
|
|
Packit |
577717 |
endif
|