--- Makefile.orig 2024-03-29 17:21:55.000000000 -0300 +++ Makefile 2024-03-29 21:47:14.000000000 -0300 @@ -6,7 +6,7 @@ OS = $(shell uname -s) CC = gcc -INSTALL = install -p +INSTALL = install ARCH = $(shell uname -m | sed -e s/i.86/i686/) VERSION = $(shell cat VERSION) @@ -56,11 +56,18 @@ endif endif -HEADERS = natpmp.h +HEADERS = natpmp.h natpmp_declspec.h EXECUTABLES = testgetgateway natpmpc-shared natpmpc-static -INSTALLPREFIX ?= $(PREFIX)/usr +#INSTALLPREFIX ?= $(PREFIX) +#INSTALLPREFIX = $(DESTDIR) +# install directories +ifeq ($(strip $(PREFIX)),) +INSTALLPREFIX ?= /usr +else +INSTALLPREFIX ?= $(PREFIX) +endif INSTALLDIRINC = $(INSTALLPREFIX)/include INSTALLDIRLIB = $(INSTALLPREFIX)/lib INSTALLDIRBIN = $(INSTALLPREFIX)/bin @@ -92,14 +99,14 @@ makedepend -f$(MAKEFILE_LIST) -Y $(OBJS:.o=.c) 2>/dev/null install: $(HEADERS) $(STATICLIB) $(SHAREDLIB) natpmpc-shared - $(INSTALL) -d $(INSTALLDIRINC) - $(INSTALL) -m 644 $(HEADERS) $(INSTALLDIRINC) - $(INSTALL) -d $(INSTALLDIRLIB) - $(INSTALL) -m 644 $(STATICLIB) $(INSTALLDIRLIB) - $(INSTALL) -m 644 $(SHAREDLIB) $(INSTALLDIRLIB)/$(SONAME) - $(INSTALL) -d $(INSTALLDIRBIN) - $(INSTALL) -m 755 natpmpc-shared $(INSTALLDIRBIN)/natpmpc - ln -s -f $(SONAME) $(INSTALLDIRLIB)/$(SHAREDLIB) + $(INSTALL) -d $(DESTDIR)$(INSTALLDIRINC) + $(INSTALL) -m 644 $(HEADERS) $(DESTDIR)$(INSTALLDIRINC) + $(INSTALL) -d $(DESTDIR)$(INSTALLDIRLIB) + $(INSTALL) -m 644 $(STATICLIB) $(DESTDIR)$(INSTALLDIRLIB) + $(INSTALL) -m 644 $(SHAREDLIB) $(DESTDIR)$(INSTALLDIRLIB)/$(SONAME) + $(INSTALL) -d $(DESTDIR)$(INSTALLDIRBIN) + $(INSTALL) -m 755 natpmpc-shared $(DESTDIR)$(INSTALLDIRBIN)/natpmpc + ln -s -f $(SONAME) $(DESTDIR)$(INSTALLDIRLIB)/$(SHAREDLIB) $(JNIHEADERS): fr/free/miniupnp/libnatpmp/NatPmp.class $(JAVAH) -jni fr.free.miniupnp.libnatpmp.NatPmp @@ -144,10 +151,10 @@ -DcreateChecksum=true cleaninstall: - $(RM) $(addprefix $(INSTALLDIRINC), $(HEADERS)) - $(RM) $(INSTALLDIRLIB)/$(SONAME) - $(RM) $(INSTALLDIRLIB)/$(SHAREDLIB) - $(RM) $(INSTALLDIRLIB)/$(STATICLIB) + $(RM) $(addprefix $(DESTDIR)$(INSTALLDIRINC), $(HEADERS)) + $(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(SONAME) + $(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(SHAREDLIB) + $(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(STATICLIB) testgetgateway: testgetgateway.o getgateway.o $(CC) $(LDFLAGS) -o $@ $^ $(EXTRA_LD) @@ -163,7 +170,7 @@ $(SHAREDLIB): $(LIBOBJS) ifeq ($(OS), Darwin) - $(CC) -dynamiclib -Wl,-install_name,$(SONAME) -o $@ $^ + $(CC) -dynamiclib -Wl,-install_name,$(INSTALLDIRLIB)/$(SONAME) -o $@ $^ else $(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^ $(EXTRA_LD) endif @@ -171,7 +178,7 @@ # DO NOT DELETE -natpmp.o: natpmp.h getgateway.h declspec.h -getgateway.o: getgateway.h declspec.h -testgetgateway.o: getgateway.h declspec.h +natpmp.o: natpmp.h getgateway.h natpmp_declspec.h +getgateway.o: getgateway.h natpmp_declspec.h +testgetgateway.o: getgateway.h natpmp_declspec.h natpmpc.o: natpmp.h