@@ -, +, @@ Makefile | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) --- a/Makefile +++ a/Makefile @@ -11,7 +11,8 @@ INSTALL = install # APIVERSION is used in soname APIVERSION = 1 #LDFLAGS = -Wl,--no-undefined -CFLAGS = -O -fPIC -Wall -DENABLE_STRNATPMPERR +CFLAGS := -O -fPIC -Wall -DENABLE_STRNATPMPERR $(CFLAGS) +LIBDIR ?= lib LIBOBJS = natpmp.o getgateway.o @@ -29,11 +30,11 @@ endif HEADERS = natpmp.h -EXECUTABLES = testgetgateway natpmpc-shared natpmpc-static +EXECUTABLES = testgetgateway natpmpc-shared INSTALLPREFIX ?= $(PREFIX)/usr INSTALLDIRINC = $(INSTALLPREFIX)/include -INSTALLDIRLIB = $(INSTALLPREFIX)/lib +INSTALLDIRLIB = $(INSTALLPREFIX)/$(LIBDIR) INSTALLDIRBIN = $(INSTALLPREFIX)/bin .PHONY: all clean depend install cleaninstall installpythonmodule @@ -74,19 +75,19 @@ cleaninstall: testgetgateway: testgetgateway.o getgateway.o natpmpc-static: natpmpc.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $^ + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ natpmpc-shared: natpmpc.o $(SHAREDLIB) - $(CC) $(LDFLAGS) -o $@ $^ + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(STATICLIB): $(LIBOBJS) $(AR) crs $@ $? $(SHAREDLIB): $(LIBOBJS) ifeq ($(OS), Darwin) - $(CC) -dynamiclib -Wl,-install_name,$(SONAME) -o $@ $^ + $(CC) $(LDFLAGS) -dynamiclib -Wl,-install_name,$(SONAME) -o $@ $^ else - $(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^ + $(CC) $(LDFLAGS) -shared -Wl,-soname,$(SONAME) -o $@ $^ endif # DO NOT DELETE