2023-03-22 12:10:19 +08:00
|
|
|
NAME = Tumbleweed
|
2023-02-13 14:16:29 +08:00
|
|
|
|
2023-01-16 16:17:41 +08:00
|
|
|
SRC = $(shell pwd)
|
|
|
|
|
DEP = $(SRC)/dep_root
|
2023-01-18 01:30:20 +08:00
|
|
|
STRIP = strip
|
2023-01-21 18:27:07 +08:00
|
|
|
CC ?= cc
|
2023-02-04 21:29:49 +08:00
|
|
|
CFLAGS += -I$(DEP)/include -I$(SRC)/include -I$(SRC)
|
2023-01-28 20:54:06 +08:00
|
|
|
CFLAGS += -Wall -Wextra -DPALERAIN_VERSION=\"2.0.0\" -Wall -Wextra -Wno-unused-parameter
|
2023-03-25 13:35:44 +08:00
|
|
|
CFLAGS += -Wno-unused-variable -I$(SRC)/src -std=c99 -pedantic-errors -D_C99_SOURCE -D_POSIX_C_SOURCE=200112L
|
2023-01-29 01:02:47 +08:00
|
|
|
LIBS += $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a
|
|
|
|
|
LIBS += $(DEP)/lib/libimobiledevice-glue-1.0.a $(DEP)/lib/libplist-2.0.a -pthread
|
2023-01-18 16:09:51 +08:00
|
|
|
ifeq ($(TARGET_OS),)
|
|
|
|
|
TARGET_OS = $(shell uname -s)
|
|
|
|
|
endif
|
|
|
|
|
ifeq ($(TARGET_OS),Darwin)
|
2023-02-07 17:17:16 +08:00
|
|
|
CFLAGS += -Wno-nullability-extension
|
2023-01-30 22:33:02 +08:00
|
|
|
ifeq (,$(findstring version-min=, $(CFLAGS)))
|
2023-01-21 18:27:07 +08:00
|
|
|
CFLAGS += -mmacosx-version-min=10.8
|
2023-01-24 15:46:50 +08:00
|
|
|
endif
|
2023-01-22 12:17:37 +08:00
|
|
|
LDFLAGS += -Wl,-dead_strip
|
2023-02-15 12:50:04 +08:00
|
|
|
LIBS += -framework CoreFoundation -framework IOKit
|
2023-01-21 18:27:07 +08:00
|
|
|
else
|
2023-01-22 12:17:37 +08:00
|
|
|
CFLAGS += -fdata-sections -ffunction-sections
|
2023-02-25 00:09:07 +08:00
|
|
|
LDFLAGS += -static -no-pie -Wl,--gc-sections
|
2023-01-18 16:09:51 +08:00
|
|
|
endif
|
2023-01-24 15:46:50 +08:00
|
|
|
LIBS += $(DEP)/lib/libmbedtls.a $(DEP)/lib/libmbedcrypto.a $(DEP)/lib/libmbedx509.a $(DEP)/lib/libreadline.a
|
2023-01-16 16:17:41 +08:00
|
|
|
|
2023-01-18 01:30:20 +08:00
|
|
|
ifeq ($(DEV_BUILD),1)
|
2023-02-04 21:29:49 +08:00
|
|
|
LIBS += $(DEP)/lib/libnewt.a $(DEP)/lib/libpopt.a $(DEP)/lib/libslang.a
|
2023-02-05 03:25:12 +08:00
|
|
|
ifeq ($(TARGET_OS),Linux)
|
|
|
|
|
LIBS += $(DEP)/lib/libgpm.a
|
|
|
|
|
endif
|
2023-02-01 23:35:45 +08:00
|
|
|
CFLAGS += -O0 -g -DDEV_BUILD -fno-omit-frame-pointer
|
|
|
|
|
ifeq ($(ASAN),1)
|
2023-02-01 23:58:56 +08:00
|
|
|
BUILD_STYLE=ASAN
|
|
|
|
|
CFLAGS += -fsanitize=address,undefined -fsanitize-address-use-after-return=runtime
|
2023-02-14 17:34:18 +08:00
|
|
|
else ifeq ($(TSAN),1)
|
|
|
|
|
BUILD_STYLE=TSAN
|
|
|
|
|
CFLAGS += -fsanitize=thread,undefined
|
2023-01-18 01:30:20 +08:00
|
|
|
else
|
2023-02-01 23:58:56 +08:00
|
|
|
BUILD_STYLE = DEVELOPMENT
|
2023-01-18 01:30:20 +08:00
|
|
|
endif
|
2023-02-01 23:35:45 +08:00
|
|
|
else
|
2023-02-01 23:58:56 +08:00
|
|
|
CFLAGS += -Os -g
|
|
|
|
|
BUILD_STYLE = RELEASE
|
2023-02-01 23:35:45 +08:00
|
|
|
endif
|
2023-02-25 00:09:07 +08:00
|
|
|
LIBS += -lc
|
2023-02-13 10:46:33 +08:00
|
|
|
|
2023-02-13 11:07:42 +08:00
|
|
|
ifneq ($(BAKERAIN_DEVELOPE_R),)
|
|
|
|
|
CFLAGS += -DBAKERAIN_DEVELOPE_R="\"$(BAKERAIN_DEVELOPE_R)\""
|
2023-02-13 10:46:33 +08:00
|
|
|
endif
|
|
|
|
|
|
2023-02-01 23:58:56 +08:00
|
|
|
BUILD_DATE := $(shell LANG=C date)
|
2023-03-22 12:10:19 +08:00
|
|
|
BUILD_NUMBER := $(shell git rev-list --count HEAD)
|
2023-02-01 23:58:56 +08:00
|
|
|
BUILD_TAG := $(shell git describe --dirty --tags --abbrev=7)
|
|
|
|
|
BUILD_WHOAMI := $(shell whoami)
|
2023-03-22 12:10:19 +08:00
|
|
|
BUILD_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
|
|
|
|
BUILD_COMMIT := $(shell git rev-parse HEAD)
|
2023-01-18 01:30:20 +08:00
|
|
|
|
2023-03-22 12:10:19 +08:00
|
|
|
CFLAGS += -DBUILD_STYLE="\"$(BUILD_STYLE)\"" -DBUILD_DATE="\"$(BUILD_DATE)\""
|
|
|
|
|
CFLAGS += -DBUILD_WHOAMI="\"$(BUILD_WHOAMI)\"" -DBUILD_TAG="\"$(BUILD_TAG)\""
|
|
|
|
|
CFLAGS += -DBUILD_NUMBER="\"$(BUILD_NUMBER)\"" -DBUILD_BRANCH="\"$(BUILD_BRANCH)\""
|
|
|
|
|
CFLAGS += -DBUILD_COMMIT="\"$(BUILD_COMMIT)\""
|
2023-02-01 23:58:56 +08:00
|
|
|
|
2023-03-22 12:10:19 +08:00
|
|
|
export SRC DEP CC CFLAGS LDFLAGS LIBS TARGET_OS DEV_BUILD BUILD_DATE BUILD_TAG BUILD_WHOAMI BUILD_STYLE BUILD_NUMBER BUILD_BRANCH
|
2023-01-16 16:17:41 +08:00
|
|
|
|
|
|
|
|
all: palera1n
|
|
|
|
|
|
2023-01-30 22:33:02 +08:00
|
|
|
palera1n: download-deps
|
2023-01-16 16:17:41 +08:00
|
|
|
$(MAKE) -C src
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|
$(MAKE) -C src clean
|
2023-02-06 16:33:14 +08:00
|
|
|
$(MAKE) -C docs clean
|
2023-01-16 16:17:41 +08:00
|
|
|
|
2023-01-30 22:33:02 +08:00
|
|
|
download-deps:
|
2023-03-28 12:43:46 +08:00
|
|
|
$(MAKE) -C src checkra1n-macos checkra1n-linux-arm64 checkra1n-linux-armel checkra1n-linux-x86 checkra1n-linux-x86_64 checkra1n-kpf-pongo ramdisk.dmg binpack.dmg Pongo.bin
|
2023-01-21 16:19:33 +08:00
|
|
|
|
2023-02-06 16:33:14 +08:00
|
|
|
docs:
|
|
|
|
|
$(MAKE) -C docs
|
2023-02-06 15:53:02 +08:00
|
|
|
|
2023-01-16 17:53:38 +08:00
|
|
|
distclean: clean
|
2023-03-28 12:43:46 +08:00
|
|
|
rm -rf palera1n-* palera1n*.dSYM src/checkra1n-* src/checkra1n-kpf-pongo src/ramdisk.dmg src/binpack.dmg src/Pongo.bin
|
2023-01-16 17:53:38 +08:00
|
|
|
|
2023-02-06 16:33:14 +08:00
|
|
|
.PHONY: all palera1n clean docs distclean
|
2023-01-22 12:17:37 +08:00
|
|
|
|