1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
DESCR = "Linux with perf_event kernel support and libpfm4"
ifneq (/usr,$(PFM_PREFIX))
PWD = $(shell pwd)
ifeq (,$(PFM_LIB_PATH))
ifeq (,$(PFM_ROOT))
PFM_ROOT := $(PWD)/libpfm4
endif
PFM_LIB_PATH := $(PFM_ROOT)/lib
CC_SHR = -Wl,-rpath-link -Wl,$(PFM_LIB_PATH)
endif
ifeq (,$(PFM_INC_PATH))
ifeq (,$(PFM_ROOT))
PFM_ROOT := $(PWD)/libpfm4
endif
PFM_INC_PATH := $(PFM_ROOT)/include
endif
ifneq (/usr/include,$(PFM_INC_PATH))
LIBCFLAGS = -I$(PFM_INC_PATH)
endif
endif
LIBCFLAGS = -fvisibility=hidden
MISCHDRS = linux-lock.h mb.h papi_libpfm4_events.h
MISCSRCS = papi_libpfm4_events.c
SHLIBDEPS = -Bdynamic -L$(PFM_LIB_PATH) -lpfm
PFM_OBJS=$(shell $(AR) t $(PFM_LIB_PATH)/libpfm.a 2>/dev/null)
MISCOBJS = $(MISCSRCS:.c=.o)
ifeq (yes,$(MIC))
FORCE_PFM_ARCH="CONFIG_PFMLIB_ARCH_X86=y"
endif
ifeq (,$(PFM_OBJS))
$(PFM_LIB_PATH)/libpfm.a:
ifneq (,${PFM_ROOT})
ifeq ("$(CC_COMMON_NAME)","icc")
$(MAKE) -C $(PFM_ROOT) ARCH="$(ARCH)" CC="$(CC) $(BITFLAGS)" DBG="-g -Wall -Werror" $(FORCE_PFM_ARCH) lib
else
ifeq (1,$(HAVE_NO_OVERRIDE_INIT))
$(MAKE) -C $(PFM_ROOT) ARCH="$(ARCH)" CC="$(CC) $(BITFLAGS) -Wno-override-init" $(FORCE_PFM_ARCH) lib
else
$(MAKE) -C $(PFM_ROOT) ARCH="$(ARCH)" CC="$(CC) $(BITFLAGS)" $(FORCE_PFM_ARCH) lib
endif
endif
else
@echo '$@ not installed!'; exit 1
endif
$(MAKE)
endif
include Makefile.inc
config.h:
@echo 'Please clobber your build and run ./configure."
$(PFM_OBJS): $(PFM_LIB_PATH)/libpfm.a
$(AR) xv $<
papi_libpfm4_events.o: papi_libpfm4_events.c $(HEADERS)
$(CC) $(LIBCFLAGS) $(OPTFLAGS) -c papi_libpfm4_events.c -o $@
native_clean:
rm -f $(MISCOBJS)
rm -f $(PFM_OBJS)
ifneq (,${PFM_ROOT})
$(MAKE) -C $(PFM_ROOT) ARCH="$(ARCH)" clean
endif
native_install:
ifneq (,${PFM_ROOT})
$(MAKE) -C $(PFM_ROOT) ARCH="$(ARCH)" DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) install_prefix=$(PREFIX) LIBDIR=$(LIBDIR) INCDIR=$(INCDIR) MANDIR=$(MANDIR) install
endif
install -d $(DESTDIR)$(LIBDIR)
# Makefile.inc already has installation of shared libraries so
# there is no need to do it here
install -d $(DESTDIR)$(DATADIR)
cp -f ./papi_events.csv $(DESTDIR)$(DATADIR)
native_clobber:
ifneq (,${PFM_ROOT})
$(MAKE) -C $(PFM_ROOT) ARCH="$(ARCH)" distclean
endif
|