-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile.windows
39 lines (29 loc) · 1.17 KB
/
Makefile.windows
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
38
39
# assume llvm_headers.zip has been extracted
CFLAGS += -I.
# .a files generated in windows_setup.sh
LDFLAGS += $(wildcard libs/lib*.a)
ifeq ($(CC),cc)
# default c compiler --> use clang
CC := mingw64/bin/clang.exe
endif
# clang version in mingw doesn't seem as mature as what I have on linux...
# it shows a lot of unnecssary/dumb warnings by default
CFLAGS += -Wno-return-type -Wno-uninitialized -Wno-implicit-fallthrough
all: jou.exe compile_flags.txt
# point clangd to the right include folder so i don't get red squiggles in my editor
compile_flags.txt:
echo "-I$(CURDIR)" > compile_flags.txt
obj/%.o: src/%.c $(wildcard src/*.h)
mkdir -p obj && $(CC) -c $(CFLAGS) $< -o $@
jou.exe: $(OBJ)
$(CC) $(CFLAGS) $(OBJ) -o $@ $(LDFLAGS)
config.jou:
echo "# auto-generated by Makefile" > config.jou
echo "def get_jou_clang_path() -> byte*:" >> config.jou
echo " return NULL" >> config.jou
self_hosted_compiler.exe: jou.exe config.jou $(wildcard self_hosted/*.jou)
./jou.exe -o $@ --linker-flags "$(LDFLAGS)" self_hosted/main.jou
.PHONY: clean
clean:
rm -rvf obj jou.exe self_hosted_compiler.exe tmp config.jou compile_flags.txt
find -name jou_compiled -print -exec rm -rf '{}' +