2 # Copyright (c) 2002-2006 Hewlett-Packard Development Company, L.P.
3 # Contributed by Stephane Eranian <eranian@hpl.hp.com>
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to deal
7 # in the Software without restriction, including without limitation the rights
8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9 # of the Software, and to permit persons to whom the Software is furnished to do so,
10 # subject to the following conditions:
12 # The above copyright notice and this permission notice shall be included in all
13 # copies or substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
17 # PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 # CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
20 # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 # This file is part of libpfm, a performance monitoring support library for
23 # applications on Linux.
27 # This file defines the global compilation settings.
28 # It is included by every Makefile
31 SYS
:= $(shell uname
-s
)
32 ARCH
:= $(shell uname
-m
)
33 ifeq (i686
,$(findstring i686
,$(ARCH
)))
36 ifeq (i586
,$(findstring i586
,$(ARCH
)))
39 ifeq (i486
,$(findstring i486
,$(ARCH
)))
42 ifeq (i386
,$(findstring i386
,$(ARCH
)))
45 ifeq (i86pc
,$(findstring i86pc
,$(ARCH
)))
54 ifeq (ppc
,$(findstring ppc
,$(ARCH
)))
57 ifeq (sparc64
,$(findstring sparc64
,$(ARCH
)))
60 ifeq (armv7
,$(findstring armv7
,$(ARCH
)))
63 ifeq (mips64
,$(findstring mips64
,$(ARCH
)))
66 ifeq (mips
,$(findstring mips
,$(ARCH
)))
71 # CONFIG_PFMLIB_SHARED: y=compile static and shared versions, n=static only
72 # CONFIG_PFMLIB_DEBUG: enable debugging output support
73 # CONFIG_PFMLIB_NOPYTHON: do not generate the python support, incompatible
74 # with PFMLIB_SHARED=n
76 CONFIG_PFMLIB_SHARED?
=y
77 CONFIG_PFMLIB_DEBUG?
=y
78 CONFIG_PFMLIB_NOPYTHON?
=y
81 # Cell Broadband Engine is reported as PPC but needs special handling.
84 MACHINE
:= $(shell grep
-q
'Cell Broadband Engine' /proc
/cpuinfo
&& echo cell
)
85 ifeq (cell
,$(MACHINE
))
98 # Where should things (lib, headers, man) go in the end.
102 INCDIR
=$(PREFIX
)/include
103 MANDIR
=$(PREFIX
)/share
/man
104 DOCDIR
=$(PREFIX
)/share
/doc
/libpfm-
$(VERSION
).
$(REVISION
).
$(AGE
)
107 # System header files
109 # SYSINCDIR : where to find standard header files (default to .)
113 # Configuration Paramaters for libpfm library
116 CONFIG_PFMLIB_ARCH_IA64
=y
119 ifeq ($(ARCH
),x86_64
)
120 CONFIG_PFMLIB_ARCH_X86_64
=y
121 CONFIG_PFMLIB_ARCH_X86
=y
125 CONFIG_PFMLIB_ARCH_I386
=y
126 CONFIG_PFMLIB_ARCH_X86
=y
130 CONFIG_PFMLIB_ARCH_MIPS
=y
133 ifeq ($(ARCH
),powerpc
)
134 CONFIG_PFMLIB_ARCH_POWERPC
=y
138 CONFIG_PFMLIB_ARCH_SPARC
=y
142 CONFIG_PFMLIB_ARCH_ARM
=y
145 ifeq ($(XTPE_COMPILE_TARGET
),linux
)
146 CONFIG_PFMLIB_ARCH_CRAYXT
=y
153 # handle special cases for 64-bit builds
155 ifeq ($(ARCH
),powerpc
)
156 CONFIG_PFMLIB_ARCH_POWERPC64
=y
161 # you shouldn't have to touch anything beyond this point
165 # The entire package can be compiled using
166 # icc the Intel Itanium Compiler (7.x,8.x, 9.x)
173 PFMINCDIR
=$(TOPDIR
)/include
174 PFMLIBDIR
=$(TOPDIR
)/lib
175 DBG?
=-g
-Wall
-Werror
176 CFLAGS
+=$(OPTIM
) $(DBG
) -I
$(SYSINCDIR
) -I
$(PFMINCDIR
)
178 PFMLIB
=$(PFMLIBDIR
)/libpfm.a
180 ifeq ($(CONFIG_PFMLIB_ARCH_POWERPC64
),y
)
183 LIBDIR
=$(DESTDIR
)/lib64
186 ifeq ($(CONFIG_PFMLIB_DEBUG
),y
)
187 CFLAGS
+= -DCONFIG_PFMLIB_DEBUG
193 # Python is for use with perf_events
194 # so it only works on Linux
197 CONFIG_PFMLIB_NOPYTHON
=y
201 # mark that we are compiling on Linux
204 CFLAGS
+= -DCONFIG_PFMLIB_OS_LINUX
208 # compile examples statically if library is
210 # not compatible with python support, so disable for now
212 ifeq ($(CONFIG_PFMLIB_SHARED
),n
)
214 CONFIG_PFMLIB_NOPYTHON
=y