Skip to content
Snippets Groups Projects
Commit 8aa5b0e2 authored by TwilCynder's avatar TwilCynder
Browse files

makefile overhaul + .gitignore

parent 6759b0ae
No related branches found
No related tags found
No related merge requests found
......@@ -14,4 +14,4 @@ obj
*.swo
.vscode
ext_tester/test
ext_tester/bin
\ No newline at end of file
ext_tester/bin/*
\ No newline at end of file
include ../build_params.mk
BIN = test
SRC_DIR = src
OBJ_DIR = obj
SRC= $(wildcard *.c ./**/*.c)
SRC= $(wildcard $(SRC_DIR)/*.c $(SRC_DIR)/**/*.c)
_OBJS= $(SRC:.c=.o)
OBJS = $(patsubst %,$(OBJ_DIR)/%,$(_OBJS))
OBJS = $(patsubst $(SRC_DIR)/%,$(OBJ_DIR)/%,$(_OBJS))
OBJDIRS:=$(dir $(OBJECTS))
all: $(BIN)
$(OBJ_DIR)/%.o: %.c $(OBJ_DIR)
$(eval CURRENT_NB=$(shell echo $$(($(CURRENT_NB)+1))))
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(OBJ_DIR)
@mkdir -p $(dir $@)
$(CC) $(CPPFLAGS) -c $< -o $@
$(BIN): $(OBJS)
@printf "\033[1;33m[Linking]\033[0m \n"
$(CC) $^ -o $@ $(LDFLAGS)
......@@ -25,5 +22,10 @@ $(BIN): $(OBJS)
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
clear:
rm -r $(OBJ_DIR)/*
clean: clear $(BIN)
run: $(BIN)
./$(BIN)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment