From 0bb45a7fa8f1c143fc209d04e6b86c7f61a91b21 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Tue, 17 Oct 2023 22:25:31 +0000 Subject: [PATCH] Whoa. Allow building the ios executable on Linux. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4529 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- Makefile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 799a52c4..1d74c92c 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,10 @@ UNAME_S := $(shell uname -s) UNAME_M := $(shell uname -m) ifeq ($(UNAME_S),Darwin) BUILD_TYPES := macosdebug macosrelease iosdebug iosrelease iossimdebug iossimrelease -else -BUILD_TYPES := debug release windebug winrelease androiddebug androidrelease androiddebug-x86 androidrelease-x86 androiddebug-x86_64 androidrelease-x86_64 androiddebug-armv7a androidrelease-armv7a +EXTRA_BUILD_TYPES := +else ifeq ($(UNAME_S),Linux) +BUILD_TYPES := debug release +EXTRA_BUILD_TYPES := windebug winrelease androiddebug androidrelease androiddebug-x86 androidrelease-x86 androiddebug-x86_64 androidrelease-x86_64 androiddebug-armv7a androidrelease-armv7a iosdebug iosrelease endif CFLAGS += \ @@ -86,13 +88,14 @@ RELEASE_TARGETS := \ out/androidrelease-armv7a/tildefriends \ out/androidrelease-x86_64/tildefriends \ out/androidrelease-x86/tildefriends +ALL_TARGETS = $(DEBUG_TARGETS) $(RELEASE_TARGETS) ANDROID_RELEASE_TARGETS := $(filter-out $(DEBUG_TARGETS),$(ANDROID_TARGETS)) NONANDROID_RELEASE_TARGETS := $(filter-out $(ANDROID_ARM64_TARGETS),$(RELEASE_TARGETS)) -NONANDROID_TARGETS := $(filter-out $(ANDROID_TARGETS),$(DEBUG_TARGETS) $(RELEASE_TARGETS)) -NONMACOS_TARGETS := $(filter-out $(MACOS_TARGETS) $(IOS_TARGETS) $(IOSSIM_TARGETS),$(DEBUG_TARGETS) $(RELEASE_TARGETS)) +NONANDROID_TARGETS := $(filter-out $(ANDROID_TARGETS),$(ALL_TARGETS)) +NONMACOS_TARGETS := $(filter-out $(MACOS_TARGETS) $(IOS_TARGETS) $(IOSSIM_TARGETS),$(ALL_TARGETS)) $(NONANDROID_TARGETS): CFLAGS += -fno-omit-frame-pointer -$(filter-out $(ANDROID_TARGETS) $(WINDOWS_TARGETS),$(DEBUG_TARGETS) $(RELEASE_TARGETS)): LDFLAGS += -rdynamic +$(filter-out $(ANDROID_TARGETS) $(WINDOWS_TARGETS),$(ALL_TARGETS)): LDFLAGS += -rdynamic $(ANDROID_TARGETS): CFLAGS += \ --sysroot $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/sysroot \ -fPIC \ @@ -122,6 +125,10 @@ $(IOS_TARGETS): IOS_SYSROOT := $(shell xcrun --sdk iphoneos --show-sdk-path) $(IOS_TARGETS): CC = xcrun --sdk iphoneos clang -isysroot $(IOS_SYSROOT) -arch arm64 $(IOSSIM_TARGETS): IOSSIM_SYSROOT := $(shell xcrun --sdk iphonesimulator --show-sdk-path) $(IOSSIM_TARGETS): CC = xcrun --sdk iphonesimulator clang -isysroot $(IOSSIM_SYSROOT) -arch x86_64 +else ifeq ($(UNAME_S),Linux) +$(IOS_TARGETS): IOS_SYSROOT := deps/iPhoneOS17.0.sdk +$(IOS_TARGETS): CC = PATH=$$PATH:deps/ios_toolchain/target/bin deps/ios_toolchain/target/bin/arm-apple-darwin11-clang +$(IOS_TARGETS): CFLAGS = -mios-version-min=6.0 endif $(ANDROID_X86_64_TARGETS): ANDROID_NDK_TARGET_TRIPLE := x86_64-linux-android $(ANDROID_X86_TARGETS): ANDROID_NDK_TARGET_TRIPLE := i686-linux-android @@ -154,7 +161,7 @@ debug: LDFLAGS += -fsanitize=address -fsanitize=undefined endif get_objs = \ - $(foreach build_type,$(BUILD_TYPES),$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)))))) \ + $(foreach build_type,$(BUILD_TYPES) $(EXTRA_BUILD_TYPES),$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)))))) \ $(foreach build_type,debug release,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_unix))))) \ $(foreach build_type,windebug winrelease,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_win))))) \ $(foreach build_type,androiddebug androidrelease androiddebug-x86 androidrelease-x86 androiddebug-x86_64 androidrelease-x86_64 androiddebug-armv7a androiddebug-armv7a,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_android))))) \ @@ -563,7 +570,7 @@ $(BUILD_DIR)/$(1)/%.o: %.S @$$(AS) -c $$< -o $$@ endef -$(foreach build_type,$(BUILD_TYPES),$(eval $(call build_rules,$(build_type)))) +$(foreach build_type,$(BUILD_TYPES) $(EXTRA_BUILD_TYPES),$(eval $(call build_rules,$(build_type)))) src/version.h : $(firstword $(MAKEFILE_LIST)) @echo [version] $@