From 84403cfce99b929aafc9d221aab4ea1bf290f953 Mon Sep 17 00:00:00 2001 From: Nick Chan Date: Mon, 16 Jan 2023 17:53:38 +0800 Subject: [PATCH] fixes --- .gitignore | 2 ++ Makefile | 19 ++++++++++++++++--- src/Makefile | 14 +++++++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index d10fad9..4bb21d4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ contrib/ checkra1n* payload.c src/palera1n +palera1n* +!checkra1n.h diff --git a/Makefile b/Makefile index 364518b..51df783 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,13 @@ SRC = $(shell pwd) DEP = $(SRC)/dep_root CC = cc -CFLAGS = -mmacosx-version-min=12.0 -I$(DEP)/include -I/opt/procursus/include -I$(SRC)/include -I$(SRC) -g -O0 -Wall -Wextra +CFLAGS += -mmacosx-version-min=12.0 -I$(DEP)/include -I/opt/procursus/include -I$(SRC)/include -I$(SRC) -Os -Wall -Wextra LIBS = $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a $(DEP)/lib/libplist-2.0.a $(DEP)/lib/libimobiledevice-glue-1.0.a -pthread -LIBS += $(DEP)/lib/libcrypto.35.tbd $(DEP)/lib/libssl.35.tbd +LIBS += $(DEP)/lib/libcrypto.35.tbd $(DEP)/lib/libssl.35.tbd LIBS += -framework CoreFoundation -framework SystemConfiguration -framework IOKit LDFLAGS = $(LIBS) -export SRC DEP CC CFLAGS LDFLAGS +export SRC DEP CC CFLAGS LDFLAGS LIBS all: palera1n @@ -17,4 +17,17 @@ palera1n: clean: $(MAKE) -C src clean +dist: + $(MAKE) clean + $(MAKE) all CFLAGS='-arch arm64 $(CFLAGS)' + cp src/palera1n palera1n-arm64 + $(MAKE) clean + $(MAKE) all CFLAGS='-arch x86_64 $(CFLAGS)' + cp src/palera1n palera1n-x86_64 + $(MAKE) clean + lipo -create -arch arm64 palera1n-arm64 -arch x86_64 palera1n-x86_64 -output palera1n-macos + +distclean: clean + rm -f palera1n-* + .PHONY: all palera1n clean diff --git a/src/Makefile b/src/Makefile index cd7b089..b34be54 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,17 +1,25 @@ all: palera1n OBJECTS = main.o dfuhelper.o lockdown_helper.o devhelper.o exec_checkra1n.o checkra1n.o +LIPO = lipo -%.o: %.c - $(CC) -c $(CFLAGS) $< +checkra1n: checkra1n-macos +ifneq (,$(findstring arm64, $(CFLAGS))) + $(LIPO) -thin arm64 -output checkra1n checkra1n-macos +else + $(LIPO) -thin x86_64 -output checkra1n checkra1n-macos +endif checkra1n.c: checkra1n xxd -iC checkra1n > checkra1n.c +%.o: %.c + $(CC) -c $(CFLAGS) $< + palera1n: $(OBJECTS) $(CC) $(OBJECTS) $(CFLAGS) $(LDFLAGS) -o palera1n clean: - rm -f *.o palera1n + rm -f *.o palera1n checkra1n .PHONY: all clean \ No newline at end of file