Initial commit

This commit is contained in:
Bad Diode 2022-03-03 08:42:47 +00:00
commit d0b2e6376f
3 changed files with 44 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build

36
Makefile Normal file
View File

@ -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)

7
src/main.c Normal file
View File

@ -0,0 +1,7 @@
#include<stdio.h>
int
main(void) {
printf("hello world\n");
return 0;
}