blob: af65aaa93e16807ed693e92b14e10d904365d2b9 [file] [log] [blame]
Ingo Molnarb6aa9972013-09-30 10:08:24 +02001
Ingo Molnar3ae069c2013-09-30 13:37:10 +02002FILES= \
3 test-hello \
Ingo Molnar90ac5422013-09-30 13:48:44 +02004 test-stackprotector-all \
Ingo Molnar430be5a2013-10-07 09:47:00 +02005 test-stackprotector \
Ingo Molnarc2510442013-09-30 13:58:12 +02006 test-volatile-register-var \
Ingo Molnar1ea6f992013-10-07 09:38:28 +02007 test-fortify-source \
Ingo Molnar78e9d652013-09-30 14:11:46 +02008 test-bionic \
Ingo Molnar8f7f8002013-09-30 14:20:25 +02009 test-libelf \
Ingo Molnare12762c2013-10-07 10:34:20 +020010 test-glibc \
Ingo Molnar8295d4e2013-10-07 10:35:39 +020011 test-dwarf \
Ingo Molnar8869b172013-09-30 15:02:28 +020012 test-libelf-mmap \
Ingo Molnarb7bcef62013-09-30 14:35:27 +020013 test-libelf-getphdrnum \
Ingo Molnar058f9522013-09-30 14:45:44 +020014 test-libunwind \
Ingo Molnard795a652013-09-30 14:55:31 +020015 test-libaudit \
Ingo Molnarb9498b52013-09-30 14:57:54 +020016 test-libslang \
Ingo Molnar7ef9e052013-09-30 15:01:56 +020017 test-gtk2 \
Ingo Molnarc7a79e92013-09-30 15:08:30 +020018 test-gtk2-infobar \
Ingo Molnar7181a672013-09-30 15:15:36 +020019 test-libperl \
Ingo Molnar97341632013-09-30 15:18:37 +020020 test-libpython \
Ingo Molnar95d061c2013-09-30 15:40:04 +020021 test-libpython-version \
Ingo Molnar3b7646e2013-09-30 15:53:31 +020022 test-libbfd \
Ingo Molnar3ae069c2013-09-30 13:37:10 +020023 test-libnuma
Ingo Molnarb6aa9972013-09-30 10:08:24 +020024
Ingo Molnar8b6eb562013-09-30 13:51:28 +020025CC := $(CC) -MD
26
Ingo Molnarb6aa9972013-09-30 10:08:24 +020027all: $(FILES)
28
29BUILD = $(CC) -o $(OUTPUT)$@ $@.c
30
31###############################
32
Ingo Molnar8b6eb562013-09-30 13:51:28 +020033test-hello:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020034 $(BUILD)
35
Ingo Molnar90ac5422013-09-30 13:48:44 +020036test-stackprotector-all:
37 $(BUILD) -Werror -fstack-protector-all
38
Ingo Molnar430be5a2013-10-07 09:47:00 +020039test-stackprotector:
40 $(BUILD) -Werror -fstack-protector
41
Ingo Molnarc2510442013-09-30 13:58:12 +020042test-volatile-register-var:
43 $(BUILD) -Werror -Wvolatile-register-var
44
Ingo Molnar1ea6f992013-10-07 09:38:28 +020045test-fortify-source:
46 $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
47
Ingo Molnar78e9d652013-09-30 14:11:46 +020048test-bionic:
49 $(BUILD)
50
Ingo Molnar8f7f8002013-09-30 14:20:25 +020051test-libelf:
52 $(BUILD) -lelf
53
Ingo Molnare12762c2013-10-07 10:34:20 +020054test-glibc:
55 $(BUILD)
56
Ingo Molnar8295d4e2013-10-07 10:35:39 +020057test-dwarf:
58 $(BUILD) -ldw
59
Ingo Molnar8869b172013-09-30 15:02:28 +020060test-libelf-mmap:
61 $(BUILD) -lelf
62
Ingo Molnarb7bcef62013-09-30 14:35:27 +020063test-libelf-getphdrnum:
64 $(BUILD) -lelf
65
Ingo Molnar3ae069c2013-09-30 13:37:10 +020066test-libnuma:
67 $(BUILD) -lnuma
68
Ingo Molnar058f9522013-09-30 14:45:44 +020069test-libunwind:
70 $(BUILD) -lunwind -lunwind-x86_64 -lelf
71
Ingo Molnard795a652013-09-30 14:55:31 +020072test-libaudit:
73 $(BUILD) -laudit
74
Ingo Molnarb9498b52013-09-30 14:57:54 +020075test-libslang:
76 $(BUILD) -I/usr/include/slang -lslang
77
Ingo Molnar7ef9e052013-09-30 15:01:56 +020078test-gtk2:
79 $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
80
Ingo Molnarc7a79e92013-09-30 15:08:30 +020081test-gtk2-infobar:
82 $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
83
Ingo Molnar7181a672013-09-30 15:15:36 +020084grep-libs = $(filter -l%,$(1))
85strip-libs = $(filter-out -l%,$(1))
86
87PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
88PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
89PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
90PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
91FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
92
93test-libperl:
94 $(BUILD) $(FLAGS_PERL_EMBED)
95
Ingo Molnar97341632013-09-30 15:18:37 +020096override PYTHON := python
97override PYTHON_CONFIG := python-config
98
99escape-for-shell-sq = $(subst ','\'',$(1))
100shell-sq = '$(escape-for-shell-sq)'
101
102PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG))
103
104PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
105PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
106PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
107PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
108FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
109
110test-libpython:
111 $(BUILD) $(FLAGS_PYTHON_EMBED)
112
Ingo Molnar95d061c2013-09-30 15:40:04 +0200113test-libpython-version:
114 $(BUILD) $(FLAGS_PYTHON_EMBED)
115
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200116test-libbfd:
117 $(BUILD) -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl
118
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200119-include *.d */*.d
120
Ingo Molnarb6aa9972013-09-30 10:08:24 +0200121###############################
122
123clean:
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200124 rm -f $(FILES) *.d