Code cleanup and commentary

This commit is contained in:
2022-04-05 23:53:57 -05:00
parent ff108dcd0b
commit 4cdc3d2d89
6 changed files with 31 additions and 30 deletions

View File

@@ -1,3 +1,5 @@
# ---------- Variables listed below --------- #
# Executable
TARGET := main.out
@@ -17,7 +19,12 @@ CFLAGS = -I$(IPATH) -pthread -lrt
SOURCES = $(wildcard $(SPATH)/*.cpp)
OBJECTS = $(addprefix $(OPATH)/,$(notdir $(SOURCES:.cpp=.o)))
.PHONY: all clean dump
# ----------- Targets listed below ---------- #
# Some targets aren't real
.PHONY: all clean run dump
# Don't autodelete object files:
.PRECIOUS: $(OPATH)/%.o
all: $(DPATH) $(OPATH) $(TARGET)
@@ -31,6 +38,9 @@ clean:
-rm $(TARGET)
-rm -r dep obj
run:
-$(addprefix ./,$(addsuffix ;,$(TARGET)))
$(DPATH) $(OPATH):
mkdir -p $@
@@ -41,8 +51,6 @@ $(DPATH) $(OPATH):
$(OPATH)/%.o: $(SPATH)/%.cpp
$(CC) $(CFLAGS) -MMD -MF $(DPATH)/$(@F:.o=.d) -o $@ -c $<
# Don't autodelete object files:
.SECONDARY: $(OPATH)/%.o
# --------- Inclusions listed below --------- #
# use dependencies when rebuilding
-include $(wildcard $(DPATH)/*.d)