aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorSam James <sam@cmpct.info>2022-01-18 13:30:14 +0000
committerGitHub <noreply@github.com>2022-01-18 14:30:14 +0100
commitc2b7d77784beeae5f86f19e33ba3da5ddce55898 (patch)
tree3fc4f7fc31219e051afbca994274ee1c6f92112d /src/lib
parente4a7990a4e4842b4e6f5b10fb51ab288fa340240 (diff)
build: respect environment options more (#1392)
* build: update m4/ax_pthread.m4 from serial 23 -> serial 31 Update ax_pthread.m4 to the latest version from the autoconf-archive project. Signed-off-by: Sam James <sam@gentoo.org> * build: properly detect AR, CC, RANLIB It's necessary to be able to override choice of AR/CC/RANLIB and other toolchain variables/tools for cross-compilation, testing with other toolchains, and to ensure the compiler chosen by the user is actually used for the build. Previously, GNU_PREFIX was kind-of used for this but this isn't a standard variable (at all) and it wasn't applied consistently anyway. We now use the standard autoconf mechanisms for finding these tools. (RANLIB is already covered by LT_INIT.) Signed-off-by: Sam James <sam@gentoo.org> * build: use $(MAKE) This ensures that parallel make works correctly, as otherwise, a fresh make job will be started without the jobserver fd, and hence not know about its parent, forcing -j1. * build: respect CPPFLAGS, LDFLAGS - CPPFLAGS is for the C preprocessor (usually for setting defines) - LDFLAGS should be placed before objects for certain flags to work (e.g. -Wl,--as-needed) Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: Luca Deri <lucaderi@users.noreply.github.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.in15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in
index 56b9628c0..e3a3f9a9a 100644
--- a/src/lib/Makefile.in
+++ b/src/lib/Makefile.in
@@ -5,17 +5,18 @@
# cd src/lib
# make Makefile
#
-
+AR = @AR@
+CC = @CC@
+RANLIB = @RANLIB@
#
# Installation directories
#
prefix = @prefix@
libdir = ${prefix}/lib
includedir = ${prefix}/include/ndpi
-CC = @GNU_PREFIX@@CC@
CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION @CFLAGS@ @CUSTOM_NDPI@
-LDFLAGS = @LDFLAGS@ @ADDITIONAL_LIBS@ @LIBS@
-RANLIB = @GNU_PREFIX@ranlib
+LDFLAGS = @LDFLAGS@
+LIBS = @ADDITIONAL_LIBS@ @LIBS@
OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) $(patsubst ./%.c, ./%.o, $(wildcard ./*.c))
HEADERS = $(wildcard ../include/*.h)
@@ -47,16 +48,16 @@ all: $(NDPI_LIBS)
ndpi_main.c: ndpi_content_match.c.inc
$(NDPI_LIB_STATIC): $(OBJECTS)
- @GNU_PREFIX@ar rc $@ $(OBJECTS)
+ $(AR) rc $@ $(OBJECTS)
$(RANLIB) $@
$(NDPI_LIB_SHARED): $(OBJECTS)
- $(CC) -shared -fPIC $(SONAME_FLAG) -o $@ $(OBJECTS) $(LDFLAGS)
+ $(CC) -shared -fPIC $(SONAME_FLAG) -o $@ $(LDFLAGS) $(OBJECTS) $(LIBS)
ln -fs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE)
ln -fs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE).$(NDPI_VERSION_MAJOR)
%.o: %.c $(HEADERS) Makefile
- $(CC) $(CFLAGS) -c $< -o $@
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
clean:
/bin/rm -f $(NDPI_LIB_STATIC) $(OBJECTS) *.o *.so *.lo libndpi.so*