Modernized Makefile

This commit is contained in:
Bob Polis 2023-02-09 18:46:37 +01:00
parent b9d8d53c51
commit a61f133a64

View File

@ -59,7 +59,7 @@ all: prebuild $(OUTDIR)$(REALNAME) $(OUTDIR)$(STATICLIB)
prebuild:
@mkdir -p $(BUILDDIR) $(OUTDIR)
$(OUTDIR)$(REALNAME): $(OBJS) $(DEPS)
$(OUTDIR)$(REALNAME): $(OBJS)
ifeq ($(UNAME_S),Darwin)
$(CXX) -dynamiclib -o $(OUTDIR)$(REALNAME) -current_version $(MAJOR) -compatibility_version $(MINOR) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS))
endif
@ -70,13 +70,11 @@ ifeq ($(UNAME_S),Linux)
$(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(OUTDIR)$(REALNAME) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS))
endif
%.o: %.cpp %.d
%.o %d: %.cpp
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
@mv $@ $*.d $(BUILDDIR)
-include $(BUILDDIR)*.d
%.d: ;
-include $(BUILDDIR)$(DEPS)
$(OUTDIR)$(STATICLIB): $(OBJS)
ar r $(OUTDIR)$(STATICLIB) $(addprefix $(BUILDDIR),$(OBJS))