2023-01-16 16:17:41 +08:00
|
|
|
all: palera1n
|
|
|
|
|
|
2023-02-10 22:34:29 +08:00
|
|
|
OBJECTS = main.o dfuhelper.o devhelper.o lockdown_helper.o
|
2023-02-11 19:23:57 +08:00
|
|
|
OBJECTS += optparse.o override_file.o log.o lock_vars.o credits.o
|
2023-02-10 22:34:29 +08:00
|
|
|
OBJECTS += fake_embedded.o exec_checkra1n.o pongo_helper.o
|
2023-03-08 16:49:02 +08:00
|
|
|
OBJECTS += boyermoore_memmem.o
|
2023-02-10 22:34:29 +08:00
|
|
|
|
2023-02-20 20:00:24 +08:00
|
|
|
ifeq (,$(findstring macosx, $(CFLAGS)))
|
|
|
|
|
ifneq (,$(findstring version-min=, $(CFLAGS)))
|
|
|
|
|
OBJECTS += xxd-libcheckra1nhelper.dylib.o
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
2023-02-20 20:40:04 +08:00
|
|
|
ifeq ($(FORCE_HELPER),1)
|
2023-02-20 20:00:24 +08:00
|
|
|
OBJECTS += xxd-libcheckra1nhelper.dylib.o
|
2023-02-20 20:40:04 +08:00
|
|
|
CFLAGS += -DFORCE_HELPER
|
2023-03-29 12:22:58 +08:00
|
|
|
BUILD_OPTIONS += FORCE_HELPER
|
2023-02-20 20:00:24 +08:00
|
|
|
endif
|
2023-02-11 19:23:57 +08:00
|
|
|
|
2023-02-10 22:34:29 +08:00
|
|
|
ifneq ($(NO_RAMDISK),1)
|
|
|
|
|
OBJECTS += xxd-ramdisk.dmg.o
|
|
|
|
|
else
|
|
|
|
|
CFLAGS += -DNO_RAMDISK
|
2023-03-29 12:22:58 +08:00
|
|
|
BUILD_OPTIONS += NO_RAMDISK
|
2023-02-10 22:34:29 +08:00
|
|
|
endif
|
|
|
|
|
ifneq ($(NO_KPF),1)
|
|
|
|
|
OBJECTS += xxd-checkra1n-kpf-pongo.o
|
|
|
|
|
else
|
|
|
|
|
CFLAGS += -DNO_KPF
|
2023-03-29 12:22:58 +08:00
|
|
|
BUILD_OPTIONS += NO_KPF
|
2023-02-10 22:34:29 +08:00
|
|
|
endif
|
2023-03-28 23:17:29 +08:00
|
|
|
ifneq ($(NO_OVERLAY),1)
|
2023-02-10 22:34:29 +08:00
|
|
|
OBJECTS += xxd-binpack.dmg.o
|
|
|
|
|
else
|
2023-03-28 23:17:29 +08:00
|
|
|
CFLAGS += -DNO_OVERLAY
|
2023-03-29 12:22:58 +08:00
|
|
|
BUILD_OPTIONS += NO_OVERLAY
|
2023-02-10 22:34:29 +08:00
|
|
|
endif
|
|
|
|
|
ifneq ($(NO_CHECKRAIN),1)
|
|
|
|
|
OBJECTS += xxd-checkra1n.o
|
|
|
|
|
else
|
|
|
|
|
CFLAGS += -DNO_CHECKRAIN
|
2023-03-29 12:22:58 +08:00
|
|
|
BUILD_OPTIONS += NO_CHECKRAIN
|
2023-02-10 22:34:29 +08:00
|
|
|
endif
|
|
|
|
|
|
2023-03-28 12:43:46 +08:00
|
|
|
ifneq ($(NO_CUSTOM_PONGO),1)
|
|
|
|
|
OBJECTS += xxd-Pongo.bin.o
|
|
|
|
|
else
|
|
|
|
|
CFLAGS += -DNO_CUSTOM_PONGO
|
2023-03-29 12:22:58 +08:00
|
|
|
BUILD_OPTIONS += NO_CUSTOM_PONGO
|
2023-03-28 12:43:46 +08:00
|
|
|
endif
|
|
|
|
|
|
2023-03-29 18:46:01 +08:00
|
|
|
ifeq ($(TUI),1)
|
2023-01-29 13:16:12 +08:00
|
|
|
OBJECTS += tui_screen_enter_recovery.o tui_screen_enter_dfu.o tui_main.o
|
|
|
|
|
OBJECTS += tui_screen_jailbreak.o tui_screen_main.o tui_screen_options.o
|
2023-03-29 18:46:01 +08:00
|
|
|
BUILD_OPTIONS += TUI
|
|
|
|
|
CFLAGS += -DTUI
|
2023-01-29 13:16:12 +08:00
|
|
|
endif
|
2023-01-28 16:24:22 +08:00
|
|
|
|
2023-06-06 10:11:11 -04:00
|
|
|
CHECKRA1N_VERSION ?= 0.1337.2
|
2023-01-16 17:53:38 +08:00
|
|
|
LIPO = lipo
|
2023-01-24 15:46:50 +08:00
|
|
|
LDID = ldid
|
2023-01-16 16:17:41 +08:00
|
|
|
|
2023-02-08 16:47:04 +08:00
|
|
|
ifeq ($(TARGET_OS),Darwin)
|
|
|
|
|
ifneq ($(USE_LIBUSB),1)
|
|
|
|
|
OBJECTS += usb_iokit.o
|
2023-02-15 12:50:04 +08:00
|
|
|
else
|
|
|
|
|
LIBS += -framework SystemConfiguration -framework Security
|
2023-03-29 12:22:58 +08:00
|
|
|
BUILD_OPTIONS += USE_LIBUSB
|
2023-02-08 16:47:04 +08:00
|
|
|
endif
|
2023-03-23 23:13:21 +09:00
|
|
|
# add lto and debug symbols for lto
|
|
|
|
|
CFLAGS += -flto=full -g
|
|
|
|
|
LDFLAGS += -Wl,-object_path_lto,lto.o
|
2023-02-08 16:47:04 +08:00
|
|
|
else
|
|
|
|
|
USE_LIBUSB = 1
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifeq ($(USE_LIBUSB),1)
|
|
|
|
|
OBJECTS += usb_libusb.o
|
|
|
|
|
CFLAGS += -DUSE_LIBUSB=1
|
|
|
|
|
LIBS += $(DEP)/lib/libusb-1.0.a
|
|
|
|
|
endif
|
|
|
|
|
|
2023-07-02 03:47:00 +08:00
|
|
|
ifeq ($(ROOTFUL),1)
|
2023-03-29 12:22:58 +08:00
|
|
|
CFLAGS += -DROOTFUL=1
|
|
|
|
|
BUILD_OPTIONS += ROOTFUL
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifeq ($(BUILD_OPTIONS),)
|
|
|
|
|
BUILD_OPTIONS = (none)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
CFLAGS += -DBUILD_OPTIONS=\""$(BUILD_OPTIONS)"\"
|
|
|
|
|
|
2023-01-21 16:19:33 +08:00
|
|
|
checkra1n-%:
|
2023-01-21 16:30:22 +08:00
|
|
|
curl -LO https://assets.checkra.in/downloads/preview/$(CHECKRA1N_VERSION)/$@
|
2023-01-21 16:19:33 +08:00
|
|
|
chmod 755 $@
|
|
|
|
|
|
2023-01-24 15:46:50 +08:00
|
|
|
checkra1n: checkra1n-macos usb.xml
|
2023-01-21 18:27:07 +08:00
|
|
|
ifeq ($(TARGET_OS),Darwin)
|
2023-01-16 17:53:38 +08:00
|
|
|
ifneq (,$(findstring arm64, $(CFLAGS)))
|
|
|
|
|
$(LIPO) -thin arm64 -output checkra1n checkra1n-macos
|
2023-01-17 19:26:37 +08:00
|
|
|
else ifneq (,$(findstring x86_64, $(CFLAGS)))
|
2023-01-16 17:53:38 +08:00
|
|
|
$(LIPO) -thin x86_64 -output checkra1n checkra1n-macos
|
2023-02-07 15:37:52 +01:00
|
|
|
else ifeq ($(shell arch),i386)
|
2023-02-07 15:38:47 +01:00
|
|
|
$(LIPO) -thin x86_64 -output checkra1n checkra1n-macos
|
2023-01-17 19:26:37 +08:00
|
|
|
else
|
|
|
|
|
$(LIPO) -thin $(shell arch) -output checkra1n checkra1n-macos
|
2023-01-16 17:53:38 +08:00
|
|
|
endif
|
2023-01-24 15:46:50 +08:00
|
|
|
ifeq (,$(findstring macosx, $(CFLAGS)))
|
|
|
|
|
ifneq (,$(findstring version-min=, $(CFLAGS)))
|
2023-01-24 19:22:34 +08:00
|
|
|
vtool -remove-build-version 1 -replace -output checkra1n checkra1n
|
|
|
|
|
vtool -set-build-version $(FAKE_PLATFORM) $(FAKE_MINOS) $(FAKE_SDK) -replace -output checkra1n checkra1n
|
|
|
|
|
install_name_tool -change /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit /System/Library/Frameworks/IOKit.framework/IOKit checkra1n
|
|
|
|
|
install_name_tool -change /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation checkra1n
|
2023-01-24 15:46:50 +08:00
|
|
|
$(LDID) -Susb.xml checkra1n
|
|
|
|
|
endif
|
|
|
|
|
endif
|
2023-01-21 18:27:07 +08:00
|
|
|
else
|
|
|
|
|
cp checkra1n-$(CHECKRA1N_NAME) checkra1n
|
|
|
|
|
endif
|
2023-01-16 16:17:41 +08:00
|
|
|
|
2023-01-28 16:24:22 +08:00
|
|
|
xxd-%.c: %
|
|
|
|
|
xxd -iC $< > $@
|
2023-01-16 17:33:12 +08:00
|
|
|
|
2023-02-05 02:42:12 +08:00
|
|
|
%.o: %.c $(wildcard ../include/*.h)
|
2023-01-16 17:53:38 +08:00
|
|
|
$(CC) -c $(CFLAGS) $<
|
|
|
|
|
|
2023-01-16 16:17:41 +08:00
|
|
|
palera1n: $(OBJECTS)
|
2023-01-21 21:00:41 +08:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o palera1n
|
2023-01-24 15:46:50 +08:00
|
|
|
ifeq (,$(findstring macosx, $(CFLAGS)))
|
|
|
|
|
ifneq (,$(findstring version-min=, $(CFLAGS)))
|
|
|
|
|
$(LDID) -Susb.xml palera1n
|
|
|
|
|
endif
|
|
|
|
|
endif
|
2023-01-16 16:17:41 +08:00
|
|
|
|
2023-02-20 20:00:24 +08:00
|
|
|
libcheckra1nhelper.dylib: chkstk.S
|
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -shared chkstk.S -o libcheckra1nhelper.dylib
|
|
|
|
|
|
2023-01-30 22:33:02 +08:00
|
|
|
checkra1n-kpf-pongo:
|
2023-02-12 14:01:40 -05:00
|
|
|
curl -LO https://cdn.nickchan.lol/palera1n/artifacts/kpf/checkra1n-kpf-pongo
|
2023-01-30 22:33:02 +08:00
|
|
|
|
|
|
|
|
ramdisk.dmg:
|
2023-05-17 23:49:23 -05:00
|
|
|
curl -LO https://cdn.nickchan.lol/palera1n/c-rewrite/deps/ramdisk.dmg
|
2023-01-30 22:33:02 +08:00
|
|
|
|
|
|
|
|
binpack.dmg:
|
|
|
|
|
curl -LO https://cdn.nickchan.lol/palera1n/c-rewrite/deps/binpack.dmg
|
|
|
|
|
|
2023-03-28 12:43:46 +08:00
|
|
|
Pongo.bin:
|
|
|
|
|
curl -LO https://cdn.nickchan.lol/palera1n/artifacts/kpf/Pongo.bin
|
|
|
|
|
|
2023-01-16 16:17:41 +08:00
|
|
|
clean:
|
2023-02-20 20:00:24 +08:00
|
|
|
rm -rf *.o palera1n checkra1n checkra1n.c palera1n.dSYM libcheckra1nhelper.dylib
|
2023-01-16 16:17:41 +08:00
|
|
|
|
2023-01-16 18:06:23 +08:00
|
|
|
.PHONY: all clean
|