summaryrefslogtreecommitdiff
path: root/misc/radare2/GNUmakefile
blob: ef9e809e8654753c67a9f436c961baa85d349133 (plain)
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
MAKEFLAGS += --no-builtin-rules
R2_PLUGIN_PATH ?= $(shell r2 -H R2_USER_PLUGINS)

WARNINGS := -Wall -Wextra -Wformat=2 -Wstrict-aliasing=3 -Wstrict-overflow=5 -Wstack-usage=12500 \
        -Wfloat-equal -Wcast-align -Wpointer-arith -Wchar-subscripts -Warray-bounds=2

override CFLAGS ?= -g -O2 $(WARNINGS)
override CFLAGS += -std=c11
override CPPFLAGS ?= -D_FORTIFY_SOURCE=2

libs = asm_fspec.so anal_fspec.so
all: $(libs)

%.so:
        $(LINK.c) -fPIC -shared $(filter %.c,$^) $(LDLIBS) -o $@

asm_fspec.so: private CFLAGS += $(shell pkg-config --cflags r_anal)
asm_fspec.so: private LDLIBS += $(shell pkg-config --libs-only-l r_anal)
asm_fspec.so: asm_fspec.c

anal_fspec.so: private CFLAGS += $(shell pkg-config --cflags r_anal)
anal_fspec.so: private LDLIBS += $(shell pkg-config --libs-only-l r_anal)
anal_fspec.so: anal_fspec.c

install: $(libs)
        install -Dm755 $^ -t "$(R2_PLUGIN_PATH)"

uninstall:
        $(RM) "$(R2_PLUGIN_PATH)"/asm_fspec.so
        $(RM) "$(R2_PLUGIN_PATH)"/anal_fspec.so

clean:
        $(RM) $(libs)

.PHONY: all clean install uninstall