chore: Initial commit
This commit is contained in:
43
makefile
Normal file
43
makefile
Normal file
@@ -0,0 +1,43 @@
|
||||
CC=g++
|
||||
C_FLAGS=-Wall -Wextra -pedantic -ggdb -std=c++20
|
||||
GDB_FLAGS=-ex "b main"
|
||||
VAL_FLAGS=--leak-check=full --show-leak-kinds=all --track-origins=yes -s
|
||||
|
||||
DIR_SRC=src
|
||||
DIR_BUILD=build
|
||||
DEPS=m raylib
|
||||
|
||||
OUTBIN=$(DIR_BUILD)/bin/main
|
||||
|
||||
SRCS=$(shell find $(DIR_SRC) -type f -name '*.cpp')
|
||||
OBJS=$(patsubst $(DIR_SRC)/%.cpp,$(DIR_BUILD)/obj/%.o,$(SRCS))
|
||||
|
||||
DEPS_EXT=$(patsubst %,-l%,$(DEPS))
|
||||
|
||||
|
||||
.PHONY: all build rebuild run dbg val clean
|
||||
|
||||
|
||||
all: $(OUTBIN)
|
||||
build: $(OUTBIN)
|
||||
rebuild: clean build
|
||||
|
||||
run: $(OUTBIN)
|
||||
$(OUTBIN)
|
||||
|
||||
$(OUTBIN): $(OBJS)
|
||||
@mkdir -p $(@D)
|
||||
$(CC) $(OBJS) $(DEPS_EXT) -o $@
|
||||
|
||||
$(DIR_BUILD)/obj/%.o: $(DIR_SRC)/%.cpp
|
||||
@mkdir -p $(@D)
|
||||
$(CC) $(C_FLAGS) -c $< -o $@
|
||||
|
||||
dbg: $(OUTBIN)
|
||||
gdb $(GDB_FLAGS) $<
|
||||
|
||||
val: $(OUTBIN)
|
||||
valgrind $(VAL_FLAGS) $<
|
||||
|
||||
clean:
|
||||
@$(RM) -r $(DIR_BUILD)
|
||||
Reference in New Issue
Block a user