SYS := $(shell uname -s) ARCH := $(shell uname -m) ifeq (i686,$(findstring i686,$(ARCH))) override ARCH=ia32 endif ifeq (i586,$(findstring i586,$(ARCH))) override ARCH=ia32 endif ifeq (i486,$(findstring i486,$(ARCH))) override ARCH=ia32 endif ifeq (i386,$(findstring i386,$(ARCH))) override ARCH=ia32 endif ifeq (ppc,$(findstring ppc,$(ARCH))) override ARCH=powerpc endif ifeq (sparc64,$(findstring sparc64,$(ARCH))) override ARCH=sparc endif
CONFIG_PFMLIB_SHARED?=y CONFIG_PFMLIB_OLD_PFMV2?=n
PE := $(shell echo $${CRAY_PE_TARGET}) ifeq (cray-x2,$(PE)) override ARCH=crayx2 endif
ifeq ($(SYS),Linux) MACHINE := $(shell grep -q 'Cell Broadband Engine' /proc/cpuinfo && echo cell) ifeq (cell,$(MACHINE)) override ARCH=cell endif endif
VERSION=3 REVISION=10 AGE=0
install_prefix?=/usr/local PREFIX?=$(install_prefix) LIBDIR=$(PREFIX)/lib INCDIR=$(PREFIX)/include MANDIR=$(PREFIX)/share/man EXAMPLESDIR=$(PREFIX)/share/doc/libpfm-$(VERSION).$(REVISION).$(AGE)/examples
ifeq ($(ARCH),ia64) CONFIG_PFMLIB_ARCH_IA64=y endif
ifeq ($(ARCH),x86_64) CONFIG_PFMLIB_ARCH_X86_64=y endif
ifeq ($(ARCH),ia32) CONFIG_PFMLIB_ARCH_I386=y endif
ifeq ($(ARCH),mips64) CONFIG_PFMLIB_ARCH_MIPS64=y
MACHINE := $(shell test -f /etc/sicortex-release && echo sicortex) ifeq (sicortex,$(MACHINE)) CONFIG_PFMLIB_ARCH_SICORTEX=y endif endif
ifeq ($(ARCH),powerpc) CONFIG_PFMLIB_ARCH_POWERPC=y endif
ifeq ($(ARCH),sparc) CONFIG_PFMLIB_ARCH_SPARC=y endif
ifeq ($(XTPE_COMPILE_TARGET),linux) CONFIG_PFMLIB_ARCH_CRAYXT=y CONFIG_PFMLIB_SHARED=n CONFIG_PFMLIB_OLD_PFMV2=y endif
ifeq ($(XTPE_COMPILE_TARGET),catamount) CONFIG_PFMLIB_ARCH_CRAYXT=y CONFIG_PFMLIB_SHARED=n CONFIG_PFMLIB_OLD_PFMV2=y endif
ifeq ($(ARCH),crayx2) CONFIG_PFMLIB_ARCH_CRAYX2=y CONFIG_PFMLIB_SHARED=n CONFIG_PFMLIB_OLD_PFMV2=y endif
ifeq ($(ARCH),cell) CONFIG_PFMLIB_CELL=y endif
ifeq ($(BITMODE),64) ifeq ($(ARCH),powerpc) CONFIG_PFMLIB_ARCH_POWERPC64=y endif endif
CC?=gcc LIBS= INSTALL=install LN?=ln -sf PFMINCDIR=$(TOPDIR)/include PFMLIBDIR=$(TOPDIR)/lib DBG?=-g -Wall -Werror
ifeq ($(CONFIG_PFMLIB_ARCH_SICORTEX),y) OPTIM?=-O else OPTIM?=-O2 endif CFLAGS+=$(OPTIM) $(DBG) -I$(PFMINCDIR) MKDEP=makedepend PFMLIB=$(PFMLIBDIR)/libpfm.a
ifeq ($(CONFIG_PFMLIB_ARCH_CRAYXT),y) LDFLAGS+=-static CONFIG_PFMLIB_OLD_PFMV2=y endif
ifeq ($(CONFIG_PFMLIB_ARCH_CRAYX2),y) CC=craynv-cray-linux-gnu-gcc LDFLAGS+=-static CONFIG_PFMLIB_OLD_PFMV2=y endif
ifeq ($(CONFIG_PFMLIB_ARCH_SICORTEX),y) CONFIG_PFMLIB_OLD_PFMV2=y endif
ifeq ($(CONFIG_PFMLIB_ARCH_POWERPC64),y) CFLAGS+= -m64 LDFLAGS+= -m64 LIBDIR=$(PREFIX)/lib64 endif
ifeq ($(CONFIG_PFMLIB_OLD_PFMV2),y) CFLAGS +=-DPFMLIB_OLD_PFMV2 endif