aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-12 20:16:46 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-12 20:16:46 +0200
commit9270528a26cfd9f19d79519a61712c9d2f426106 (patch)
tree10d34ed97bffe930ad31c7ecff08852769c725b3 /makefile
parent7b101df2d5742773058ae0a2fbc2d172beae7291 (diff)
build system improvements
Diffstat (limited to 'makefile')
-rw-r--r--makefile23
1 files changed, 12 insertions, 11 deletions
diff --git a/makefile b/makefile
index cbdba7f..1cb47c3 100644
--- a/makefile
+++ b/makefile
@@ -1,24 +1,25 @@
-CC = g++
-LD = g++
-RM = rm -f
-CFLAGS = -g -std=c++20
-LFLAGS =
+CXXFLAGS += -g
+CXXFLAGS += -std=c++20
TARGET = main
+
SRCS := $(wildcard *.cpp)
-OBJS := $(patsubst %.cpp,%.o, $(SRCS))
+OBJS := $(SRCS:.cpp=.o)
+DEPS := $(SRCS:.cpp=.d)
all: $(TARGET)
-%.o: %.cpp
- $(CC) -c $(CFLAGS) $< -o $@
+-include $(wildcard *.d)
+all: $(DEPS)
$(TARGET): $(OBJS)
- $(LD) $^ $(LFLAGS) -o $@
+ $(CXX) $^ $(LFLAGS) -o $@
+
+%.d: %.cpp
+ $(CXX) -M $< -o $@
clean:
- $(RM) $(TARGET) $(OBJS)
+ $(RM) $(TARGET) $(OBJS) $(DEPS)
compile_commands.json:
compiledb make -Bn
-_Bj: ; $(MAKE) -C . -Bj