2022-08-21 13:17:23 -04:00
|
|
|
.ONESHELL:
|
|
|
|
.DELETE_ON_ERROR:
|
|
|
|
MAKEFLAGS += --warn-undefined-variables
|
|
|
|
MAKEFLAGS += --no-builtin-rules
|
|
|
|
|
2023-06-28 19:23:29 -04:00
|
|
|
VERSION_CODE := 8
|
2023-06-28 19:00:34 -04:00
|
|
|
VERSION_NUMBER := 0.0.8
|
|
|
|
VERSION_NAME := The secret ingredient is love.
|
2023-06-28 19:23:29 -04:00
|
|
|
|
|
|
|
PROJECT = tildefriends
|
2021-01-02 13:10:00 -05:00
|
|
|
BUILD_DIR ?= out
|
2023-03-13 23:17:01 -04:00
|
|
|
BUILD_TYPES := debug release windebug winrelease androiddebug androidrelease androiddebug-x86_64 androidrelease-x86_64
|
2022-01-22 15:20:21 -05:00
|
|
|
UNAME_M := $(shell uname -m)
|
2021-01-02 13:10:00 -05:00
|
|
|
|
2021-10-03 18:14:06 -04:00
|
|
|
CFLAGS += \
|
2021-01-02 13:10:00 -05:00
|
|
|
-Wall \
|
|
|
|
-Wextra \
|
|
|
|
-Wno-unused-parameter \
|
|
|
|
-Wno-cast-function-type \
|
|
|
|
-MMD \
|
|
|
|
-ffunction-sections \
|
2022-09-24 16:54:54 -04:00
|
|
|
-fdata-sections \
|
2023-03-19 20:29:46 -04:00
|
|
|
-fno-exceptions \
|
2022-09-24 16:54:54 -04:00
|
|
|
-g
|
2023-01-17 19:07:02 -05:00
|
|
|
LDFLAGS += -Wl,--gc-sections
|
2021-10-03 18:14:06 -04:00
|
|
|
|
2023-03-14 23:21:20 -04:00
|
|
|
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
|
2023-03-15 18:14:21 -04:00
|
|
|
ANDROID_NDK_API_VERSION := 31
|
2023-03-10 22:47:01 -05:00
|
|
|
ANDROID_MIN_SDK_VERSION := 26
|
2022-12-29 16:58:54 -05:00
|
|
|
|
2023-03-13 23:17:01 -04:00
|
|
|
ANDROID_ARM64_TARGETS := \
|
2023-03-06 22:02:16 -05:00
|
|
|
out/androiddebug/tildefriends \
|
2023-03-10 22:47:01 -05:00
|
|
|
out/androidrelease/tildefriends
|
2023-03-13 23:17:01 -04:00
|
|
|
ANDROID_X86_64_TARGETS := \
|
|
|
|
out/androiddebug-x86_64/tildefriends \
|
|
|
|
out/androidrelease-x86_64/tildefriends
|
|
|
|
ANDROID_TARGETS := \
|
|
|
|
$(ANDROID_X86_64_TARGETS) \
|
|
|
|
$(ANDROID_ARM64_TARGETS)
|
|
|
|
|
2023-03-15 19:55:22 -04:00
|
|
|
DEBUG_TARGETS := \
|
|
|
|
out/debug/tildefriends \
|
|
|
|
out/windebug/tildefriends \
|
|
|
|
out/androiddebug/tildefriends \
|
|
|
|
out/androiddebug-x86_64/tildefriends
|
|
|
|
RELEASE_TARGETS := \
|
|
|
|
out/release/tildefriends \
|
|
|
|
out/winrelease/tildefriends \
|
|
|
|
out/androidrelease/tildefriends \
|
|
|
|
out/androidrelease-x86_64/tildefriends
|
2023-03-19 16:25:50 -04:00
|
|
|
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))
|
2023-03-15 19:55:22 -04:00
|
|
|
|
2023-03-19 20:29:46 -04:00
|
|
|
$(NONANDROID_TARGETS): CFLAGS += -fno-omit-frame-pointer
|
|
|
|
$(NONANDROID_TARGETS): LDFLAGS += -rdynamic
|
|
|
|
$(ANDROID_TARGETS): CFLAGS += \
|
|
|
|
--sysroot $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/sysroot \
|
2023-05-09 21:47:20 -04:00
|
|
|
-fPIC \
|
2023-05-03 20:44:32 -04:00
|
|
|
-fdebug-compilation-dir . \
|
2023-03-19 20:29:46 -04:00
|
|
|
-fomit-frame-pointer \
|
|
|
|
-fno-asynchronous-unwind-tables
|
2023-05-09 21:47:20 -04:00
|
|
|
$(ANDROID_TARGETS): LDFLAGS += --sysroot $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC
|
2023-03-15 19:55:22 -04:00
|
|
|
$(DEBUG_TARGETS): CFLAGS += -DDEBUG -Og
|
2023-03-19 16:25:50 -04:00
|
|
|
$(RELEASE_TARGETS): CFLAGS += -DNDEBUG
|
|
|
|
$(NONANDROID_RELEASE_TARGETS): CFLAGS += -O3
|
|
|
|
$(ANDROID_RELEASE_TARGETS): CFLAGS += -Os
|
2022-12-29 18:55:49 -05:00
|
|
|
windebug winrelease: CC = x86_64-w64-mingw32-gcc-win32
|
2022-05-25 20:47:36 -04:00
|
|
|
windebug winrelease: AS = $(CC)
|
2022-12-29 18:55:49 -05:00
|
|
|
windebug winrelease: CFLAGS += \
|
|
|
|
-D_WIN32_WINNT=0x0A00 \
|
|
|
|
-DWINVER=0x0A00 \
|
|
|
|
-DNTDDI_VERSION=NTDDI_WIN10 \
|
|
|
|
-Ideps/openssl/mingw64/include
|
|
|
|
windebug winrelease: LDFLAGS += \
|
|
|
|
-static \
|
|
|
|
-lm \
|
|
|
|
-Ldeps/openssl/mingw64/lib
|
2023-03-13 23:17:01 -04:00
|
|
|
$(ANDROID_X86_64_TARGETS): ANDROID_NDK_TARGET_TRIPLE := x86_64-linux-android
|
|
|
|
$(ANDROID_ARM64_TARGETS): ANDROID_NDK_TARGET_TRIPLE := aarch64-linux-android
|
2023-03-06 22:02:16 -05:00
|
|
|
$(ANDROID_TARGETS): CC = $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
|
|
|
|
$(ANDROID_TARGETS): AS = $(CC)
|
|
|
|
$(ANDROID_TARGETS): CFLAGS += \
|
2023-03-04 14:10:05 -05:00
|
|
|
-target $(ANDROID_NDK_TARGET_TRIPLE)$(ANDROID_NDK_API_VERSION) \
|
2022-12-29 16:58:54 -05:00
|
|
|
-Wno-unknown-warning-option
|
2023-03-13 23:17:01 -04:00
|
|
|
$(ANDROID_ARM64_TARGETS): CFLAGS += -Ideps/openssl/android/arm64-v8a/usr/local/include
|
|
|
|
$(ANDROID_ARM64_TARGETS): LDFLAGS += -Ldeps/openssl/android/arm64-v8a/usr/local/lib
|
|
|
|
$(ANDROID_X86_64_TARGETS): CFLAGS += -Ideps/openssl/android/x86_64/usr/local/include
|
|
|
|
$(ANDROID_X86_64_TARGETS): LDFLAGS += -Ldeps/openssl/android/x86_64/usr/local/lib
|
2021-10-03 18:14:06 -04:00
|
|
|
|
2022-01-22 15:20:21 -05:00
|
|
|
ifeq ($(UNAME_M),x86_64)
|
2022-09-24 16:54:54 -04:00
|
|
|
debug: CFLAGS += -fsanitize=address -fsanitize=undefined -fno-common
|
2022-01-22 15:20:21 -05:00
|
|
|
debug: LDFLAGS += -fsanitize=address -fsanitize=undefined
|
2022-01-22 15:13:14 -05:00
|
|
|
endif
|
|
|
|
|
2022-05-25 20:47:36 -04:00
|
|
|
get_objs = \
|
2022-05-30 13:24:42 -04:00
|
|
|
$(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))))) \
|
2022-12-29 16:58:54 -05:00
|
|
|
$(foreach build_type,windebug winrelease,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_win))))) \
|
2023-03-13 23:17:01 -04:00
|
|
|
$(foreach build_type,androiddebug androidrelease androiddebug-x86_64 androidrelease-x86_64,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_android))))) \
|
|
|
|
$(foreach build_type,androiddebug androidrelease androiddebug-x86_64 androidrelease-x86_64,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_unix)))))
|
2022-05-25 20:47:36 -04:00
|
|
|
|
|
|
|
APP_SOURCES := $(wildcard src/*.c)
|
|
|
|
APP_OBJS := $(call get_objs,APP_SOURCES)
|
2021-01-02 13:10:00 -05:00
|
|
|
$(APP_OBJS): CFLAGS += \
|
|
|
|
-Ideps/base64c/include \
|
|
|
|
-Ideps/crypt_blowfish \
|
2022-09-24 17:10:23 -04:00
|
|
|
-Ideps/libbacktrace \
|
2022-03-07 22:42:47 -05:00
|
|
|
-Ideps/libsodium \
|
2022-05-16 18:30:14 -04:00
|
|
|
-Ideps/libsodium/src/libsodium/include \
|
2022-09-24 17:10:23 -04:00
|
|
|
-Ideps/libuv/include \
|
2023-03-08 18:59:11 -05:00
|
|
|
-Ideps/zlib \
|
|
|
|
-Ideps/zlib/contrib/minizip \
|
2022-12-31 11:47:10 -05:00
|
|
|
-Ideps/picohttpparser \
|
2022-09-24 17:10:23 -04:00
|
|
|
-Ideps/quickjs \
|
|
|
|
-Ideps/sqlite \
|
2022-07-09 10:50:27 -04:00
|
|
|
-Ideps/valgrind \
|
2022-09-24 17:10:23 -04:00
|
|
|
-Ideps/xopt \
|
2023-04-29 23:00:57 -04:00
|
|
|
-Wdouble-promotion \
|
2021-01-03 20:58:50 -05:00
|
|
|
-Werror
|
2021-01-02 13:10:00 -05:00
|
|
|
|
2022-05-25 20:47:36 -04:00
|
|
|
BLOWFISH_SOURCES := \
|
2021-01-02 13:10:00 -05:00
|
|
|
deps/crypt_blowfish/crypt_blowfish.c \
|
|
|
|
deps/crypt_blowfish/crypt_gensalt.c \
|
|
|
|
deps/crypt_blowfish/wrapper.c
|
2022-05-25 20:47:36 -04:00
|
|
|
BLOWFISH_SOURCES_win = \
|
2022-05-16 18:30:14 -04:00
|
|
|
deps/crypt_blowfish/x86.S
|
2022-05-25 20:47:36 -04:00
|
|
|
BLOWFISH_OBJS := $(call get_objs,BLOWFISH_SOURCES)
|
2021-01-02 13:10:00 -05:00
|
|
|
|
2022-05-25 20:47:36 -04:00
|
|
|
UV_SOURCES := \
|
2021-01-02 13:10:00 -05:00
|
|
|
deps/libuv/src/fs-poll.c \
|
|
|
|
deps/libuv/src/idna.c \
|
|
|
|
deps/libuv/src/inet.c \
|
|
|
|
deps/libuv/src/random.c \
|
|
|
|
deps/libuv/src/strscpy.c \
|
2022-09-21 20:38:26 -04:00
|
|
|
deps/libuv/src/strtok.c \
|
2021-01-02 13:10:00 -05:00
|
|
|
deps/libuv/src/threadpool.c \
|
|
|
|
deps/libuv/src/timer.c \
|
2022-05-16 18:30:14 -04:00
|
|
|
deps/libuv/src/uv-common.c \
|
|
|
|
deps/libuv/src/uv-data-getter-setters.c \
|
|
|
|
deps/libuv/src/version.c
|
2022-05-25 20:47:36 -04:00
|
|
|
UV_SOURCES_unix := \
|
2021-01-02 13:10:00 -05:00
|
|
|
deps/libuv/src/unix/async.c \
|
|
|
|
deps/libuv/src/unix/core.c \
|
|
|
|
deps/libuv/src/unix/dl.c \
|
|
|
|
deps/libuv/src/unix/fs.c \
|
|
|
|
deps/libuv/src/unix/getaddrinfo.c \
|
|
|
|
deps/libuv/src/unix/getnameinfo.c \
|
2023-05-21 17:36:51 -04:00
|
|
|
deps/libuv/src/unix/linux.c \
|
2021-01-02 13:10:00 -05:00
|
|
|
deps/libuv/src/unix/loop-watcher.c \
|
|
|
|
deps/libuv/src/unix/loop.c \
|
|
|
|
deps/libuv/src/unix/pipe.c \
|
|
|
|
deps/libuv/src/unix/poll.c \
|
|
|
|
deps/libuv/src/unix/process.c \
|
|
|
|
deps/libuv/src/unix/procfs-exepath.c \
|
|
|
|
deps/libuv/src/unix/proctitle.c \
|
|
|
|
deps/libuv/src/unix/random-devurandom.c \
|
|
|
|
deps/libuv/src/unix/random-getrandom.c \
|
|
|
|
deps/libuv/src/unix/random-sysctl-linux.c \
|
|
|
|
deps/libuv/src/unix/signal.c \
|
|
|
|
deps/libuv/src/unix/stream.c \
|
|
|
|
deps/libuv/src/unix/tcp.c \
|
|
|
|
deps/libuv/src/unix/thread.c \
|
|
|
|
deps/libuv/src/unix/tty.c \
|
2022-05-16 18:30:14 -04:00
|
|
|
deps/libuv/src/unix/udp.c
|
2022-12-29 16:58:54 -05:00
|
|
|
UV_SOURCES_android := \
|
|
|
|
deps/libuv/src/unix/random-getentropy.c
|
2022-05-25 20:47:36 -04:00
|
|
|
UV_SOURCES_win := \
|
2022-05-16 18:30:14 -04:00
|
|
|
deps/libuv/src/win/async.c \
|
|
|
|
deps/libuv/src/win/core.c \
|
|
|
|
deps/libuv/src/win/detect-wakeup.c \
|
|
|
|
deps/libuv/src/win/dl.c \
|
|
|
|
deps/libuv/src/win/error.c \
|
|
|
|
deps/libuv/src/win/fs-event.c \
|
|
|
|
deps/libuv/src/win/fs.c \
|
|
|
|
deps/libuv/src/win/getaddrinfo.c \
|
|
|
|
deps/libuv/src/win/getnameinfo.c \
|
|
|
|
deps/libuv/src/win/handle.c \
|
|
|
|
deps/libuv/src/win/loop-watcher.c \
|
|
|
|
deps/libuv/src/win/pipe.c \
|
|
|
|
deps/libuv/src/win/poll.c \
|
|
|
|
deps/libuv/src/win/process-stdio.c \
|
|
|
|
deps/libuv/src/win/process.c \
|
|
|
|
deps/libuv/src/win/signal.c \
|
|
|
|
deps/libuv/src/win/snprintf.c \
|
|
|
|
deps/libuv/src/win/stream.c \
|
|
|
|
deps/libuv/src/win/tcp.c \
|
|
|
|
deps/libuv/src/win/thread.c \
|
|
|
|
deps/libuv/src/win/tty.c \
|
|
|
|
deps/libuv/src/win/udp.c \
|
|
|
|
deps/libuv/src/win/util.c \
|
|
|
|
deps/libuv/src/win/winapi.c \
|
|
|
|
deps/libuv/src/win/winsock.c
|
2022-05-25 20:47:36 -04:00
|
|
|
UV_OBJS := $(call get_objs,UV_SOURCES)
|
2021-01-02 13:10:00 -05:00
|
|
|
$(UV_OBJS): CFLAGS += \
|
|
|
|
-Ideps/libuv/include \
|
|
|
|
-Ideps/libuv/src \
|
2023-05-21 17:36:51 -04:00
|
|
|
-Wno-dangling-pointer \
|
2021-01-02 13:10:00 -05:00
|
|
|
-Wno-incompatible-pointer-types \
|
2023-05-21 17:36:51 -04:00
|
|
|
-Wno-maybe-uninitialized \
|
2021-01-02 13:10:00 -05:00
|
|
|
-Wno-sign-compare \
|
2023-05-21 17:36:51 -04:00
|
|
|
-Wno-unused-but-set-variable \
|
|
|
|
-Wno-unused-result \
|
2022-06-04 13:22:55 -04:00
|
|
|
-Wno-unused-variable \
|
2022-09-24 17:13:14 -04:00
|
|
|
-D_GNU_SOURCE
|
2021-01-02 13:10:00 -05:00
|
|
|
|
2022-05-25 20:47:36 -04:00
|
|
|
SODIUM_SOURCES := \
|
2022-03-07 22:42:47 -05:00
|
|
|
deps/libsodium/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_box/crypto_box.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_core/salsa/ref/core_salsa_ref.c \
|
2022-05-30 13:24:42 -04:00
|
|
|
deps/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c \
|
2022-05-16 18:30:14 -04:00
|
|
|
deps/libsodium/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c \
|
2022-03-07 22:42:47 -05:00
|
|
|
deps/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256_cp.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \
|
2022-05-16 18:30:14 -04:00
|
|
|
deps/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ref.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_pwhash/argon2/blake2b-long.c \
|
2022-03-07 22:42:47 -05:00
|
|
|
deps/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c \
|
2022-05-30 13:24:42 -04:00
|
|
|
deps/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c \
|
2022-03-07 22:42:47 -05:00
|
|
|
deps/libsodium/src/libsodium/crypto_sign/crypto_sign.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c \
|
2022-05-30 13:24:42 -04:00
|
|
|
deps/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20.c \
|
2022-03-07 22:42:47 -05:00
|
|
|
deps/libsodium/src/libsodium/crypto_stream/salsa20/ref/salsa20_ref.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c \
|
|
|
|
deps/libsodium/src/libsodium/crypto_verify/sodium/verify.c \
|
|
|
|
deps/libsodium/src/libsodium/randombytes/randombytes.c \
|
|
|
|
deps/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c \
|
|
|
|
deps/libsodium/src/libsodium/sodium/core.c \
|
2023-02-13 22:15:24 -05:00
|
|
|
deps/libsodium/src/libsodium/sodium/codecs.c \
|
2022-05-16 18:30:14 -04:00
|
|
|
deps/libsodium/src/libsodium/sodium/runtime.c \
|
2022-03-07 22:42:47 -05:00
|
|
|
deps/libsodium/src/libsodium/sodium/utils.c
|
2022-05-25 20:47:36 -04:00
|
|
|
SODIUM_OBJS := $(call get_objs,SODIUM_SOURCES)
|
2022-03-07 22:42:47 -05:00
|
|
|
$(SODIUM_OBJS): CFLAGS += \
|
|
|
|
-DCONFIGURED=1 \
|
|
|
|
-DMINIMAL=1 \
|
|
|
|
-Wno-unused-function \
|
|
|
|
-Wno-unused-variable \
|
2022-06-04 13:22:55 -04:00
|
|
|
-Wno-type-limits \
|
|
|
|
-Wno-unknown-pragmas \
|
2022-03-07 22:42:47 -05:00
|
|
|
-Ideps/libsodium/src/libsodium/include/sodium
|
|
|
|
|
2022-05-25 20:47:36 -04:00
|
|
|
SQLITE_SOURCES := deps/sqlite/sqlite3.c
|
|
|
|
SQLITE_OBJS := $(call get_objs,SQLITE_SOURCES)
|
2021-01-02 13:10:00 -05:00
|
|
|
$(SQLITE_OBJS): CFLAGS += \
|
|
|
|
-DSQLITE_DBCONFIG_DEFAULT_DEFENSIVE \
|
2023-03-19 16:25:50 -04:00
|
|
|
-DSQLITE_DEFAULT_MEMSTATUS=0 \
|
|
|
|
-DSQLITE_DQS=0 \
|
2023-03-19 20:29:46 -04:00
|
|
|
-DSQLITE_ENABLE_MEMSYS5 \
|
2022-09-10 13:56:54 -04:00
|
|
|
-DSQLITE_ENABLE_FTS5 \
|
2021-01-02 13:10:00 -05:00
|
|
|
-DSQLITE_ENABLE_JSON1 \
|
2023-03-19 20:29:46 -04:00
|
|
|
-DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
|
2023-03-19 16:25:50 -04:00
|
|
|
-DSQLITE_MAX_ATTACHED=0 \
|
2021-01-02 13:10:00 -05:00
|
|
|
-DSQLITE_MAX_COLUMN=100 \
|
2022-10-21 19:30:22 -04:00
|
|
|
-DSQLITE_MAX_COMPOUND_SELECT=300 \
|
2023-03-19 16:25:50 -04:00
|
|
|
-DSQLITE_MAX_EXPR_DEPTH=40 \
|
2021-01-02 13:10:00 -05:00
|
|
|
-DSQLITE_MAX_FUNCTION_ARG=8 \
|
2023-03-19 16:25:50 -04:00
|
|
|
-DSQLITE_MAX_LENGTH=5242880 \
|
2021-01-02 13:10:00 -05:00
|
|
|
-DSQLITE_MAX_LIKE_PATTERN_LENGTH=50 \
|
2023-03-19 16:25:50 -04:00
|
|
|
-DSQLITE_MAX_SQL_LENGTH=100000 \
|
2021-01-02 13:10:00 -05:00
|
|
|
-DSQLITE_MAX_TRIGGER_DEPTH=10 \
|
2023-03-19 16:25:50 -04:00
|
|
|
-DSQLITE_MAX_VARIABLE_NUMBER=100 \
|
|
|
|
-DSQLITE_MAX_VDBE_OP=25000 \
|
|
|
|
-DSQLITE_OMIT_DEPRECATED \
|
|
|
|
-DSQLITE_OMIT_DESERIALIZE \
|
|
|
|
-DSQLITE_OMIT_LOAD_EXTENSION \
|
|
|
|
-DSQLITE_OMIT_TCL_VARIABLE \
|
2023-03-19 20:29:46 -04:00
|
|
|
-DSQLITE_PRAGMA_DEFAULT_WAL_SYNCHRONOUS=1 \
|
2021-01-02 14:27:41 -05:00
|
|
|
-DSQLITE_SECURE_DELETE \
|
2023-03-19 16:25:50 -04:00
|
|
|
-DSQLITE_THREADSAFE=0 \
|
|
|
|
-DSQLITE_UNTESTABLE \
|
|
|
|
-DSQLITE_USE_ALLOCA \
|
|
|
|
-DHAVE_ISNAN \
|
2022-06-04 13:22:55 -04:00
|
|
|
-Wno-implicit-fallthrough \
|
2022-12-30 09:22:04 -05:00
|
|
|
-Wno-unused-but-set-variable \
|
2023-03-19 16:25:50 -04:00
|
|
|
-Wno-unused-function \
|
|
|
|
-Wno-unused-variable
|
2021-01-02 13:10:00 -05:00
|
|
|
|
2022-05-25 20:47:36 -04:00
|
|
|
XOPT_SOURCES := deps/xopt/xopt.c
|
|
|
|
XOPT_OBJS := $(call get_objs,XOPT_SOURCES)
|
2022-05-30 13:24:42 -04:00
|
|
|
$(filter $(BUILD_DIR)/win%,$(XOPT_OBJS)): CFLAGS += \
|
2022-05-16 18:30:14 -04:00
|
|
|
-DHAVE_SNPRINTF \
|
|
|
|
-DHAVE_VSNPRINTF \
|
|
|
|
-DHAVE_VASNPRINTF \
|
|
|
|
-DHAVE_VASPRINTF \
|
|
|
|
-Dvsnprintf=rpl_vsnprintf
|
2023-03-19 16:25:50 -04:00
|
|
|
$(XOPT_OBJS): CFLAGS += \
|
|
|
|
-Wno-implicit-const-int-float-conversion
|
2021-01-02 13:10:00 -05:00
|
|
|
|
2022-05-25 20:47:36 -04:00
|
|
|
QUICKJS_SOURCES := \
|
2021-01-02 13:10:00 -05:00
|
|
|
deps/quickjs/cutils.c \
|
|
|
|
deps/quickjs/libbf.c \
|
|
|
|
deps/quickjs/libregexp.c \
|
|
|
|
deps/quickjs/libunicode.c \
|
|
|
|
deps/quickjs/quickjs.c
|
2022-05-25 20:47:36 -04:00
|
|
|
QUICKJS_OBJS := $(call get_objs,QUICKJS_SOURCES)
|
2021-01-02 13:10:00 -05:00
|
|
|
$(QUICKJS_OBJS): CFLAGS += \
|
|
|
|
-DCONFIG_VERSION=\"$(shell cat deps/quickjs/VERSION)\" \
|
2022-12-11 09:36:14 -05:00
|
|
|
-DCONFIG_BIGNUM \
|
2021-01-02 13:10:00 -05:00
|
|
|
-D_GNU_SOURCE \
|
2023-03-19 16:25:50 -04:00
|
|
|
-Wno-enum-conversion \
|
|
|
|
-Wno-implicit-const-int-float-conversion \
|
2021-01-02 13:10:00 -05:00
|
|
|
-Wno-implicit-fallthrough \
|
2023-03-19 16:25:50 -04:00
|
|
|
-Wno-sign-compare \
|
2021-10-03 18:14:06 -04:00
|
|
|
-Wno-unused-but-set-variable \
|
2023-03-19 16:25:50 -04:00
|
|
|
-Wno-unused-variable
|
|
|
|
$(NONANDROID_TARGETS): CFLAGS += -DDUMP_LEAKS
|
2021-01-02 13:10:00 -05:00
|
|
|
|
2022-09-24 16:54:54 -04:00
|
|
|
LIBBACKTRACE_SOURCES := \
|
|
|
|
deps/libbacktrace/atomic.c \
|
|
|
|
deps/libbacktrace/backtrace.c \
|
|
|
|
deps/libbacktrace/dwarf.c \
|
|
|
|
deps/libbacktrace/fileline.c \
|
|
|
|
deps/libbacktrace/print.c \
|
|
|
|
deps/libbacktrace/simple.c \
|
|
|
|
deps/libbacktrace/sort.c \
|
|
|
|
deps/libbacktrace/state.c
|
2022-09-24 17:10:23 -04:00
|
|
|
LIBBACKTRACE_SOURCES_unix := \
|
|
|
|
deps/libbacktrace/elf.c \
|
|
|
|
deps/libbacktrace/mmap.c \
|
|
|
|
deps/libbacktrace/mmapio.c \
|
|
|
|
deps/libbacktrace/posix.c
|
|
|
|
LIBBACKTRACE_SOURCES_win := \
|
|
|
|
deps/libbacktrace/alloc.c \
|
|
|
|
deps/libbacktrace/pecoff.c \
|
|
|
|
deps/libbacktrace/posix.c \
|
|
|
|
deps/libbacktrace/read.c
|
2022-09-24 16:54:54 -04:00
|
|
|
LIBBACKTRACE_OBJS := $(call get_objs,LIBBACKTRACE_SOURCES)
|
|
|
|
$(LIBBACKTRACE_OBJS): CFLAGS += \
|
|
|
|
-Ideps/libbacktrace_config \
|
|
|
|
-Wno-unused-but-set-variable \
|
|
|
|
-Wno-maybe-initialized \
|
|
|
|
-Wno-unused-function \
|
|
|
|
-DBACKTRACE_ELF_SIZE=64
|
|
|
|
|
2022-12-31 11:47:10 -05:00
|
|
|
PICOHTTPPARSER_SOURCES := \
|
|
|
|
deps/picohttpparser/picohttpparser.c
|
|
|
|
PICOHTTPPARSER_OBJS := $(call get_objs,PICOHTTPPARSER_SOURCES)
|
2023-03-08 18:59:11 -05:00
|
|
|
|
|
|
|
MINIUNZIP_SOURCES := \
|
|
|
|
deps/zlib/contrib/minizip/unzip.c \
|
|
|
|
deps/zlib/contrib/minizip/ioapi.c \
|
|
|
|
deps/zlib/adler32.c \
|
|
|
|
deps/zlib/crc32.c \
|
|
|
|
deps/zlib/inffast.c \
|
|
|
|
deps/zlib/inflate.c \
|
|
|
|
deps/zlib/inftrees.c \
|
|
|
|
deps/zlib/zutil.c
|
|
|
|
MINIUNZIP_OBJS := $(call get_objs,MINIUNZIP_SOURCES)
|
|
|
|
$(MINIUNZIP_OBJS): CFLAGS += \
|
|
|
|
-Ideps/zlib \
|
|
|
|
-Wno-maybe-uninitialized
|
2022-12-31 11:47:10 -05:00
|
|
|
|
2021-10-03 18:14:06 -04:00
|
|
|
LDFLAGS += \
|
2021-01-02 13:10:00 -05:00
|
|
|
-pthread \
|
2022-05-16 18:30:14 -04:00
|
|
|
-lm
|
2022-05-30 13:24:42 -04:00
|
|
|
debug release: LDFLAGS += \
|
2022-05-16 18:30:14 -04:00
|
|
|
-ldl \
|
|
|
|
-lssl \
|
|
|
|
-lcrypto
|
2022-05-30 13:24:42 -04:00
|
|
|
windebug winrelease: LDFLAGS += \
|
2022-12-29 18:55:49 -05:00
|
|
|
-lssl \
|
|
|
|
-lcrypto \
|
2023-05-21 17:36:51 -04:00
|
|
|
-lcrypt32 \
|
|
|
|
-ldbghelp \
|
|
|
|
-liphlpapi \
|
|
|
|
-lkernel32 \
|
|
|
|
-lole32 \
|
|
|
|
-luserenv \
|
|
|
|
-luuid \
|
2022-12-29 18:55:49 -05:00
|
|
|
-lws2_32 \
|
2023-05-21 17:36:51 -04:00
|
|
|
-lwsock32
|
2023-03-06 22:02:16 -05:00
|
|
|
$(ANDROID_TARGETS): LDFLAGS += \
|
2023-03-13 23:17:01 -04:00
|
|
|
-target $(ANDROID_NDK_TARGET_TRIPLE)$(ANDROID_NDK_API_VERSION) \
|
2022-12-29 16:58:54 -05:00
|
|
|
-ldl \
|
2023-03-13 23:17:01 -04:00
|
|
|
-llog \
|
2022-12-29 16:58:54 -05:00
|
|
|
-lssl \
|
2023-03-13 23:17:01 -04:00
|
|
|
-lcrypto
|
2021-01-02 13:10:00 -05:00
|
|
|
|
2022-05-25 20:47:36 -04:00
|
|
|
unix: debug release
|
|
|
|
win: windebug winrelease
|
2023-03-15 20:44:22 -04:00
|
|
|
all: $(BUILD_TYPES) out/TildeFriends-debug.apk out/TildeFriends-release.apk
|
2022-05-30 13:24:42 -04:00
|
|
|
.PHONY: all win unix
|
2021-10-03 18:14:06 -04:00
|
|
|
|
2022-05-25 20:47:36 -04:00
|
|
|
ALL_APP_OBJS := \
|
|
|
|
$(APP_OBJS) \
|
|
|
|
$(BLOWFISH_OBJS) \
|
2022-09-24 16:54:54 -04:00
|
|
|
$(LIBBACKTRACE_OBJS) \
|
2023-03-08 18:59:11 -05:00
|
|
|
$(MINIUNZIP_OBJS) \
|
2022-12-31 11:47:10 -05:00
|
|
|
$(PICOHTTPPARSER_OBJS) \
|
2022-05-25 20:47:36 -04:00
|
|
|
$(QUICKJS_OBJS) \
|
|
|
|
$(SODIUM_OBJS) \
|
|
|
|
$(SQLITE_OBJS) \
|
|
|
|
$(UV_OBJS) \
|
|
|
|
$(XOPT_OBJS)
|
2021-01-02 13:10:00 -05:00
|
|
|
|
|
|
|
DEPS = $(ALL_APP_OBJS:.o=.d)
|
|
|
|
-include $(DEPS)
|
|
|
|
|
2022-05-30 13:24:42 -04:00
|
|
|
define build_rules
|
2023-03-10 22:47:01 -05:00
|
|
|
$(1): $(BUILD_DIR)/$(1)/$(PROJECT)$(if $(filter win%,$(1)),.exe)
|
2022-05-30 13:24:42 -04:00
|
|
|
.PHONY: $(1)
|
2021-01-02 13:10:00 -05:00
|
|
|
|
2023-03-09 21:02:24 -05:00
|
|
|
$(BUILD_DIR)/$(1)/$(PROJECT)$(if $(filter win%,$(1)),.exe): $(filter $(BUILD_DIR)/$(1)/%,$(ALL_APP_OBJS))
|
2022-05-30 13:24:42 -04:00
|
|
|
@echo [link] $$@
|
2023-03-19 16:25:50 -04:00
|
|
|
@$$(CC) -o $$@ -Wl,-Map,$$@.map $$^ $$(LDFLAGS)
|
2022-05-25 20:47:36 -04:00
|
|
|
|
2022-05-30 13:24:42 -04:00
|
|
|
$(BUILD_DIR)/$(1)/%.o: %.c
|
|
|
|
@mkdir -p $$(dir $$@)
|
|
|
|
@echo [c] $$@
|
|
|
|
@$$(CC) $$(CFLAGS) -c $$< -o $$@
|
2022-05-25 20:47:36 -04:00
|
|
|
|
2022-05-30 13:24:42 -04:00
|
|
|
$(BUILD_DIR)/$(1)/%.o: %.S
|
|
|
|
@mkdir -p $$(dir $$@)
|
|
|
|
@echo [as] $$@
|
|
|
|
@$$(AS) -c $$< -o $$@
|
|
|
|
endef
|
2022-05-16 18:30:14 -04:00
|
|
|
|
2022-05-30 13:24:42 -04:00
|
|
|
$(foreach build_type,$(BUILD_TYPES),$(eval $(call build_rules,$(build_type))))
|
2022-05-16 18:30:14 -04:00
|
|
|
|
2023-06-28 19:00:34 -04:00
|
|
|
src/version.h : $(firstword $(MAKEFILE_LIST))
|
|
|
|
@echo [version] $@
|
|
|
|
@echo "#define VERSION_NUMBER \"$(VERSION_NUMBER)\"\n#define VERSION_NAME \"$(VERSION_NAME)\"\n" > $@
|
|
|
|
|
2023-06-28 19:23:29 -04:00
|
|
|
src/android/AndroidManifest.xml : $(firstword $(MAKEFILE_LIST))
|
|
|
|
@echo [android_version] $@
|
|
|
|
@sed -i \
|
|
|
|
-e 's/versionCode=".*"/versionCode="$(VERSION_CODE)"/' \
|
|
|
|
-e 's/versionName=".*"/versionName="$(VERSION_NUMBER)"/' \
|
|
|
|
-e 's/android:minSdkVersion=".*"/android:minSdkVersion="$(ANDROID_MIN_SDK_VERSION)"/' \
|
|
|
|
$@
|
|
|
|
|
2023-03-04 14:10:05 -05:00
|
|
|
# Android support.
|
2023-03-14 23:21:20 -04:00
|
|
|
out/res/layout_activity_main.xml.flat: src/android/res/layout/activity_main.xml
|
2023-03-04 14:10:05 -05:00
|
|
|
@mkdir -p $(dir $@)
|
2023-03-14 23:21:20 -04:00
|
|
|
@echo [aapt2] $@
|
2023-03-15 19:55:22 -04:00
|
|
|
@$(ANDROID_BUILD_TOOLS)/aapt2 compile -o out/res/ src/android/res/layout/activity_main.xml
|
2023-03-14 23:21:20 -04:00
|
|
|
|
2023-05-03 20:04:43 -04:00
|
|
|
out/res/drawable_icon.xml.flat: src/android/res/drawable/icon.xml
|
2023-03-18 08:31:58 -04:00
|
|
|
@mkdir -p $(dir $@)
|
2023-05-03 20:04:43 -04:00
|
|
|
@echo [aapt2] $@
|
|
|
|
@$(ANDROID_BUILD_TOOLS)/aapt2 compile -o out/res/ src/android/res/drawable/icon.xml
|
|
|
|
|
|
|
|
out/apk/res.apk out/gen/com/unprompted/tildefriends/R.java: out/res/layout_activity_main.xml.flat out/res/drawable_icon.xml.flat src/android/AndroidManifest.xml
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@$(ANDROID_BUILD_TOOLS)/aapt2 link -I $(ANDROID_PLATFORM)/android.jar out/res/layout_activity_main.xml.flat out/res/drawable_icon.xml.flat --manifest src/android/AndroidManifest.xml -o out/apk/res.apk --java out/gen/
|
2023-03-04 14:10:05 -05:00
|
|
|
|
|
|
|
JAVA_FILES := out/gen/com/unprompted/tildefriends/R.java $(wildcard src/android/com/unprompted/tildefriends/*.java)
|
|
|
|
CLASS_FILES := $(foreach src,$(JAVA_FILES),out/classes/com/unprompted/tildefriends/$(notdir $(src:.java=.class)))
|
|
|
|
|
|
|
|
$(CLASS_FILES) &: $(JAVA_FILES)
|
|
|
|
@echo [javac] $(CLASS_FILES)
|
2023-03-14 23:21:20 -04:00
|
|
|
@javac --release 8 -Xlint:deprecation -classpath $(ANDROID_PLATFORM)/android.jar -d out/classes $(JAVA_FILES)
|
2023-03-04 14:10:05 -05:00
|
|
|
|
|
|
|
out/apk/classes.dex: $(CLASS_FILES)
|
2023-03-15 19:55:22 -04:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@echo [d8] $@
|
|
|
|
@$(ANDROID_BUILD_TOOLS)/d8 --$(BUILD_TYPE) --lib $(ANDROID_PLATFORM)/android.jar --output $(dir $@) out/classes/com/unprompted/tildefriends/*.class
|
2023-03-04 14:10:05 -05:00
|
|
|
|
2023-03-08 12:46:19 -05:00
|
|
|
PACKAGE_DIRS := \
|
|
|
|
apps/ \
|
|
|
|
core/ \
|
|
|
|
deps/codemirror/ \
|
2023-04-30 07:48:16 -04:00
|
|
|
deps/lit/ \
|
2023-03-08 12:46:19 -05:00
|
|
|
deps/split/ \
|
|
|
|
deps/smoothie/
|
|
|
|
|
|
|
|
RAW_FILES := $(shell find $(PACKAGE_DIRS) -type f)
|
|
|
|
|
2023-03-18 08:31:58 -04:00
|
|
|
out/apk/TildeFriends-debug.unsigned.apk: BUILD_TYPE := debug
|
|
|
|
out/apk/TildeFriends-release.unsigned.apk: BUILD_TYPE := release
|
|
|
|
|
|
|
|
out/apk/TildeFriends-debug.unsigned.apk: out/apk/classes.dex out/androiddebug/tildefriends out/androiddebug-x86_64/tildefriends $(RAW_FILES) out/apk/res.apk
|
|
|
|
out/apk/TildeFriends-release.unsigned.apk: out/apk/classes.dex out/androidrelease/tildefriends out/androidrelease-x86_64/tildefriends $(RAW_FILES) out/apk/res.apk
|
2023-03-15 19:55:22 -04:00
|
|
|
|
|
|
|
out/%.unsigned.apk:
|
2023-03-19 09:12:51 -04:00
|
|
|
@mkdir -p $(dir $@) out/apk$(BUILD_TYPE)/bin/aarch64/ out/apk$(BUILD_TYPE)/bin/x86_64/
|
2023-03-04 14:10:05 -05:00
|
|
|
@echo [aapt] $@
|
2023-03-19 09:12:51 -04:00
|
|
|
@cp out/android$(BUILD_TYPE)/tildefriends out/apk$(BUILD_TYPE)/bin/aarch64/
|
|
|
|
@cp out/android$(BUILD_TYPE)-x86_64/tildefriends out/apk$(BUILD_TYPE)/bin/x86_64/
|
2023-03-19 16:25:50 -04:00
|
|
|
@$(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip out/apk$(BUILD_TYPE)/bin/aarch64/tildefriends
|
|
|
|
@$(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip out/apk$(BUILD_TYPE)/bin/x86_64/tildefriends
|
2023-03-18 08:31:58 -04:00
|
|
|
@cp out/apk/res.apk $@
|
2023-03-15 19:57:35 -04:00
|
|
|
@cp out/apk/classes.dex out/apk$(BUILD_TYPE)/
|
2023-03-15 19:55:22 -04:00
|
|
|
@cd out/apk$(BUILD_TYPE) && zip -u ../../$@ -q -9 -r . && cd ../../
|
2023-04-30 09:24:01 -04:00
|
|
|
@zip -u $@ -q -9 -x '*.map' -r $(PACKAGE_DIRS) $(RAW_FILES)
|
2023-03-04 14:10:05 -05:00
|
|
|
|
2023-03-18 08:31:58 -04:00
|
|
|
out/%.apk: out/apk/%.unsigned.apk
|
2023-03-04 14:10:05 -05:00
|
|
|
@echo [apksigner] $(notdir $@)
|
|
|
|
@$(ANDROID_BUILD_TOOLS)/apksigner sign --ks keystore.jks --ks-key-alias androidKey --ks-pass pass:android --key-pass pass:android --out $@ $<
|
|
|
|
|
2023-03-15 19:55:22 -04:00
|
|
|
apk: out/TildeFriends-debug.apk
|
2023-03-07 21:49:41 -05:00
|
|
|
.PHONY: apk
|
|
|
|
|
2023-06-07 20:51:34 -04:00
|
|
|
apkgo: out/TildeFriends-release.apk
|
2023-03-18 08:28:48 -04:00
|
|
|
@adb install $<
|
|
|
|
@adb shell am start com.unprompted.tildefriends/.MainActivity
|
|
|
|
.PHONY: apkgo
|
|
|
|
|
2023-05-23 19:26:07 -04:00
|
|
|
apklog:
|
|
|
|
@adb logcat *:S tildefriends
|
|
|
|
.PHONY: apklog
|
|
|
|
|
2021-01-02 13:10:00 -05:00
|
|
|
clean:
|
|
|
|
rm -rf $(BUILD_DIR)
|
|
|
|
.PHONY: clean
|