I think I made all build types conditional on having the appropriate build tools available, and make all make everything currently possible.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4531 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-10-18 14:24:44 +00:00
parent 1b2b0970fb
commit 9da79b3a21

View File

@ -11,12 +11,18 @@ PROJECT = tildefriends
BUILD_DIR ?= out
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
ANDROID_SDK ?= ~/Android/Sdk
ifeq ($(UNAME_S),Darwin)
BUILD_TYPES := macosdebug macosrelease iosdebug iosrelease iossimdebug iossimrelease
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
HAVE_ANDROID = $(if $(shell which $(ANDROID_SDK)/platform-tools/adb),1,0)
HAVE_LINUX_IOS = $(if $(shell which deps/ios_toolchain/target/bin deps/ios_toolchain/target/bin/arm-apple-darwin11-clang),1,0)
HAVE_WIN = $(if $(shell which x86_64-w64-mingw32-gcc-win32),1,0)
else
$(error Unexpected host platform $(UNAME_S).)
endif
CFLAGS += \
@ -29,7 +35,6 @@ CFLAGS += \
-fno-exceptions \
-g
ANDROID_SDK ?= ~/Android/Sdk
ANDROID_BUILD_TOOLS := $(ANDROID_SDK)/build-tools/33.0.1
ANDROID_PLATFORM := $(ANDROID_SDK)/platforms/android-33
ANDROID_NDK ?= $(ANDROID_SDK)/ndk/23.1.7779620
@ -52,12 +57,21 @@ ANDROID_TARGETS := \
$(ANDROID_X86_64_TARGETS) \
$(ANDROID_ARMV7A_TARGETS) \
$(ANDROID_ARM64_TARGETS)
LINUX_TARGETS := \
out/debug/tildefriends \
out/release/tildefriends
ifeq ($(HAVE_ANDROID),1)
BUILD_TYPES += $(ANDROID_TARGETS)
all: out/TildeFriends-debug.apk out/TildeFriends-release.apk
endif
WINDOWS_TARGETS := \
out/windebug/tildefriends.exe \
out/winrelease/tildefriends.exe
ifeq ($(HAVE_WIN),1)
BUILD_TYPES += windebug winrelease
endif
LINUX_TARGETS := \
out/debug/tildefriends \
out/release/tildefriends
MACOS_TARGETS := \
out/macosdebug/tildefriends \
out/macosrelease/tildefriends
@ -67,6 +81,18 @@ IOS_TARGETS := \
IOSSIM_TARGETS := \
out/iossimdebug/tildefriends \
out/iossimrelease/tildefriends
IOS_APPS = \
out/tildefriends-iosdebug.app/tildefriends \
out/tildefriends-iosrelease.app/tildefriends
ifeq ($(HAVE_LINUX_IOS),1)
BUILD_TYPES += iosdebug iosrelease
all: $(IOS_APPS)
endif
ifeq ($(UNAME_S),Darwin)
all: $(IOS_APPS) \
out/tildefriends-iossimdebug.app/tildefriends \
out/tildefriends-iossimrelease.app/tildefriends
endif
DEBUG_TARGETS := \
out/debug/tildefriends \
@ -161,7 +187,7 @@ debug: LDFLAGS += -fsanitize=address -fsanitize=undefined
endif
get_objs = \
$(foreach build_type,$(BUILD_TYPES) $(EXTRA_BUILD_TYPES),$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)))))) \
$(foreach build_type,$(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))))) \
@ -523,12 +549,6 @@ $(IOS_TARGETS) $(IOSSIM_TARGETS): LDFLAGS += \
unix: debug release
win: windebug winrelease
all: $(BUILD_TYPES)
ifeq ($(UNAME_S),Linux)
all: out/TildeFriends-debug.apk out/TildeFriends-release.apk
endif
ifeq ($(UNAME_S),Darwin)
all: out/tildefriends-iosdebug.app/tildefriends out/tildefriends-iosrelease.app/tildefriends out/tildefriends-iossimdebug.app/tildefriends out/tildefriends-iossimrelease.app/tildefriends
endif
.PHONY: all win unix
ALL_APP_OBJS := \
@ -570,7 +590,7 @@ $(BUILD_DIR)/$(1)/%.o: %.S
@$$(AS) -c $$< -o $$@
endef
$(foreach build_type,$(BUILD_TYPES) $(EXTRA_BUILD_TYPES),$(eval $(call build_rules,$(build_type))))
$(foreach build_type,$(BUILD_TYPES),$(eval $(call build_rules,$(build_type))))
src/version.h : $(firstword $(MAKEFILE_LIST))
@echo [version] $@