+STGLIBS_LIBS = $(addprefix -lstg,$(STGLIBS))
+
+CXXFLAGS += -fPIC $(DEFS) $(SEARCH_DIRS) $(STGLIBS_INCS)
+CFLAGS += -fPIC $(DEFS) $(SEARCH_DIRS) $(STGLIBS_INCS)
+
+ifneq ($(OS),darwin)
+LDFLAGS += -shared -Wl,-rpath,$(PREFIX)/usr/lib/stg
+else
+LDFLAGS += -dynamiclib -undefined suppress -flat_namespace -Wl,-rpath,$(PREFIX)/usr/lib/stg
+endif