This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
zhangyang-libzt/Makefile

128 lines
3.6 KiB
Makefile

DIST_BUILD_SCRIPT := ./dist.sh
#EXECUTABLES = cmake
#build_reqs := $(foreach exec,$(EXECUTABLES),\
# $(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH")))
.PHONY: list
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= \
-F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") \
{print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
# Pull all submodules
update:
@git submodule update --init
@git submodule status
# Patch submodules (issue update first)
patch:
#-cd ext/lwip; git apply ../lwip.patch;
#-cd ext/lwip-contrib; git apply ../lwip-contrib.patch;
#-cd ext/ZeroTierOne; git apply ../ZeroTierOne.patch;
# Target-specific clean
clean_ios:
-rm -rf ports/xcode_ios
-rm -rf ports/xcode_ios_simulator
clean_macos:
-rm -rf ports/xcode_macos
clean_android:
-rm -rf pkg/android/app/build
-find pkg -name ".externalNativeBuild" -exec rm -r "{}" \;
$(DIST_BUILD_SCRIPT) android "clean"
clean_products:
-rm -rf products
.PHONY: clean
clean: clean_ios clean_macos clean_android
$(DIST_BUILD_SCRIPT) clean
# Use CMake generators to build projects from CMakeLists.txt
projects:
$(DIST_BUILD_SCRIPT) generate_projects
# Android
android_debug:
$(DIST_BUILD_SCRIPT) android "debug"
$(DIST_BUILD_SCRIPT) clean_android_project
$(DIST_BUILD_SCRIPT) prep_android_example "debug"
android_release:
$(DIST_BUILD_SCRIPT) android "release"
$(DIST_BUILD_SCRIPT) clean_android_project
$(DIST_BUILD_SCRIPT) prep_android_example "release"
android: android_debug android_release
prep_android_debug_example:
$(DIST_BUILD_SCRIPT) prep_android_example "debug"
prep_android_release_example:
$(DIST_BUILD_SCRIPT) prep_android_example "release"
# macOS
macos_debug:
$(DIST_BUILD_SCRIPT) macos "debug"
macos_release:
$(DIST_BUILD_SCRIPT) macos "release"
macos: macos_debug macos_release
# xcframework
xcframework:
xcodebuild -project ports/apple/zt.xcodeproj archive -scheme zt -sdk macosx -archivePath build/macosx
xcodebuild -project ports/apple/zt.xcodeproj archive -scheme zt -sdk iphoneos -archivePath build/iphoneos
xcodebuild -project ports/apple/zt.xcodeproj archive -scheme zt -sdk iphonesimulator -archivePath build/iphonesimulator
xcodebuild -create-xcframework \
-framework build/macosx.xcarchive/Products/Library/Frameworks/zt.framework \
-framework build/iphoneos.xcarchive/Products/Library/Frameworks/zt.framework \
-framework build/iphonesimulator.xcarchive/Products/Library/Frameworks/zt.framework \
-output lib/zt.xcframework
rm -rf build/macosx.xcarchive
rm -rf build/iphoneos.xcarchive
rm -rf build/iphonesimulator.xcarchive
# iOS
ios_debug:
$(DIST_BUILD_SCRIPT) ios "debug"
ios_release:
$(DIST_BUILD_SCRIPT) ios "release"
ios: ios_debug ios_release
# Host
host_release:
$(DIST_BUILD_SCRIPT) host "release"
host_debug:
$(DIST_BUILD_SCRIPT) host "debug"
host_clean:
$(DIST_BUILD_SCRIPT) host "clean"
host_jar_debug:
$(DIST_BUILD_SCRIPT) host_jar "debug"
host_jar_release:
$(DIST_BUILD_SCRIPT) host_jar "release"
host_jar: host_jar_debug host_jar_release
host_pinvoke_release:
$(DIST_BUILD_SCRIPT) host_pinvoke "release"
host_pinvoke_debug:
$(DIST_BUILD_SCRIPT) host_pinvoke "debug"
host_pinvoke: host_pinvoke_release host_pinvoke_debug
host: host_debug host_release
# Build every target available on this host
all: host host_pinvoke host_jar macos ios android
$(DIST_BUILD_SCRIPT) display
# [For distribution process only] Prepare remote builds
wrap:
$(DIST_BUILD_SCRIPT) wrap
# Binary distribution
bdist:
$(DIST_BUILD_SCRIPT) merge
$(DIST_BUILD_SCRIPT) bdist
# Source distribution
sdist: update patch
$(DIST_BUILD_SCRIPT) sdist
dist: bdist sdist