forked from getsentry/sentry-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
129 lines (102 loc) · 3.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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
PREMAKE_DIR := premake
PREMAKE := premake5
SOLUTION_NAME := Sentry-Native
ifeq ($(OS),Windows_NT)
# Windows specific
else
# Mac or Linux
CPUS ?= $(shell getconf _NPROCESSORS_ONLN)
INTERACTIVE := $(shell [ -t 0 ] && echo 1)
UNAME_S := $(shell uname -s)
endif
help:
@echo "Usage: make [target]"
@echo ""
@echo "TARGETS:"
@echo " fetch"
@echo " fetch-breakpad"
@echo " fetch-crashpad"
@echo " clean"
@echo " clean-breakpad"
@echo " clean-crashpad"
@echo " clean-build"
@echo ""
@echo "LINUX ONLY:"
@echo " configure"
@echo " test"
.PHONY: help
# Dependency Download
fetch: fetch-breakpad fetch-crashpad
.PHONY: fetch
fetch-breakpad:
breakpad/fetch_breakpad.sh
.PHONY: fetch-breakpad
fetch-crashpad:
crashpad/fetch_crashpad.sh
.PHONY: fetch-crashpad
# Cleanup
clean: clean-breakpad clean-crashpad clean-build
.PHONY: clean
clean-breakpad:
rm -rf breakpad/build
.PHONY: clean-breakpad
clean-crashpad:
rm -rf crashpad/build
.PHONY: clean-crashpad
clean-build:
git clean -xdf -e $(PREMAKE_DIR)/$(PREMAKE) -- $(PREMAKE_DIR)
.PHONY: clean-build
# Development on Linux / macOS.
# Does not work on Windows or Android
configure: $(PREMAKE_DIR)/Makefile
.PHONY: configure
test: configure
$(MAKE) -C $(PREMAKE_DIR) -j$(CPUS) test_sentry
$(PREMAKE_DIR)/bin/Release/test_sentry
.PHONY: test
lldb-test: configure
$(MAKE) -C $(PREMAKE_DIR) -j$(CPUS) config=debug test_sentry
lldb $(PREMAKE_DIR)/bin/Debug/test_sentry
.PHONY: lldb-test
$(PREMAKE_DIR)/Makefile: $(PREMAKE_DIR)/$(PREMAKE) $(wildcard $(PREMAKE_DIR)/*.lua)
@cd $(PREMAKE_DIR) && ./$(PREMAKE) gmake2
@touch $@
$(PREMAKE_DIR)/$(PREMAKE):
@echo "Downloading premake"
$(eval PREMAKE_DIST := $(if $(filter Darwin, $(UNAME_S)), macosx, linux))
@curl -sL https://github.com/premake/premake-core/releases/download/v5.0.0-alpha14/premake-5.0.0-alpha14-$(PREMAKE_DIST).tar.gz | tar xz -C $(PREMAKE_DIR)
linux-build-env:
@docker build ${DOCKER_BUILD_ARGS} -t getsentry/sentry-native .
.PHONY: linux-build-env
linux-run:
ifneq ("${SHOW_DOCKER_BUILD}","1")
$(eval OUTPUT := >/dev/null)
endif
@$(MAKE) linux-build-env ${OUTPUT}
ifeq ("${INTERACTIVE}","1")
$(eval DOCKER_ARGS := -it)
endif
$(eval CMD ?= bash)
# We need seccomp:unconfined so we can test crashing inside the container
@docker run --rm -v ${PWD}:/work \
--security-opt seccomp:unconfined \
${DOCKER_ARGS} getsentry/sentry-native ${CMD}
.PHONY: linux-run
linux-shell:
@$(MAKE) linux-run SHOW_DOCKER_BUILD=1
.PHONY: linux-shell
### Android ###
$(PREMAKE_DIR)/$(SOLUTION_NAME)_Application.mk: $(PREMAKE_DIR)/$(PREMAKE) $(wildcard $(PREMAKE_DIR)/*.lua)
@cd $(PREMAKE_DIR) && ./$(PREMAKE) --os=android androidmk
@touch $@
android-configure: $(PREMAKE_DIR)/$(SOLUTION_NAME)_Application.mk
.PHONY: android-configure
android-build:
ifneq ("${ANDROID_NO_CONFIGURE}","1")
@$(MAKE) android-configure
endif
cd $(PREMAKE_DIR) && ndk-build V=1 NDK_APPLICATION_MK=./$(SOLUTION_NAME)_Application.mk NDK_PROJECT_PATH=. PM5_CONFIG=release -j$(CPUS)
.PHONY: android-build
android-test: android-build
./$(PREMAKE_DIR)/scripts/android.sh run-tests
.PHONY: android-test