File: Rules.perfctr-pfm

package info (click to toggle)
papi 5.7.0+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 9,856 kB
  • sloc: ansic: 93,265; fortran: 3,338; xml: 2,460; makefile: 815; sh: 290
file content (157 lines) | stat: -rw-r--r-- 4,398 bytes parent folder | download
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
DESCR = "Linux with PerfCtr $(VERSION) patch and library, and perfmon2 libpfm library" 

ifneq (/usr,$(PERFCTR_PREFIX))
PWD = $(shell pwd)
ifeq (,$(PERFCTR_LIB_PATH))
ifeq (,$(PERFCTR_ROOT))
	PERFCTR_ROOT := $(PWD)/perfctr-$(VERSION)
endif
	PERFCTR_LIB_PATH := $(PERFCTR_ROOT)/usr.lib
	CC_SHR += -Wl,-rpath-link -Wl,$(PERFCTR_LIB_PATH)
endif
ifeq (,$(PERFCTR_INC_PATH))
ifeq (,$(PERFCTR_ROOT))
	PERFCTR_ROOT := $(PWD)/perfctr-$(VERSION)
endif
	PERFCTR_INC_PATH := $(PERFCTR_ROOT)/usr.lib
	PERFCTR_KINC_PATH := $(PERFCTR_ROOT)/linux/include
else
	PERFCTR_KINC_PATH := $(PERFCTR_INC_PATH)
endif
ifneq (/usr/include,$(PERFCTR_INC_PATH))
CFLAGS += -I$(PERFCTR_INC_PATH) 
endif
ifneq (/usr/include/linux/include,$(PERFCTR_KINC_PATH))
CFLAGS += -I$(PERFCTR_KINC_PATH) 
endif
endif

CFLAGS-2.6.x := -DPERFCTR26
CFLAGS-2.7.x := $(CFLAGS-2.6.x)
CFLAGS += $(CFLAGS-$(VERSION))
MISCHDRS += linux-lock.h mb.h
MISCSRCS +=  $(ARCH_SPEC_EVTS)
PERFCTR_OBJS = $(shell $(AR) t $(PERFCTR_LIB_PATH)/libperfctr.a 2> /dev/null)

ifeq (,$(PERFCTR_OBJS))
$(PERFCTR_LIB_PATH)/libperfctr.a:
ifneq (,${PERFCTR_ROOT})
 ifeq (ppc64,${ARCH})
	$(MAKE) CC='$(CC) $(BITFLAGS)' -C $(PERFCTR_ROOT)
 endif
 ifeq (x86_64,${ARCH})
   ifeq (-m32,${BITFLAGS})
	$(MAKE) CC='$(CC) $(BITFLAGS)' LD_FLAGS="-melf_i386" ARCH="i386" -C $(PERFCTR_ROOT)
   else
	$(MAKE) CC="$(CC)" -C $(PERFCTR_ROOT)
   endif
 else
	$(MAKE) CC="$(CC) -C $(PERFCTR_ROOT)
 endif
else
	@echo '$@ not installed!'; exit 1
endif
	$(MAKE)
endif

#Dynamic linking loader needs correct version of libperfctr
ifeq ($(VERSION),2.7.x)
	SO_ABIVER=6
else
ifeq ($(VERSION),2.6.x)
	i386_ABIVER=5
	x86_64_ABIVER=6
	ppc_ABIVER=5
	SO_ABIVER=$($(ARCH)_ABIVER)
endif
endif

POST_BUILD = cp $(PERFCTR_LIB_PATH)/libperfctr.so .;ln -fs libperfctr.so libperfctr.so.$(SO_ABIVER)

####################################################################
# This section builds libpfm to get at its support for native events
ifneq (/usr,$(PFM_PREFIX))
PWD = $(shell pwd)
ifeq (,$(PFM_LIB_PATH))
ifeq (,$(PFM_ROOT))
	PFM_ROOT := $(PWD)/libpfm-3.y
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)/libpfm-3.y
endif
        PFM_INC_PATH := $(PFM_ROOT)/include
endif
ifneq (/usr/include,$(PFM_INC_PATH))
CFLAGS	+= -I$(PFM_INC_PATH) 
endif
endif

CFLAGS	+= -DPERFCTR_PFM_EVENTS
PFM_OBJS=$(shell $(AR) t $(PFM_LIB_PATH)/libpfm.a 2>/dev/null)
PFM_LIBS=-L$(PFM_LIB_PATH) -lpfm
MISCSRCS += papi_libpfm3_events.c 
MISCOBJS += $(PERFCTR_OBJS) $(PFM_OBJS) $(MISCSRCS:.c=.o)
MISCHDRS += papi_libpfm_events.h
SHLIBDEPS = -Bdynamic -L$(PERFCTR_LIB_PATH) -lperfctr $(PFM_LIBS)

ifeq (,$(PFM_OBJS))
$(PFM_LIB_PATH)/libpfm.a:
	$(MAKE) -C $(PFM_ROOT) ARCH="$(ARCH)" CC="$(CC)" lib
	$(MAKE)
endif
####################################################################

include Makefile.inc

config.h:
	@echo 'Please clobber your build and run ./configure. Direct Makefile access has been deprecated.'

$(PERFCTR_OBJS): $(PERFCTR_LIB_PATH)/libperfctr.a
	$(AR) xv $<

$(PFM_OBJS): $(PFM_LIB_PATH)/libpfm.a
	$(AR) xv $<

#perfctr.o: perfctr.c $(HEADERS)
#	$(CC) $(LIBCFLAGS) $(OPTFLAGS) -c perfctr.c -o $@

papi_libpfm3_events.o: papi_libpfm3_events.c $(HEADERS)
	$(CC) $(LIBCFLAGS) $(OPTFLAGS) -c papi_libpfm3_events.c -o $@

native_clean:
	-rm -f $(MISCOBJS) libperfctr.so*
ifneq (,${PERFCTR_ROOT})
	$(MAKE) -C $(PERFCTR_ROOT) clean
endif
ifneq (,${PFM_ROOT})
	$(MAKE) -C $(PFM_ROOT) ARCH="$(ARCH)" clean
endif

native_install: 
	-install -d $(DESTDIR)$(DATADIR)
	-cp -f ./papi_events.csv $(DESTDIR)$(DATADIR)
ifeq ($(ARCH),ppc64)
	cp -Rf ./event_data $(DESTDIR)$(DATADIR)
endif
ifneq (,${PFM_ROOT})
	-$(MAKE) -C $(PFM_ROOT) ARCH="$(ARCH)" CC=$(CC) DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) install_prefix=$(PREFIX) LIBDIR=$(LIBDIR) INCDIR=$(INCDIR) MANDIR=$(MANDIR) install
endif
ifneq (,${PERFCTR_ROOT})
ifeq (-m32,${BITFLAGS})
	$(MAKE) -C $(PERFCTR_ROOT) PREFIX=$(DESTDIR)$(PREFIX) BINDIR=$(DESTDIR)$(BINDIR) LIBDIR=$(DESTDIR)$(LIBDIR) INCLDIR=$(DESTDIR)$(INCDIR) ARCH="i386" install
else
	$(MAKE) -C $(PERFCTR_ROOT) PREFIX=$(DESTDIR)$(PREFIX) BINDIR=$(DESTDIR)$(BINDIR) LIBDIR=$(DESTDIR)$(LIBDIR) INCLDIR=$(DESTDIR)$(INCDIR) install
endif
endif

native_clobber:
ifneq (,${PERFCTR_ROOT})
	$(MAKE) -C $(PERFCTR_ROOT) distclean
endif
ifneq (,${PFM_ROOT})
	 $(MAKE) -C $(PFM_ROOT) ARCH="$(ARCH)" distclean
endif