init
This commit is contained in:
commit
b8c15c65ee
14
.clang-format
Normal file
14
.clang-format
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Language: Cpp
|
||||||
|
BasedOnStyle: WebKit
|
||||||
|
IndentWidth: 4
|
||||||
|
ColumnLimit: 80
|
||||||
|
IndentCaseLabels: true
|
||||||
|
InsertNewlineAtEOF: true
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
|
||||||
|
BinPackArguments: false
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
|
||||||
|
BinPackParameters: false
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
build/
|
53
Makefile
Normal file
53
Makefile
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
|
||||||
|
MAKEFLAGS += -j $(shell nproc)
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
|
COMPILER_FLAGS = \
|
||||||
|
-std=c23 \
|
||||||
|
-Wall -Wextra -Wpedantic -Wconversion \
|
||||||
|
-pedantic -pedantic-errors \
|
||||||
|
-Wno-unused-function \
|
||||||
|
|
||||||
|
LINKER_FLAGS = \
|
||||||
|
-pthread
|
||||||
|
|
||||||
|
COMPILER_FLAGS += $(shell pkg-config sdl2 --cflags)
|
||||||
|
LINKER_FLAGS += $(shell pkg-config sdl2 --libs)
|
||||||
|
|
||||||
|
FEATURE_FLAGS =
|
||||||
|
OPTIMIZATION_FLAGS =
|
||||||
|
|
||||||
|
# override by 'make RELEASE=1 ...'
|
||||||
|
RELEASE=0
|
||||||
|
|
||||||
|
ifeq ($(RELEASE),1)
|
||||||
|
COMPILER_FLAGS += -Werror
|
||||||
|
FEATURE_FLAGS += -flto=auto
|
||||||
|
OPTIMIZATION_FLAGS += -O3
|
||||||
|
else
|
||||||
|
COMPILER_FLAGS += -g -Wno-unused-variable
|
||||||
|
FEATURE_FLAGS += -fsanitize=address,undefined,leak
|
||||||
|
OPTIMIZATION_FLAGS += -Og
|
||||||
|
endif
|
||||||
|
|
||||||
|
HEADERS = $(shell find . -name *.h)
|
||||||
|
|
||||||
|
VM_SOURCES = $(shell find vm/ -name *.c)
|
||||||
|
VM_OBJECTS = $(patsubst %.c,build/%.o,$(VM_SOURCES))
|
||||||
|
|
||||||
|
all: build/bin/vm
|
||||||
|
|
||||||
|
build/bin/vm: $(VM_OBJECTS)
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(CC) $(VM_OBJECTS) -o $@ $(FEATURE_FLAGS) $(OPTIMIZATION_FLAGS) $(LINKER_FLAGS)
|
||||||
|
|
||||||
|
build/%.o: %.c $(HEADERS)
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(CC) $< -c -o $@ $(COMPILER_FLAGS) $(OPTIMIZATION_FLAGS) $(FEATURE_FLAGS)
|
||||||
|
|
||||||
|
.PHONY: run_kern clean
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build/ bin/
|
||||||
|
|
10
compile_flags.txt
Normal file
10
compile_flags.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
-xc
|
||||||
|
-std=c23
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Wpedantic
|
||||||
|
-Wconversion
|
||||||
|
-pedantic
|
||||||
|
-pedantic-errors
|
||||||
|
-Wno-unused-variable
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user