2022-08-21 13:17:23 -04:00
|
|
|
.ONESHELL:
|
|
|
|
.DELETE_ON_ERROR:
|
|
|
|
MAKEFLAGS += --warn-undefined-variables
|
|
|
|
MAKEFLAGS += --no-builtin-rules
|
|
|
|
|
2021-01-02 13:10:00 -05:00
|
|
|
PROJECT = tildefriends
|
|
|
|
BUILD_DIR ?= out
|
2022-12-29 16:58:54 -05:00
|
|
|
BUILD_TYPES := debug release windebug winrelease androiddebug androidrelease
|
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 \
|
|
|
|
-fno-omit-frame-pointer \
|
|
|
|
-g
|
2023-01-17 19:07:02 -05:00
|
|
|
LDFLAGS += -Wl,--gc-sections
|
2021-10-03 18:14:06 -04:00
|
|
|
|
2023-03-04 14:10:05 -05:00
|
|
|
ANDROID_SDK ?= /usr/lib/android-sdk
|
|
|
|
ANDROID_BUILD_TOOLS := $(ANDROID_SDK)/build-tools/29.0.3
|
|
|
|
ANDROID_PLATFORM := $(ANDROID_SDK)/platforms/android-23
|
|
|
|
ANDROID_NDK ?= /usr/lib/android-sdk/ndk-bundle
|
|
|
|
ANDROID_NDK_API_VERSION := 30
|
|
|
|
ANDROID_NDK_TARGET_TRIPLE := aarch64-linux-android
|
2022-12-29 16:58:54 -05:00
|
|
|
|
|
|
|
debug windebug androiddebug: CFLAGS += -Og
|
|
|
|
debug release androidrelease: LDFLAGS += -rdynamic
|
2022-09-24 16:54:54 -04:00
|
|
|
release winrelease: CFLAGS += -DNDEBUG -O3
|
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-04 14:10:05 -05:00
|
|
|
androiddebug androidrelease: CC = $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
|
2022-12-29 16:58:54 -05:00
|
|
|
androiddebug androidrelease: AS = $(CC)
|
|
|
|
androiddebug androidrelease: CFLAGS += \
|
2023-03-04 14:10:05 -05:00
|
|
|
-target $(ANDROID_NDK_TARGET_TRIPLE)$(ANDROID_NDK_API_VERSION) \
|
2022-12-29 18:55:49 -05:00
|
|
|
-Ideps/openssl/android/arm64-v8a/usr/local/include \
|
2022-12-29 16:58:54 -05:00
|
|
|
-Wno-unknown-warning-option
|
|
|
|
androiddebug androidrelease: LDFLAGS += \
|
2023-03-04 14:10:05 -05:00
|
|
|
-target $(ANDROID_NDK_TARGET_TRIPLE)$(ANDROID_NDK_API_VERSION) \
|
2022-12-29 18:55:49 -05:00
|
|
|
-Ldeps/openssl/android/arm64-v8a/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))))) \
|
|
|
|
$(foreach build_type,androiddebug androidrelease,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_android))))) \
|
|
|
|
$(foreach build_type,androiddebug androidrelease,$(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 \
|
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 \
|
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 \
|
2021-07-27 18:08:18 -04:00
|
|
|
deps/libuv/src/unix/epoll.c \
|
2021-01-02 13:10:00 -05:00
|
|
|
deps/libuv/src/unix/fs.c \
|
|
|
|
deps/libuv/src/unix/getaddrinfo.c \
|
|
|
|
deps/libuv/src/unix/getnameinfo.c \
|
|
|
|
deps/libuv/src/unix/linux-core.c \
|
|
|
|
deps/libuv/src/unix/linux-inotify.c \
|
|
|
|
deps/libuv/src/unix/linux-syscalls.c \
|
|
|
|
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/pthread-fixes.c \
|
|
|
|
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 \
|
|
|
|
-Wno-unused-but-set-variable \
|
|
|
|
-Wno-incompatible-pointer-types \
|
|
|
|
-Wno-sign-compare \
|
2022-06-04 13:22:55 -04:00
|
|
|
-Wno-unused-variable \
|
2022-09-24 17:13:14 -04:00
|
|
|
-Wno-dangling-pointer \
|
|
|
|
-Wno-maybe-uninitialized \
|
|
|
|
-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 \
|
2022-09-10 13:56:54 -04:00
|
|
|
-DSQLITE_ENABLE_FTS5 \
|
2021-01-02 13:10:00 -05:00
|
|
|
-DSQLITE_ENABLE_JSON1 \
|
2023-02-17 17:43:19 -05:00
|
|
|
-DSQLITE_THREADSAFE=1 \
|
2021-01-02 13:10:00 -05:00
|
|
|
-DSQLITE_MAX_LENGTH=5242880 \
|
|
|
|
-DSQLITE_MAX_SQL_LENGTH=100000 \
|
|
|
|
-DSQLITE_MAX_COLUMN=100 \
|
2022-10-21 19:30:22 -04:00
|
|
|
-DSQLITE_MAX_EXPR_DEPTH=40 \
|
|
|
|
-DSQLITE_MAX_COMPOUND_SELECT=300 \
|
2021-01-02 13:10:00 -05:00
|
|
|
-DSQLITE_MAX_VDBE_OP=25000 \
|
|
|
|
-DSQLITE_MAX_FUNCTION_ARG=8 \
|
|
|
|
-DSQLITE_MAX_ATTACHED=0 \
|
|
|
|
-DSQLITE_MAX_LIKE_PATTERN_LENGTH=50 \
|
|
|
|
-DSQLITE_MAX_VARIABLE_NUMBER=100 \
|
|
|
|
-DSQLITE_MAX_TRIGGER_DEPTH=10 \
|
2021-01-02 14:27:41 -05:00
|
|
|
-DSQLITE_SECURE_DELETE \
|
2022-06-04 13:22:55 -04:00
|
|
|
-Wno-implicit-fallthrough \
|
2022-12-30 09:22:04 -05:00
|
|
|
-Wno-unused-but-set-variable \
|
|
|
|
-Wno-unused-function
|
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
|
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-libc.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
|
|
|
-DDUMP_LEAKS \
|
|
|
|
-D_GNU_SOURCE \
|
|
|
|
-Wno-sign-compare \
|
|
|
|
-Wno-implicit-fallthrough \
|
|
|
|
-Wno-unused-variable \
|
2021-10-03 18:14:06 -04:00
|
|
|
-Wno-unused-but-set-variable \
|
|
|
|
-Wno-enum-conversion
|
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)
|
|
|
|
# $(PICOHTTPPARSER_OBJS): CFLAGS +=
|
|
|
|
|
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-05-16 18:30:14 -04:00
|
|
|
-lwsock32 \
|
|
|
|
-lws2_32 \
|
|
|
|
-lkernel32 \
|
|
|
|
-liphlpapi \
|
2022-12-29 18:55:49 -05:00
|
|
|
-luserenv \
|
|
|
|
-lssl \
|
|
|
|
-lcrypto \
|
|
|
|
-lws2_32 \
|
|
|
|
-lcrypt32
|
2022-12-29 16:58:54 -05:00
|
|
|
androiddebug androidrelease: LDFLAGS += \
|
|
|
|
-ldl \
|
|
|
|
-lssl \
|
|
|
|
-lcrypto
|
2021-01-02 13:10:00 -05:00
|
|
|
|
2022-05-25 20:47:36 -04:00
|
|
|
unix: debug release
|
|
|
|
win: windebug winrelease
|
|
|
|
all: $(BUILD_TYPES)
|
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) \
|
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
|
|
|
|
$(1): $(BUILD_DIR)/$(1)/$(PROJECT)$(if $(filter win%,$(1)),.exe)
|
|
|
|
.PHONY: $(1)
|
2021-01-02 13:10:00 -05:00
|
|
|
|
2022-05-30 13:24:42 -04:00
|
|
|
$(BUILD_DIR)/$(1)/$(PROJECT)$(if $(filter win%,$(1)),.exe): $(filter $(BUILD_DIR)/$(1)/%,$(ALL_APP_OBJS))
|
|
|
|
@echo [link] $$@
|
|
|
|
@$$(CC) -o $$@ $$^ $$(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-03-04 14:10:05 -05:00
|
|
|
# Android support.
|
|
|
|
out/gen/com/unprompted/tildefriends/R.java: $(wildcard src/android/res/layout/*) src/android/AndroidManifest.xml
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@echo [aapt] R.java
|
|
|
|
@$(ANDROID_BUILD_TOOLS)/aapt package -f -m -J out/gen/ -S src/android/res/ -M src/android/AndroidManifest.xml -I $(ANDROID_PLATFORM)/android.jar
|
|
|
|
|
|
|
|
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)
|
|
|
|
@javac --release 9 -classpath $(ANDROID_PLATFORM)/android.jar -d out/classes $(JAVA_FILES)
|
|
|
|
|
|
|
|
out/apk/classes.dex: $(CLASS_FILES)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@echo [dx] $@
|
|
|
|
@$(ANDROID_BUILD_TOOLS)/dx --dex --output=$@ out/classes/
|
|
|
|
|
|
|
|
out/TildeFriends.unsigned.apk: out/apk/classes.dex
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@echo [aapt] $@
|
|
|
|
@$(ANDROID_BUILD_TOOLS)/aapt package -f -M src/android/AndroidManifest.xml -S src/android/res/ -I $(ANDROID_PLATFORM)/android.jar -F $@ out/apk/
|
|
|
|
|
|
|
|
out/TildeFriends.apk: out/TildeFriends.unsigned.apk
|
|
|
|
@echo [apksigner] $(notdir $@)
|
|
|
|
@$(ANDROID_BUILD_TOOLS)/apksigner sign --ks keystore.jks --ks-key-alias androidKey --ks-pass pass:android --key-pass pass:android --out $@ $<
|
|
|
|
|
2021-01-02 13:10:00 -05:00
|
|
|
clean:
|
|
|
|
rm -rf $(BUILD_DIR)
|
|
|
|
.PHONY: clean
|