Add a proper makefile

which automatically scans for files and only compiles new changes
This commit is contained in:
= 2023-01-14 00:49:42 +01:00
parent 861225a3b8
commit b1fd802e89
2 changed files with 14 additions and 10 deletions

1
.gitignore vendored
View file

@ -60,3 +60,4 @@ dkms.conf
#Code editor
.vscode/*
compile_commands.json

View file

@ -1,14 +1,17 @@
eipaasm:
clang src/* -Wall -Wextra -o eipaasm
CC := clang
CFLAGS := -Wall -Wextra
SRC_DIR := src
BUILD_DIR := build
OBJECT_FILES := $(patsubst %.c, %.o, $(wildcard $(SRC_DIR)/*.c))
OBJECT_FILES := $(patsubst $(SRC_DIR)/%, $(BUILD_DIR)/%, $(OBJECT_FILES))
MAIN_EXE_NAME := eipaasm
all: eipaasm
all eipaasm: $(OBJECT_FILES)
$(CC) $(CFLAGS) $^ -o $(BUILD_DIR)/$(MAIN_EXE_NAME)
run:
./eipaasm
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(BUILD_DIR)
$(CC) -c $(CFLAGS) $^ -o $@
buildrun: compile
./eipaasm
eipaasm_debug:
gcc src/* -g -o eipaasm_debug
clean:
rm -f eipaasm eipaasm_debug
rm -r $(BUILD_DIR)