-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (26 loc) · 1.02 KB
/
Makefile
File metadata and controls
37 lines (26 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
BUILD ?= debug
CC := clang
CFLAGS.gcc := -std=c23 -Wall -Wextra -Wconversion -Wno-unused-function
CFLAGS.gcc.release := -Ofast -march=native -DNDEBUG
CFLAGS.gcc.debug := -ggdb -O1 -fsanitize=address
CFLAGS.clang := -std=c23 -g -Wall -Wextra -Wconversion -Wno-unused-function -Wimplicit-int-conversion -Wno-macro-redefined -Wno-initializer-overrides
CFLAGS.clang.release := -O3 -ffast-math -march=native -DNDEBUG -DNSTATS
CFLAGS.clang.debug := -g3 -O1 -fsanitize=address,undefined
CFLAGS.clang.wasm := \
--target=wasm32-unknown-unknown -nostdlib -g \
-DNSTATS \
-Wl,--export-all \
-Wl,--no-entry
CFLAGS := $(CFLAGS.$(CC)) $(CFLAGS.$(CC).$(BUILD))
all: tests
wasm: chess.wasm
codegen: codegen.c
$(CC) -D_DEFAULT_SOURCE -o $@ $(CFLAGS) $^
chess.wasm: wasm-compat.c mbb_rook.h mbb_bishop.h engine.h
$(CC) -DWASM -o $@ wasm-compat.c $(CFLAGS.$(CC)) $(CFLAGS.$(CC).wasm)
mbb_rook.h: codegen
./codegen
mbb_bishop.h: codegen
./codegen
tests: tests.c mbb_rook.h mbb_bishop.h engine.h
$(CC) -D_DEFAULT_SOURCE -o $@ $(CFLAGS) tests.c