Makefile 937 Bytes
Newer Older
“李磊”'s avatar
“李磊” committed
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
# Makefile for building dynamic libraries for Android NDK and x86

# Compiler settings
NDK_PATH = /usr/local/android-ndk-r19c
NDK_TOOLCHAIN = $(NDK_PATH)/toolchains/llvm/prebuilt/linux-x86_64/bin
NDK_CC = $(NDK_TOOLCHAIN)/armv7a-linux-androideabi28-clang
GCC = gcc

# Compiler flags
CFLAGS = -shared -fPIC -g -O2 -Wall -I./
COMM_FLAGS = -DHAVE_CONFIG_H
NDK_FLAGS = -DHAVE_ANDROID_H
X86_FLAGS = -DDEBUG -DNODLOPEN

# Source files
SOURCES = bwstat.c atomicio.c strlcpy.c strlcat.c trickle-overload.c

# Output files
NDK = ndk
X86 = x86
NDK_OUT = trickle-overload-ndk.so
X86_OUT = trickle-overload-x86.so

# Default target
all: $(NDK) $(X86)

# Rule for NDK dynamic library
$(NDK): $(SOURCES)
	$(NDK_CC) $(CFLAGS) $^ -o $(NDK_OUT)  $(COMM_FLAGS) $(NDK_FLAGS)

# Rule for x86 dynamic library
$(X86): $(SOURCES)
	$(GCC) $(CFLAGS) $^ -o $(X86_OUT) $(COMM_FLAGS) $(X86_FLAGS)

# Clean up
clean:
	rm -f $(NDK_OUT) $(X86_OUT)

.PHONY: all clean