Fixed Makfile

This commit is contained in:
Bob Polis 2023-02-09 17:04:21 +01:00
parent 152d83c863
commit ba7fdaea61

View File

@ -7,7 +7,6 @@ MANPAGE := $(BIN).$(MANSECTION)
SRCS := $(notdir $(wildcard src/*.cpp)) SRCS := $(notdir $(wildcard src/*.cpp))
OBJS := $(SRCS:.cpp=.o) OBJS := $(SRCS:.cpp=.o)
DEPS := $(SRCS:.cpp=.d)
BUILDDIR := build/intermediates/ BUILDDIR := build/intermediates/
PREFIX ?= /usr/local PREFIX ?= /usr/local
@ -42,17 +41,15 @@ all: prebuild $(OUTDIR)$(BIN)
prebuild: prebuild:
@mkdir -p $(BUILDDIR) $(OUTDIR) @mkdir -p $(BUILDDIR) $(OUTDIR)
$(OUTDIR)$(BIN): $(OBJS) $(DEPS) $(OUTDIR)$(BIN): $(OBJS)
$(CXX) -o $(OUTDIR)$(BIN) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS)) $(CXX) -o $(OUTDIR)$(BIN) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS))
@ln -sf $(OUTDIR)$(BIN) $(BIN) @ln -sf $(OUTDIR)$(BIN) $(BIN)
%.o: %.cpp %.d %.o %.d: %.cpp
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $< $(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
@mv $@ $*.d $(BUILDDIR) @mv $@ $*.d $(BUILDDIR)
-include $(BUILDDIR)*.d -include $(BUILDDIR)$(SRCS:.cpp=.d)
%.d: ;
test: test:
$(MAKE) -C tests && tests/tests $(MAKE) -C tests && tests/tests