diff --git a/Makefile b/Makefile index 0acf49e..d06d7a6 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,11 @@ else CXXFLAGS += -D NDEBUG -O3 endif -LDLIBS := -lm -lscgui -lSDL2 -lcairo -lscerror -lscstring -lscscreensaver -lscnumerics +LDLIBS := -lm -lscgui -lcairo -lscerror -lscstring -lscscreensaver -lscnumerics + +LDLIBS += $(shell pkg-config sdl2 --libs) +CXXFLAGS += $(shell pkg-config sdl2 --cflags) + UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) @@ -53,15 +57,13 @@ endif all: $(BIN) modules -$(BIN): $(OBJS) $(DEPS) +$(BIN): $(OBJS) $(CXX) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $(BIN) -%.o: %.cpp %.d Makefile +%.o %.d: %.cpp $(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $< --include *.d - -%.d: ; +-include $(DEPS) new: @./newmodule $(NEW_ARGS)