-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
86 lines (63 loc) · 2.61 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
ifneq ($(shell type xcrun >/dev/null 2>&1 && echo 1),1)
$(error "please use macOS to build the library for arm64e new abi")
endif
ifeq ($(shell type xcrun >/dev/null 2>&1 && echo 1),1)
TAPI ?= xcrun tapi
else ifeq ($(shell type tapi >/dev/null 2>&1 && echo 1),1)
TAPI ?= tapi
else
$(error "tapi not found")
endif
ALL := roothideinit.dylib libroothide.dylib libvroot.h libvroot.dylib libvrootapi.dylib updatelink symredirect jbrand jbroot rootfs
LIB_ARCHS = -arch arm64 -arch arm64e
CFLAGS += -fvisibility=hidden
CXXFLAGS += -fvisibility=hidden
CPPFLAGS += -fvisibility=hidden
LDFLAGS += -L./
.DEFAULT_GOAL := all
roothideinit.dylib: init.c common.c
$(CC) $(CFLAGS) $(LDFLAGS) $(LIB_ARCHS) -dynamiclib -install_name @loader_path/.jbroot/usr/lib/roothideinit.dylib -o $@ $^
jbroot.cpp.o: jbroot.cpp
$(CXX) $(CXXFLAGS) $(LIB_ARCHS) -stdlib=libc++ -c $< -o $@
libroothide.dylib: roothideinit.dylib jbroot.cpp.o jbroot.c jbroot.m cache.c common.c
$(CC) $(CFLAGS) $(LDFLAGS) $(LIB_ARCHS) -fobjc-arc -lc++ -dynamiclib -install_name @loader_path/.jbroot/usr/lib/libroothide.dylib -o $@ $^
$(TAPI) stubify $@
mkdir -p tbdfiles
mv libroothide.tbd ./tbdfiles/
libvroot.h: vroot.h
$(CPP) $(CPPFLAGS) -DVROOT_API_ALL $< > $@
vroot.cpp.o: vroot.cpp
$(CXX) $(CXXFLAGS) $(LIB_ARCHS) -stdlib=libc++ -c $< -o $@
libvroot.dylib: libroothide.dylib vroot.cpp.o vroot.c vroot_mktemp.c vroot_rootfs.c vroot_exec.c vroot_dlfcn.c common.c debug.m
$(CC) $(CFLAGS) $(LDFLAGS) $(LIB_ARCHS) -fobjc-arc -lc++ -dynamiclib -install_name @loader_path/.jbroot/usr/lib/libvroot.dylib -o $@ $^
$(TAPI) stubify $@
mkdir -p tbdfiles
mv libvroot.tbd ./tbdfiles/
libvrootapi.dylib: libvroot.dylib vrootapi.c
$(CC) $(CFLAGS) $(LDFLAGS) $(LIB_ARCHS) -dynamiclib -install_name @loader_path/.jbroot/usr/lib/libvrootapi.dylib -o $@ $^
$(TAPI) stubify $@
mkdir -p tbdfiles
mv libvrootapi.tbd ./tbdfiles/
updatelink: updatelink.c libroothide.dylib
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
symredirect: symredirect.cpp
$(CXX) $(CXXFLAGS) $(LDFLAGS) -std=c++11 -stdlib=libc++ -o $@ $^
jbrand: cmdtool.c libroothide.dylib
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
jbroot: cmdtool.c libroothide.dylib
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
rootfs: cmdtool.c libroothide.dylib
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
all: $(ALL)
mkdir devkit
mkdir devkit/roothide
cp ./roothide-xcode.h ./devkit/roothide.h
cp ./roothide.h ./devkit/roothide/
cp ./stub.h ./devkit/roothide/
cp ./tbdfiles/libroothide.tbd ./devkit/roothide/
cp ./module.modulemap ./devkit/roothide/
zip -r devkit.zip ./devkit
clean:
rm -f $(ALL) *.tbd *.o ./devkit.zip
rm -rf ./devkit ./tbdfiles
.PHONY: all clean