blob: 951bca5872337495209077488519fab4d7ae25e8 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
PREFIX ?= /usr/local
BINDIR ?= /bin
MAKEFLAGS += --no-builtin-rules
WARNINGS := -Wall -Wextra -Wpedantic -Wformat=2 -Wstrict-aliasing=3 -Wstrict-overflow=3 -Wstack-usage=12500 \
-Wfloat-equal -Wcast-align -Wpointer-arith -Wchar-subscripts -Warray-bounds=2 -Wno-unused-parameter
override CFLAGS ?= -g
override CFLAGS += -std=c11 $(WARNINGS)
override CPPFLAGS += -Isrc
bins = app
all: $(bins) runtime/libc.so runtime/libandroid.so runtime/liblog.so
%.o: %.c
$(COMPILE.c) $^ -o $@
%.so:
$(LINK.c) -shared $(filter %.c,$^) $(LDLIBS) -o $@
%.a:
$(AR) rvs $@ $^
$(bins): %:
$(LINK.c) $(filter %.c %.a,$^) $(LDLIBS) -o $@
runtime:
mkdir -p $@
runtime/libc.so: private CFLAGS += -D_GNU_SOURCE
runtime/libc.so: runtime src/libc.c
runtime/libpthread.so: private CFLAGS += -D_GNU_SOURCE
runtime/libpthread.so: private LDLIBS += -lpthread
runtime/libpthread.so: runtime src/libpthread.c
runtime/libandroid.so: private LDLIBS += `pkg-config --libs glfw3`
runtime/libandroid.so: runtime src/libandroid.c
runtime/liblog.so: runtime src/liblog.c
native: runtime/libc.so runtime/libpthread.so runtime/libandroid.so runtime/liblog.so
runtime/libjvm-android.so: runtime src/libjvm-android.c
java: runtime/libjvm-android.so
linker.a: CFLAGS += -D_GNU_SOURCE -DANDROID_X86_LINKER -DLINKER_DEBUG=1
linker.a: CFLAGS += -Wno-pedantic -Wno-variadic-macros -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
linker.a: src/linker/dlfcn.o src/linker/linker.o src/linker/linker_environ.o src/linker/rt.o src/linker/strlcpy.o
jvm.a: CFLAGS += -D_GNU_SOURCE
jvm.a: CFLAGS += -Wno-unused-variable -Wno-pedantic
jvm.a: src/jvm/jvm.o
app: private LDLIBS += -ldl -Wl,-rpath,runtime
app: src/app.c linker.a native jvm.a java
install-bin: $(bins)
install -Dm755 $^ -t "$(DESTDIR)$(PREFIX)$(BINDIR)"
install: install-bin
clean:
$(RM) $(bins) *.a src/linker/*.o src/jvm/*.o
$(RM) -r runtime
.PHONY: all clean install
|