commit d0b2e6376f03ac86087f355c56b5d98262deda6b Author: Bad Diode Date: Thu Mar 3 08:42:47 2022 +0000 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..53d756b --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +SRC_DIR ?= src +BUILD_DIR ?= build +SRC_MAIN ?= $(SRC_DIR)/main.c +EXE_NAME ?= fbtest +BIN := $(BUILD_DIR)/$(EXE_NAME) + +CC ?= cc +CFLAGS := -Wall -Wextra -pedantic + +REL_FLAGS := -DNDEBUG -O2 +DEB_FLAGS := -DDEBUG -O0 -g + +DEBUG ?= 0 +ifeq ($(DEBUG), 1) + CFLAGS += $(DEB_FLAGS) +else ifeq ($(DEBUG), 2) + CFLAGS += $(DEB_FLAGS) -fsanitize=address +else + CFLAGS += $(REL_FLAGS) +endif + +.PHONY: build run clean + +main: $(BIN) + +$(BIN): $(SRC_MAIN) $(BUILD_DIR) + $(CC) $(CFLAGS) -o $(BIN) $(SRC_MAIN) + +$(BUILD_DIR): + mkdir -p $(BUILD_DIR) + +run: $(BIN) + ./$(BIN) + +clean: + rm -rf $(BUILD_DIR) diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..e08dc19 --- /dev/null +++ b/src/main.c @@ -0,0 +1,7 @@ +#include + +int +main(void) { + printf("hello world\n"); + return 0; +}