-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
251 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
/obj/ | ||
/tmp/ | ||
/jou | ||
/jou.exe | ||
/*.dll | ||
/compile_flags.txt | ||
jou_compiled | ||
/config.h | ||
/libs | ||
/mingw64 | ||
/mingw64.zip | ||
|
||
jou_compiled | ||
*.dll | ||
*.exe | ||
|
||
# Jou update files | ||
/jou_update_info.json | ||
/jou_update.zip | ||
/jou_update | ||
|
||
# this is a weird hack, see #103 | ||
/llvm_headers/ | ||
|
||
# codeblocks stuff | ||
/bin/ | ||
/jou.depend | ||
/jou.layout | ||
# llvm_headers.zip once extracted | ||
/llvm/ | ||
/llvm-c/ | ||
|
||
# ide stuff | ||
/.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,13 @@ | ||
LLVM_CONFIG ?= $(shell which llvm-config-13 || which llvm-config-11) | ||
|
||
SRC := $(wildcard src/*.c) | ||
|
||
ifeq ($(CC),cc) | ||
# default c compiler --> use clang | ||
CC := $(shell $(LLVM_CONFIG) --bindir)/clang | ||
endif | ||
CFLAGS += -Wall -Wextra -Wpedantic | ||
CFLAGS += -Werror=switch -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=implicit-fallthrough | ||
CFLAGS += -std=c11 | ||
CFLAGS += -g | ||
CFLAGS += $(shell $(LLVM_CONFIG) --cflags) | ||
LDFLAGS ?= $(shell $(LLVM_CONFIG) --ldflags --libs) | ||
|
||
all: jou 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$(shell $(LLVM_CONFIG) --includedir)" > compile_flags.txt | ||
|
||
config.h: | ||
echo "// auto-generated by Makefile" > config.h | ||
echo "#define JOU_CLANG_PATH \"$(shell $(LLVM_CONFIG) --bindir)/clang\"" >> config.h | ||
|
||
obj/%.o: src/%.c $(wildcard src/*.h) config.h | ||
mkdir -vp obj && $(CC) -c $(CFLAGS) $< -o $@ | ||
|
||
jou: $(SRC:src/%.c=obj/%.o) | ||
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | ||
SRC := $(wildcard src/*.c) | ||
OBJ := $(SRC:src/%.c=obj/%.o) | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rvf obj jou jou.exe tmp config.h compile_flags.txt | ||
find -name jou_compiled -print -exec rm -rf '{}' + | ||
ifneq (,$(findstring Windows,$(OS))) | ||
include Makefile.windows | ||
else | ||
include Makefile.posix | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
LLVM_CONFIG ?= $(shell which llvm-config-13 || which llvm-config-11) | ||
CFLAGS += $(shell $(LLVM_CONFIG) --cflags) | ||
LDFLAGS ?= $(shell $(LLVM_CONFIG) --ldflags --libs) | ||
|
||
ifeq ($(CC),cc) | ||
# default c compiler --> use clang | ||
CC := $(shell $(LLVM_CONFIG) --bindir)/clang | ||
endif | ||
|
||
all: jou 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$(shell $(LLVM_CONFIG) --includedir)" > compile_flags.txt | ||
|
||
config.h: | ||
echo "// auto-generated by Makefile" > config.h | ||
echo "#define JOU_CLANG_PATH \"$(shell $(LLVM_CONFIG) --bindir)/clang\"" >> config.h | ||
|
||
obj/%.o: src/%.c $(wildcard src/*.h) config.h | ||
mkdir -vp obj && $(CC) -c $(CFLAGS) $< -o $@ | ||
|
||
jou: $(SRC:src/%.c=obj/%.o) | ||
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rvf obj jou jou.exe tmp config.h compile_flags.txt | ||
find -name jou_compiled -print -exec rm -rf '{}' + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 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 obj 2>NUL || cd .) && $(CC) -c $(CFLAGS) $< -o $@ | ||
|
||
jou.exe: $(OBJ) | ||
$(CC) $(CFLAGS) $(OBJ) -o $@ $(LDFLAGS) | ||
|
||
.PHONY: clean | ||
clean: | ||
rmdir /s /q obj tmp 2>NUL | ||
del /q jou.exe compile_flags.txt 2>NUL | ||
# TODO: ideally we would also delete jou_compiled directories, but not sure how: | ||
# find -name jou_compiled -print -exec rm -rf '{}' + |
Oops, something went wrong.