2023-11-04 06:44:18 +03:00
|
|
|
.PHONY: all clean
|
|
|
|
|
2023-11-07 22:49:35 +03:00
|
|
|
SOURCES = utils/allocator.c \
|
|
|
|
libdeflate/allocator.c \
|
|
|
|
libdeflate/deflate_compress.c \
|
|
|
|
libdeflate/deflate_decompress.c \
|
|
|
|
libdeflate/gzip_decompress.c \
|
|
|
|
libdeflate/zlib_compress.c \
|
|
|
|
libdeflate/adler32.c \
|
|
|
|
crypto/aes256.c \
|
|
|
|
crypto/ige256.c \
|
|
|
|
crypto/ctr256.c \
|
|
|
|
hash/sha256.c \
|
|
|
|
hash/sha1.c
|
2023-11-04 06:44:18 +03:00
|
|
|
|
2023-11-04 22:42:37 +03:00
|
|
|
WASM_CC ?= clang
|
|
|
|
CC := $(WASM_CC)
|
|
|
|
|
2023-11-04 06:44:18 +03:00
|
|
|
CFLAGS_WASM := \
|
|
|
|
-target wasm32-unknown-unknown \
|
|
|
|
-nostdlib -ffreestanding -DFREESTANDING \
|
|
|
|
-mbulk-memory \
|
|
|
|
-Wl,--no-entry,--export-dynamic,--lto-O3
|
|
|
|
|
|
|
|
CFLAGS := $(CFLAGS_WASM) \
|
|
|
|
-O3 \
|
|
|
|
-Qn \
|
|
|
|
-DNDEBUG \
|
|
|
|
-mno-exception-handling \
|
|
|
|
-fdelete-null-pointer-checks \
|
|
|
|
-fno-stack-protector \
|
|
|
|
-flto=full \
|
|
|
|
-fdata-sections \
|
|
|
|
-ffunction-sections \
|
|
|
|
-Wl,--gc-sections \
|
|
|
|
-fno-inline \
|
|
|
|
-fno-unroll-loops
|
|
|
|
|
|
|
|
ifneq ($(OS),Windows_NT)
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
export PATH := /opt/homebrew/opt/llvm/bin/:$(PATH)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2024-03-04 05:16:38 +03:00
|
|
|
OUT := ../mtcute.wasm
|
2023-11-04 06:44:18 +03:00
|
|
|
|
|
|
|
$(OUT): $(SOURCES)
|
2023-11-07 22:49:35 +03:00
|
|
|
$(CC) $(CFLAGS) -I . -I utils -o $@ $^
|
2023-11-04 06:44:18 +03:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(OUT)
|
|
|
|
|
|
|
|
all: $(OUT)
|