-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·54 lines (40 loc) · 1.07 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
49
50
51
52
53
54
ARCH=AARCH64
#ARCH=X64
CC=gcc
AR=ar
RANLIB=ranlib
ifeq ($(ARCH),X64)
CDEFS=-DX64
MEMCPY_O=memcpy_64.o
MEMCPY_S=memcpy_64.S
else
ifeq ($(ARCH),AARCH64)
CDEFS=-DAARCH64
MEMCPY_O=memcpy_arm64.o
MEMCPY_S=memcpy_arm64.S
endif
endif
CFLAGS=-fPIC -ggdb -O0 $(CDEFS)
LDFLAGS=-shared -fPIC -ggdb -O0 -rdynamic
LIBTHUNDER_OBJS = thunder_accel.o $(MEMCPY_O)
LIBTHUNDER_LOBJS = memcpy_64.lo thunder_accel.lo
LIBTHUNDER_SRCS = thunder_accel.c $(MEMCPY_S)
all: libthunder_accel.so test
test: test.o
$(CC) $(CFLAGS) -o $@ $<
test.o: test.c
$(CC) $(CFLAGS) -c $< -o $@
libthunder_accel.so: libthunder_accel.a
$(CC) $(LDFLAGS) -o libthunder_accel.so $(LIBTHUNDER_OBJS) -ldl
libthunder_accel.a: $(LIBTHUNDER_OBJS)
$(AR) cru libthunder_accel.a $(LIBTHUNDER_OBJS)
$(RANLIB) libthunder_accel.a
thunder_accel.o: thunder_accel.c
$(CC) $(CFLAGS) -c $< -o $@
$(MEMCPY_O): $(MEMCPY_S)
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f $(LIBTHUNDER_OBJS) libthunder_accel.so libthunder_accel.a test test.o
rm -rf .libs
run: all
LD_PRELOAD=/home/bill/src/libthunder_accel/libthunder_accel.so ./test