--- Makefile.orig 2023-08-16 15:52:02 UTC +++ Makefile @@ -24,7 +24,7 @@ # Uncomment if you want libpri not send PROGRESS_INDICATOR w/ALERTING #ALERTING=-DALERTING_NO_PROGRESS -CC=gcc +CC?=gcc GREP=grep AWK=awk AR=ar @@ -36,7 +36,7 @@ PROC?=$(shell uname -m) # SONAME version; should be changed on every ABI change # please don't change it needlessly; it's perfectly fine to have a SONAME # of 1.2 and a version of 1.4.x -SONAME:=1.4 +SONAME:=1 STATIC_LIBRARY=libpri.a DYNAMIC_LIBRARY:=libpri.so.$(SONAME) @@ -70,10 +70,10 @@ DYNAMIC_OBJS= \ $(STATIC_OBJS) CFLAGS ?= -g CFLAGS += $(CPPFLAGS) -CFLAGS += -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -Wno-zero-length-bounds -Wno-stringop-overflow +CFLAGS += -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-zero-length-bounds -Wno-stringop-overflow CFLAGS += -fPIC $(ALERTING) $(LIBPRI_OPT) $(COVERAGE_CFLAGS) -INSTALL_PREFIX=$(DESTDIR) -INSTALL_BASE=/usr +INSTALL_PREFIX=$(PREFIX) +INSTALL_BASE= libdir?=$(INSTALL_BASE)/lib ifneq ($(findstring Darwin,$(OSARCH)),) SOFLAGS=$(LDFLAGS) -dynamic -bundle -Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace @@ -91,7 +91,7 @@ else ifeq (${OSARCH},FreeBSD) LDCONFIG_FLAGS=-m CFLAGS += -I../zaptel -I../zapata -INSTALL_BASE=/usr/local +INSTALL_BASE= endif endif ifeq (${OSARCH},SunOS) @@ -151,12 +151,12 @@ install: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY) mkdir -p $(INSTALL_PREFIX)$(libdir) mkdir -p $(INSTALL_PREFIX)$(INSTALL_BASE)/include ifneq (${OSARCH},SunOS) - install -m 644 libpri.h $(INSTALL_PREFIX)$(INSTALL_BASE)/include - install -m 755 $(DYNAMIC_LIBRARY) $(INSTALL_PREFIX)$(libdir) + $(BSD_INSTALL_DATA) libpri.h $(INSTALL_PREFIX)$(INSTALL_BASE)/include + $(BSD_INSTALL_PROGRAM) $(DYNAMIC_LIBRARY) $(INSTALL_PREFIX)$(libdir) #if [ -x /usr/sbin/sestatus ] && ( /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"); then /sbin/restorecon -v $(INSTALL_PREFIX)$(libdir)/$(DYNAMIC_LIBRARY); fi ( cd $(INSTALL_PREFIX)$(libdir) ; ln -sf $(DYNAMIC_LIBRARY) libpri.so) - install -m 644 $(STATIC_LIBRARY) $(INSTALL_PREFIX)$(libdir) - if test $$(id -u) = 0; then $(LDCONFIG) $(LDCONFIG_FLAGS) $(INSTALL_PREFIX)$(libdir); fi + $(BSD_INSTALL_DATA) $(STATIC_LIBRARY) $(INSTALL_PREFIX)$(libdir) + #if test $$(id -u) = 0; then $(LDCONFIG) $(LDCONFIG_FLAGS) $(INSTALL_PREFIX)$(libdir); fi else install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include -m 644 libpri.h install -f $(INSTALL_PREFIX)$(libdir) -m 755 $(DYNAMIC_LIBRARY) @@ -192,7 +192,7 @@ MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP $(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $< %.lo: %.c - $(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $< + $(CC) $(CFLAGS) $(MAKE_DEPS) -fPIC -c -o $@ $< $(STATIC_LIBRARY): $(STATIC_OBJS) $(AR) rcs $(STATIC_LIBRARY) $(STATIC_OBJS) @@ -200,7 +200,7 @@ $(STATIC_LIBRARY): $(STATIC_OBJS) $(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS) $(CC) $(SOFLAGS) -o $@ $(DYNAMIC_OBJS) - $(LDCONFIG) $(LDCONFIG_FLAGS) . + #$(LDCONFIG) $(LDCONFIG_FLAGS) . ln -sf $(DYNAMIC_LIBRARY) libpri.so version.c: FORCE