-
Notifications
You must be signed in to change notification settings - Fork 37
/
Makefile
37 lines (27 loc) · 790 Bytes
/
Makefile
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
PROGS = libzpoline.so
CC = gcc
CLEANFILES = $(PROGS) *.o *.d
SRCDIR ?= ./
NO_MAN=
CFLAGS = -O3 -pipe
CFLAGS += -g -rdynamic
CFLAGS += -Werror -Wall -Wunused-function
CFLAGS += -Wextra
CFLAGS += -shared -fPIC
CFLAGS += -DSUPPLEMENTAL__REWRITTEN_ADDR_CHECK
LD_VERSION = $(shell ld --version | head -1 | grep -oP '[\d\.]+' | sed 's/\.//' | sed 's/\..*//' | head -1 )
# differentiate the code according to the library version
ifeq ($(shell test $(LD_VERSION) -ge 239; echo $$?),0)
CFLAGS += -DDIS_ASM_VER_239
else ifeq ($(shell test $(LD_VERSION) -ge 229; echo $$?),0)
CFLAGS += -DDIS_ASM_VER_229
endif
LDFLAGS += -lopcodes -ldl
C_SRCS = main.c
OBJS = $(C_SRCS:.c=.o)
.PHONY: all
all: $(PROGS)
$(PROGS): $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
clean:
-@rm -rf $(CLEANFILES)