File: Rules.perfctr

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 (110 lines) | stat: -rw-r--r-- 2,984 bytes parent folder | download | duplicates (4)
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
DESCR = "Linux with PerfCtr $(VERSION) patch and 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)
SHLIBDEPS = -Bdynamic -L$(PERFCTR_LIB_PATH) -lperfctr
PERFCTR_OBJS = $(shell $(AR) t $(PERFCTR_LIB_PATH)/libperfctr.a 2> /dev/null)
MISCOBJS = $(PERFCTR_OBJS) $(MISCSRCS:.c=.o) 

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) -C $(PERFCTR_ROOT)
   endif
 else
	$(MAKE) -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)

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 $<
	
$(CPU)_events.o: $(CPU)_events.c $(HEADERS)
	$(CC) $(LIBCFLAGS) $(OPTFLAGS) -c $(CPU)_events.c -o $@

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

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

native_install: 
ifeq ($(ARCH),ppc64)
	-mkdir -p $(DESTDIR)$(DATADIR)
	-chmod go+rx $(DESTDIR)$(DATADIR)
	cp -Rf ./event_data $(DESTDIR)$(DATADIR)
endif
ifneq (,${PERFCTR_ROOT})
ifeq (-m32,${BITFLAGS})
	$(MAKE) -C $(PERFCTR_ROOT) PREFIX=$(DESTDIR)$(PREFIX) DESTDIR=$(DESTDIR) BINDIR=$(DESTDIR)$(BINDIR) LIBDIR=$(DESTDIR)$(LIBDIR) INCLDIR=$(DESTDIR)$(INCDIR) ARCH="i386" install
else
	$(MAKE) -C $(PERFCTR_ROOT) PREFIX=$(DESTDIR)$(PREFIX) DESTDIR=$(DESTDIR) BINDIR=$(DESTDIR)$(BINDIR) LIBDIR=$(DESTDIR)$(LIBDIR) INCLDIR=$(DESTDIR)$(INCDIR) install
endif
endif

native_clobber:
ifneq (,${PERFCTR_ROOT})
	$(MAKE) -C $(PERFCTR_ROOT) distclean
endif