Files
sentry-native/Makefile
T
Armin Ronacher 786dd8a677 feat: Expose envelopes to C and change refcounting semantics (#71)
This exposes the envelopes to the C layer and changes the way we handle memory on
the C layer.

The tests showed we used memory management already incorrectly around our own
API and from the user's perspective it's nicer for lookups in structures to return
borrowed values instead of owned ones. This now removes sentry_value_free and
instead adds sentry_value_incref and senty_value_decref.

I removed free so that people upgrading are more likely to run into memory
management issues. They were already required to call free so all they need to
do now is to remove that call most likely and potentially call incref if they keep the
value around.
2019-10-24 13:32:08 +02:00

130 lines
3.1 KiB
Makefile

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