mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-08-26 11:17:40 +00:00
Proper incremental builds
Auto generate flag.h for precise rebuilding
This commit is contained in:
@@ -9,7 +9,6 @@ ifdef B_MAGISK
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := magisk
|
||||
LOCAL_STATIC_LIBRARIES := libnanopb libsystemproperties libutils libphmap libxhook
|
||||
LOCAL_C_INCLUDES := jni/include
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
core/applets.cpp \
|
||||
@@ -49,7 +48,6 @@ ifdef B_INIT
|
||||
|
||||
LOCAL_MODULE := magiskinit
|
||||
LOCAL_STATIC_LIBRARIES := libsepol libxz libutils
|
||||
LOCAL_C_INCLUDES := jni/include out
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
init/init.cpp \
|
||||
@@ -76,7 +74,6 @@ ifdef B_BOOT
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := magiskboot
|
||||
LOCAL_STATIC_LIBRARIES := libmincrypt liblzma liblz4 libbz2 libfdt libutils libz libzopfli
|
||||
LOCAL_C_INCLUDES := jni/include
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
magiskboot/main.cpp \
|
||||
@@ -99,7 +96,6 @@ ifdef B_POLICY
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := magiskpolicy
|
||||
LOCAL_STATIC_LIBRARIES := libsepol libutils
|
||||
LOCAL_C_INCLUDES := jni/include
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
core/applet_stub.cpp \
|
||||
@@ -120,7 +116,6 @@ ifdef B_PROP
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := resetprop
|
||||
LOCAL_STATIC_LIBRARIES := libnanopb libsystemproperties libutils
|
||||
LOCAL_C_INCLUDES := jni/include
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
core/applet_stub.cpp \
|
||||
@@ -139,7 +134,6 @@ ifneq (,$(wildcard jni/test.cpp))
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := test
|
||||
LOCAL_STATIC_LIBRARIES := libutils libphmap
|
||||
LOCAL_C_INCLUDES := jni/include
|
||||
LOCAL_SRC_FILES := test.cpp
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
|
@@ -10,10 +10,4 @@ APP_STRIP_MODE := --strip-all
|
||||
# Busybox should use stock libc.a
|
||||
ifdef B_BB
|
||||
APP_PLATFORM := android-22
|
||||
else
|
||||
# Make Busybox cflag stable
|
||||
APP_CFLAGS += -D__MVSTR=${MAGISK_VERSION} -D__MCODE=${MAGISK_VER_CODE}
|
||||
ifdef MAGISK_DEBUG
|
||||
APP_CFLAGS += -D__MDBG
|
||||
endif
|
||||
endif
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include <selinux.hpp>
|
||||
#include <db.hpp>
|
||||
#include <resetprop.hpp>
|
||||
#include <flags.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
#include "core.hpp"
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include <magisk.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <flags.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
#include "core.hpp"
|
||||
|
||||
|
@@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
/* Include this header anywhere accessing MAGISK_DEBUG, MAGISK_VERSION, MAGISK_VER_CODE.
|
||||
*
|
||||
* This file is for precise incremental builds. We can make sure code that uses
|
||||
* external flags are re-compiled by updating the timestamp of this file
|
||||
* */
|
||||
|
||||
#define quote(s) #s
|
||||
#define str(s) quote(s)
|
||||
|
||||
#define MAGISK_VERSION str(__MVSTR)
|
||||
#define MAGISK_VER_CODE __MCODE
|
||||
#define MAGISK_FULL_VER MAGISK_VERSION "(" str(MAGISK_VER_CODE) ")"
|
||||
|
||||
#define NAME_WITH_VER(name) str(name) " " MAGISK_FULL_VER
|
||||
|
||||
#ifdef __MDBG
|
||||
#define MAGISK_DEBUG
|
||||
#endif
|
@@ -6,10 +6,11 @@
|
||||
#include <vector>
|
||||
|
||||
#include <xz.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <binaries.h>
|
||||
|
||||
#include "binaries.h"
|
||||
#include "init.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#include <magisk.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <flags.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
#include "su.hpp"
|
||||
#include "pts.hpp"
|
||||
|
@@ -1,9 +1,11 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
# All Magisk common code lives here
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:= libutils
|
||||
LOCAL_C_INCLUDES := jni/include $(LOCAL_PATH)/include
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
LOCAL_C_INCLUDES := jni/include $(LOCAL_PATH)/include out/generated
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
|
||||
LOCAL_EXPORT_STATIC_LIBRARIES := libcxx
|
||||
LOCAL_STATIC_LIBRARIES := libcxx
|
||||
LOCAL_SRC_FILES := \
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <flags.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
#include "logging.hpp"
|
||||
|
||||
@@ -47,7 +47,7 @@ void cmdline_logging() {
|
||||
}
|
||||
|
||||
// LTO will optimize out the NOP function
|
||||
#ifdef MAGISK_DEBUG
|
||||
#if MAGISK_DEBUG
|
||||
void LOGD(const char *fmt, ...) { LOG_BODY(d) }
|
||||
#else
|
||||
void LOGD(const char *fmt, ...) {}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <bitset>
|
||||
|
||||
#include <utils.hpp>
|
||||
#include <flags.hpp>
|
||||
#include <flags.h>
|
||||
#include <daemon.hpp>
|
||||
|
||||
#include "inject.hpp"
|
||||
@@ -356,7 +356,7 @@ static int hook_register(const char *path, const char *symbol, void *new_func, v
|
||||
#define APP_PROCESS "^/system/bin/app_process.*"
|
||||
|
||||
void hook_functions() {
|
||||
#ifdef MAGISK_DEBUG
|
||||
#if MAGISK_DEBUG
|
||||
xhook_enable_debug(1);
|
||||
xhook_enable_sigsegv_protection(0);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user