This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
48 lines (35 loc) · 1.56 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
CC ?= gcc
CFLAGS += -Ofast -fPIC -fvisibility=hidden -flto -finline-functions #-fprofile-use=program.gcda #-fprofile-generate #-g -fsanitize=address
LDFLAGS += -flto
PREFIX ?= /usr
ODIR=build
SDIR=src
_OBJ = cfg.o disassembler.o tnt_cache.o decoder.o libxdc.o mmh3.o trace_cache.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
default: libxdc.so libxdc.a ptdump ptdump_static
$(ODIR)/%.o: $(SDIR)/%.c $(SDIR)/*.h libxdc.h
mkdir -p build
$(CC) -c -o $@ $< $(CFLAGS)
libxdc.so: $(OBJ)
$(CC) $^ -o $@ -shared $(CFLAGS) $(LDFLAGS) -l:libcapstone.so.4
libxdc.a: $(OBJ)
$(AR) rcs $@ $^
ptdump: libxdc.so test/*.c test/*.h
$(CC) test/ptdump.c test/page_cache.c test/helper.c -o build/$@ -Itest/ -I./ -Lbuild/ $(CFLAGS) $(LDFLAGS) -lxdc -l:libcapstone.so.4
ptdump_static: libxdc.a test/*.c test/*.h
$(CC) test/ptdump.c test/page_cache.c test/helper.c -o build/$@ -Itest/ -I./ $(CFLAGS) $(LDFLAGS) -L. -l:libxdc.a -l:libcapstone.a
tester_dyn: libxdc.so test/*.c test/*.h
$(CC) test/tester.c test/page_cache.c test/helper.c -o $@ -Itest/ -I./ $(CFLAGS) $(LDFLAGS) -L. -lxdc -l:libcapstone.so.4
tester_static: libxdc.a test/*.c test/*.h
$(CC) test/tester.c test/page_cache.c test/helper.c -o $@ -Itest/ -I./ $(CFLAGS) $(LDFLAGS) -L. -l:libxdc.a -l:libcapstone.a
install: libxdc.so libxdc.a ptdump
mkdir -p $(PREFIX)/include $(PREFIX)/lib
install -m0644 libxdc.h $(PREFIX)/include/
install -m0755 libxdc.so $(PREFIX)/lib/
install -m0755 libxdc.a $(PREFIX)/lib/
install -m0755 build/ptdump $(PREFIX)/bin/
.PHONY: clean install
clean:
rm -f $(ODIR)/*.o build/*
rm -f libxdc.so
rm -f libxdc.a