From c2b7d77784beeae5f86f19e33ba3da5ddce55898 Mon Sep 17 00:00:00 2001 From: Sam James Date: Tue, 18 Jan 2022 13:30:14 +0000 Subject: 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 * 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 * 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 Co-authored-by: Luca Deri --- python/Makefile.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'python/Makefile.in') diff --git a/python/Makefile.in b/python/Makefile.in index a3bcd5da3..3b976804a 100644 --- a/python/Makefile.in +++ b/python/Makefile.in @@ -2,7 +2,8 @@ CC=@CC@ CFLAGS=-I. -I../src/include -I./src/lib/third_party/include @CFLAGS@ @CUSTOM_NDPI@ -shared #LIBNDPI=../src/lib/libndpi.so.@NDPI_VERSION_SHORT@ LIBNDPI=../src/lib/libndpi.a -LDFLAGS=$(CFILE) $(LIBNDPI) -lpcap @LIBS@ @ADDITIONAL_LIBS@ +LDFLAGS=@LDFLAGS@ +LIBS=$(CFILE) $(LIBNDPI) -lpcap @LIBS@ @ADDITIONAL_LIBS@ SHARE = -soname,ndpi_wrap SO=ndpi_wrap.so OBJS = ndpi_wrap.o @@ -19,7 +20,7 @@ endif all: $(SO) $(SO): $(CFILE) $(LIBNDPI) Makefile - $(CC) $(CFLAGS) -Wl,$(SHARE) -o $@ $(PIC) $(LDFLAGS) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(PIC) -Wl,$(SHARE) -o $@ $(LIBS) # ln -s $(LIBNDPI) . clean: -- cgit v1.2.3