Add a proper makefile
which automatically scans for files and only compiles new changes
This commit is contained in:
parent
861225a3b8
commit
b1fd802e89
2 changed files with 14 additions and 10 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -60,3 +60,4 @@ dkms.conf
|
|||
|
||||
#Code editor
|
||||
.vscode/*
|
||||
compile_commands.json
|
||||
|
|
23
Makefile
23
Makefile
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue