Skip to content

Commit e49e93c

Browse files
IvanNardiclaude
andauthored
Build system: Respect user CFLAGS and LDFLAGS, remove hardcoded -g (#3034)
Fix improper handling of CFLAGS and LDFLAGS throughout the build system. Also remove hardcoded debug flags that prevented production builds without symbols. Problems: --------- 1. CFLAGS/LDFLAGS handling: The build system was using `CFLAGS +=` and `LDFLAGS +=` to append package-specific flags, which modifies the user's environment variables instead of keeping package and user flags separate. This caused: - User-specified optimization levels being overridden by package defaults - Inability to properly override flags at configure or make time - Problems with cross-compilation and embedded toolchains 2. Hardcoded -g flags: Debug symbols (-g) were hardcoded in several Makefiles, forcing debug symbols in all builds including production. This caused: - Larger binary sizes (library and tools) - No way to build without debug symbols - Conflicts with user's debug level preferences (-g1, -g2, -g3) - Redundancy with configure options (--enable-debug-build) Solutions: ---------- 1. Implement proper CFLAGS/LDFLAGS separation using AM_CFLAGS/AM_LDFLAGS: - Added `CFLAGS = @CFLAGS@` to preserve configure-time flags - Added `LDFLAGS = @LDFLAGS@` to preserve configure-time flags - Changed `CFLAGS +=` to `AM_CFLAGS =` and `AM_CFLAGS +=` - Changed `LDFLAGS +=` to `AM_LDFLAGS =` and `AM_LDFLAGS +=` - Updated compilation rules: $(CC) $(AM_CFLAGS) $(CFLAGS) ... - Updated linking rules: $(CC) ... $(AM_LDFLAGS) $(LDFLAGS) ... 2. Remove all hardcoded -g flags from Makefiles: - Debug symbols now controlled via configure (--enable-debug-build) or user CFLAGS (e.g., CFLAGS="-g3") Flag ordering ensures: - Package flags come first (e.g., -O2, -fPIC) - User flags come after and can override (e.g., -O3) - Last flag wins for conflicting options 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent 1bbafbd commit e49e93c

File tree

11 files changed

+79
-49
lines changed

11 files changed

+79
-49
lines changed

configure.ac

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ AC_ARG_ENABLE(global-context-support, AS_HELP_STRING([--disable-global-context-s
3131
AC_ARG_ENABLE(memory-track-origins, AS_HELP_STRING([--disable-memory-track-origins], [Don't add -fsanitize-memory-track-origins flag when compiling with MASAN support. Useful for faster CI]))
3232
AC_ARG_ENABLE(old-croaring, AS_HELP_STRING([--enable-old-croaring], [Always use old croaring version, instead of try to auto-detect if v4 works. Useful with old compilers]),[enable_oldcroaring=$enableval],[enable_oldcroaring=no])
3333

34-
NDPI_CFLAGS="${NDPI_CFLAGS} -D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1"
34+
#These two variables are not supposed to be set/changed by the user:
35+
#he should use standard CFLAGS/LDFLAGS, instead
36+
NDPI_CFLAGS="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1"
37+
NDPI_LDFLAGS=""
3538

3639
AS_IF([test "x$enable_fuzztargets" = "xyes"], [
3740
BUILD_FUZZTARGETS=1

example/Makefile.dpdk.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ LIBNDPI = $(PWD)/../src/lib/libndpi.a
1919

2020
SRCS-y := reader_util.c ndpiReader.c
2121

22-
CFLAGS += -g
23-
CFLAGS += -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-unused-parameter -I $(PWD)/../src/include @CFLAGS@ -DUSE_DPDK
22+
# Preserve user's CFLAGS from configure and add package flags
23+
USER_CFLAGS = @CFLAGS@
24+
CFLAGS += -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-unused-parameter -I $(PWD)/../src/include -DUSE_DPDK $(USER_CFLAGS)
2425
LDLIBS = $(LIBNDPI) @PCAP_LIB@ @LIBS@ @ADDITIONAL_LIBS@ -lpthread @LDFLAGS@
2526

2627
include $(RTE_SDK)/mk/rte.extapp.mk

example/Makefile.in

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ VPATH = @srcdir@
77
AR=@AR@
88
CC=@CC@
99
CXX=@CXX@
10+
CFLAGS=@CFLAGS@
11+
LDFLAGS=@LDFLAGS@
1012
ifneq ($(OS),Windows_NT)
1113
OS := $(shell uname)
1214
endif
@@ -19,10 +21,12 @@ DISABLE_NPCAP=@DISABLE_NPCAP@
1921
EXE_SUFFIX=@EXE_SUFFIX@
2022
SRCHOME=$(top_srcdir)/src
2123
ifneq ($(OS),Windows_NT)
22-
CFLAGS+=-fPIC -DPIC
24+
AM_CFLAGS=-fPIC -DPIC
25+
else
26+
AM_CFLAGS=
2327
endif
24-
CFLAGS+=-I$(SRCHOME)/include -I$(top_builddir)/src/include @NDPI_CFLAGS@ @PCAP_INC@ @GPROF_CFLAGS@ @CUSTOM_NDPI@
25-
LDFLAGS+=@NDPI_LDFLAGS@
28+
AM_CFLAGS+=-I$(SRCHOME)/include -I$(top_builddir)/src/include @NDPI_CFLAGS@ @PCAP_INC@ @GPROF_CFLAGS@ @CUSTOM_NDPI@
29+
AM_LDFLAGS=@NDPI_LDFLAGS@
2630
LIBNDPI=$(top_builddir)/src/lib/libndpi.a
2731
LIBS=$(LIBNDPI) @PCAP_LIB@ @ADDITIONAL_LIBS@ @GPROF_LIBS@ @LIBS@
2832
HEADERS=reader_util.h $(SRCHOME)/include/ndpi_api.h \
@@ -33,9 +37,9 @@ PREFIX?=@prefix@
3337
ifneq ($(BUILD_MINGW),)
3438

3539
ifeq ($(DISABLE_NPCAP),0)
36-
CFLAGS+=-I@srcdir@/../windows/WpdPack/Include -I@srcdir@/../windows/WpdPack/Include/pcap
40+
AM_CFLAGS+=-I@srcdir@/../windows/WpdPack/Include -I@srcdir@/../windows/WpdPack/Include/pcap
3741
else
38-
CFLAGS+=-DDISABLE_NPCAP
42+
AM_CFLAGS+=-DDISABLE_NPCAP
3943
endif
4044

4145
ifeq ($(DISABLE_NPCAP),0)
@@ -53,7 +57,7 @@ else
5357
LIBS+=-pthread
5458
endif
5559

56-
CFLAGS+=-pthread
60+
AM_CFLAGS+=-pthread
5761

5862
all: ndpiReader$(EXE_SUFFIX) @DPDK_TARGET@
5963

@@ -64,13 +68,13 @@ libndpiReader.a: $(COMMON_SOURCES:%.c=%.o) $(LIBNDPI)
6468
$(AR) rsv libndpiReader.a $(COMMON_SOURCES:%.c=%.o)
6569

6670
ndpiReader$(EXE_SUFFIX): libndpiReader.a $(LIBNDPI) ndpiReader.o
67-
$(CC) $(CFLAGS) $(LDFLAGS) ndpiReader.o libndpiReader.a $(LIBS) -o $@
71+
$(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) ndpiReader.o libndpiReader.a $(LIBS) -o $@
6872

6973
ndpiSimpleIntegration$(EXE_SUFFIX): ndpiSimpleIntegration.o
70-
$(CC) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@
74+
$(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) $< $(LIBS) -o $@
7175

7276
%.o: %.c $(HEADERS) Makefile
73-
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
77+
$(CC) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $< -o $@
7478

7579
install: ndpiReader$(EXE_SUFFIX)
7680
@MKDIR_P@ $(DESTDIR)$(PREFIX)/bin/

fuzz/Makefile.am

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,20 @@ bin_PROGRAMS += fuzz_ndpi_reader_pl7m fuzz_ndpi_reader_pl7m_64k fuzz_ndpi_reader
1717
#Common flags
1818
AM_CPPFLAGS = -I $(top_srcdir)/src/include -I $(top_srcdir)/src/lib/third_party/include/ @NDPI_CFLAGS@
1919
AM_LDFLAGS = $(LIBS)
20-
AM_CFLAGS = @NDPI_CFLAGS@ $(CFLAGS)
21-
AM_CXXFLAGS = @NDPI_CFLAGS@ $(CXXFLAGS)
20+
# Use AM_CFLAGS for package flags, never modify or embed user's CFLAGS
21+
AM_CFLAGS = @NDPI_CFLAGS@
22+
AM_CXXFLAGS = @NDPI_CFLAGS@
2223
LDADD = $(top_builddir)/src/lib/libndpi.a $(PCAP_LIB) $(ADDITIONAL_LIBS)
2324
if HAS_FUZZLDFLAGS
24-
CFLAGS += $(LIB_FUZZING_ENGINE)
25-
LDFLAGS += $(LIB_FUZZING_ENGINE)
26-
CXXFLAGS += $(LIB_FUZZING_ENGINE)
25+
AM_CFLAGS += $(LIB_FUZZING_ENGINE)
26+
AM_LDFLAGS += $(LIB_FUZZING_ENGINE)
27+
AM_CXXFLAGS += $(LIB_FUZZING_ENGINE)
2728
endif
2829

2930
# Common linker command template for all fuzz targets
3031
# All fuzz targets need to use CXX as linker (required by libFuzzer)
3132
FUZZ_LINK_COMMAND = $(AM_V_CCLD)$(LIBTOOL) $(AM_V_lt) --silent --tag=CC $(AM_LIBTOOLFLAGS) \
32-
$(LIBTOOLFLAGS) --mode=link $(CXX) @NDPI_CFLAGS@ $(AM_CXXFLAGS) $(CXXFLAGS) \
33+
$(LIBTOOLFLAGS) --mode=link $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) \
3334
$($@_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@
3435

3536
# Define sources and flags for each fuzz target

influxdb/Makefile.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ top_builddir = @top_builddir@
55
VPATH = @srcdir@
66

77
CC=@CC@
8+
LDFLAGS=@LDFLAGS@
9+
CFLAGS=@CFLAGS@
10+
AM_CFLAGS=@NDPI_CFLAGS@
811
INC=-I $(top_srcdir)/src/include -I $(top_builddir)/src/include -I/usr/local/include
912
LIBDPI=$(top_builddir)/src/lib/libndpi.a
10-
CFLAGS+=@NDPI_CFLAGS@
11-
LDFLAGS+=@NDPI_LDFLAGS@
13+
AM_LDFLAGS=@NDPI_LDFLAGS@
1214
LIB=$(LIBDPI) @ADDITIONAL_LIBS@ @LIBS@ -lm
1315
GEN_HEADERS=$(top_builddir)/src/include/ndpi_config.h $(top_builddir)/src/include/ndpi_define.h
1416

@@ -17,7 +19,7 @@ TOOLS=metric_anomaly
1719
all: $(TOOLS)
1820

1921
metric_anomaly: $(srcdir)/metric_anomaly.c Makefile $(LIBDPI) $(GEN_HEADERS)
20-
$(CC) $(CFLAGS) $(CPPFLAGS) -g $(INC) $(LDFLAGS) $(srcdir)/metric_anomaly.c -o metric_anomaly $(LIB)
22+
$(CC) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(INC) $(AM_LDFLAGS) $(LDFLAGS) $(srcdir)/metric_anomaly.c -o metric_anomaly $(LIB)
2123

2224
clean:
2325
/bin/rm -f *.o $(TOOLS) *~

rrdtool/Makefile.in

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ top_builddir = @top_builddir@
55
VPATH = @srcdir@
66

77
CC=@CC@
8+
LDFLAGS=@LDFLAGS@
9+
CFLAGS=@CFLAGS@
10+
AM_CFLAGS=@NDPI_CFLAGS@
811
INC=-I $(top_srcdir)/src/include -I $(top_builddir)/src/include -I/usr/local/include
912
LIBDPI=$(top_builddir)/src/lib/libndpi.a
10-
CFLAGS+=@NDPI_CFLAGS@
11-
LDFLAGS+=@NDPI_LDFLAGS@
13+
AM_LDFLAGS=@NDPI_LDFLAGS@
1214
LIB=$(LIBDPI) @ADDITIONAL_LIBS@ @LIBRRD@ @LIBS@ -lm -lpthread
1315
GEN_HEADERS=$(top_builddir)/src/include/ndpi_config.h $(top_builddir)/src/include/ndpi_define.h
1416

@@ -17,10 +19,10 @@ TOOLS=rrd_anomaly rrd_similarity
1719
all: $(TOOLS)
1820

1921
rrd_anomaly: $(srcdir)/rrd_anomaly.c Makefile $(LIBDPI) $(GEN_HEADERS)
20-
$(CC) $(CFLAGS) $(CPPFLAGS) -g $(INC) $(LDFLAGS) $(srcdir)/rrd_anomaly.c -o rrd_anomaly $(LIB)
22+
$(CC) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(INC) $(AM_LDFLAGS) $(LDFLAGS) $(srcdir)/rrd_anomaly.c -o rrd_anomaly $(LIB)
2123

2224
rrd_similarity: $(srcdir)/rrd_similarity.c Makefile $(LIBDPI) $(GEN_HEADERS)
23-
$(CC) $(CFLAGS) $(CPPFLAGS) -g $(INC) $(LDFLAGS) $(srcdir)/rrd_similarity.c -o rrd_similarity $(LIB)
25+
$(CC) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(INC) $(AM_LDFLAGS) $(LDFLAGS) $(srcdir)/rrd_similarity.c -o rrd_similarity $(LIB)
2426

2527
clean:
2628
/bin/rm -f *.o $(TOOLS) *~

src/lib/Makefile.in

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ VPATH = @srcdir@:@srcdir@/protocols:@srcdir@/third_party/src:@srcdir@/third_part
1414
AR = @AR@
1515
CC = @CC@
1616
RANLIB = @RANLIB@
17+
# Preserve user's CFLAGS and LDFLAGS from configure
18+
CFLAGS = @CFLAGS@
19+
LDFLAGS = @LDFLAGS@
1720
#
1821
# Installation directories
1922
#
@@ -27,15 +30,18 @@ ifneq ($(OS),Windows_NT)
2730
OS := $(shell uname)
2831
endif
2932
ifneq ($(OS),Windows_NT)
30-
CFLAGS += -fPIC -DPIC
33+
AM_CFLAGS = -fPIC -DPIC
34+
else
35+
AM_CFLAGS =
3136
endif
32-
CFLAGS += -I$(srcdir) -I$(top_srcdir)/src/include -I$(top_builddir)/src/include -I$(srcdir)/third_party/include -DNDPI_LIB_COMPILATION @NDPI_CFLAGS@ @GPROF_CFLAGS@ @CUSTOM_NDPI@ @ADDITIONAL_INCS@
37+
AM_CFLAGS += -I$(srcdir) -I$(top_srcdir)/src/include -I$(top_builddir)/src/include -I$(srcdir)/third_party/include -DNDPI_LIB_COMPILATION @NDPI_CFLAGS@ @GPROF_CFLAGS@ @CUSTOM_NDPI@ @ADDITIONAL_INCS@
3338
CFLAGS_ndpi_bitmap.c := -Wno-unused-function
3439
CFLAGS_ndpi_bitmap64_fuse.c := -Wno-unused-function
3540
CFLAGS_gcrypt_light.c := -Wno-unused-function -Wno-unused-parameter
3641
CFLAGS_ahocorasick.c := -Wno-unused-function -Wno-unused-parameter
3742
CFLAGS_roaring.c := -Wno-unused-function -Wno-attributes
38-
LDFLAGS += @NDPI_LDFLAGS@
43+
# Use AM_LDFLAGS for package flags, never modify user's LDFLAGS
44+
AM_LDFLAGS = @NDPI_LDFLAGS@
3945
LIBS = @ADDITIONAL_LIBS@ @LIBS@ @GPROF_LIBS@
4046

4147
OBJECTS = $(patsubst $(srcdir)/protocols/%.c, %.o, $(wildcard $(srcdir)/protocols/*.c)) $(patsubst $(srcdir)/third_party/src/%.c, %.o, $(wildcard $(srcdir)/third_party/src/*.c)) $(patsubst $(srcdir)/third_party/src/hll/%.c, %.o, $(wildcard $(srcdir)/third_party/src/hll/*.c)) $(patsubst $(srcdir)/%.c, %.o, $(wildcard $(srcdir)/*.c))
@@ -78,12 +84,12 @@ $(NDPI_LIB_STATIC): $(OBJECTS)
7884
$(RANLIB) $@
7985

8086
$(NDPI_LIB_SHARED): $(OBJECTS)
81-
$(CC) -shared -fPIC $(CFLAGS) $(SONAME_FLAG) -o $@ $(LDFLAGS) $(OBJECTS) $(LIBS)
87+
$(CC) -shared -fPIC $(AM_CFLAGS) $(CFLAGS) $(SONAME_FLAG) -o $@ $(AM_LDFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS)
8288
ln -fs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE)
8389
ln -fs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE).$(NDPI_VERSION_MAJOR)
8490

8591
%.o: %.c $(HEADERS) Makefile
86-
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$(notdir $<)) -c $< -o $@
92+
$(CC) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(CFLAGS_$(notdir $<)) -c $< -o $@
8793

8894
clean:
8995
/bin/rm -f $(NDPI_LIB_STATIC) $(NDPI_LIB_SHARED) $(OBJECTS) *.o *.so *.so.* *.lo *.dll

tests/dga/Makefile.in

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@ top_builddir = @top_builddir@
55
VPATH = @srcdir@
66

77
CC=@CC@
8+
LDFLAGS=@LDFLAGS@
89
CXX=@CXX@
10+
CFLAGS=@CFLAGS@
911
EXE_SUFFIX=@EXE_SUFFIX@
1012

1113
SRCHOME=$(top_srcdir)/src
1214

1315
ifneq ($(OS),Windows_NT)
14-
CFLAGS+=-fPIC -DPIC
16+
AM_CFLAGS=-fPIC -DPIC
17+
else
18+
AM_CFLAGS=
1519
endif
16-
CFLAGS+=-g -I$(SRCHOME)/include -I$(top_builddir)/src/include @NDPI_CFLAGS@
20+
AM_CFLAGS+=-I$(SRCHOME)/include -I$(top_builddir)/src/include @NDPI_CFLAGS@
1721
LIBNDPI=$(top_builddir)/src/lib/libndpi.a
1822
LIBS=$(LIBNDPI) @ADDITIONAL_LIBS@ @LIBS@ -lpthread
19-
LDFLAGS+=@NDPI_LDFLAGS@
23+
AM_LDFLAGS=@NDPI_LDFLAGS@
2024
HEADERS=$(SRCHOME)/include/ndpi_api.h $(SRCHOME)/include/ndpi_typedefs.h $(SRCHOME)/include/ndpi_protocol_ids.h
2125
HEADERS+=$(top_builddir)/src/include/ndpi_config.h $(top_builddir)/src/include/ndpi_define.h
2226
OBJS=dga_evaluate
@@ -28,10 +32,10 @@ EXECUTABLE_SOURCES := dga_evaluate.c
2832
COMMON_SOURCES := $(filter-out $(EXECUTABLE_SOURCES),$(wildcard *.c ))
2933

3034
dga_evaluate$(EXE_SUFFIX): $(LIBNDPI) dga_evaluate.o
31-
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) dga_evaluate.o $(LIBS) -o $@
35+
$(CC) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(AM_LDFLAGS) $(LDFLAGS) dga_evaluate.o $(LIBS) -o $@
3236

3337
%.o: %.c $(HEADERS) Makefile
34-
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
38+
$(CC) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $< -o $@
3539

3640
clean:
3741
/bin/rm -f *.o dga_evaluate$(EXE_SUFFIX)

tests/ossfuzz.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ cd ndpi
4545
#There are two workarounds:
4646
# * pcap stuff + --with-only-libndpi: for introspector builds. As reported in #8939, configure is not able to detect external libraries in introspector builds
4747
# * ADDITIONAL_* stuff: to be able run tests/unit/unit (via chronos/check_tests.sh) even with the previous workaround
48-
./autogen.sh && AR=llvm-ar RANLIB=llvm-ranlib NDPI_LDFLAGS="-L/usr/local/lib -lpcap" ADDITIONAL_INCS="-I/usr/local/include/json-c/" ADDITIONAL_LIBS="-L/usr/local/lib -ljson-c" ./configure --enable-fuzztargets --enable-tls-sigs --with-only-libndpi
48+
./autogen.sh && AR=llvm-ar RANLIB=llvm-ranlib LDFLAGS="-L/usr/local/lib -lpcap" ADDITIONAL_INCS="-I/usr/local/include/json-c/" ADDITIONAL_LIBS="-L/usr/local/lib -ljson-c" ./configure --enable-fuzztargets --enable-tls-sigs --with-only-libndpi
4949
make -j$(nproc)
5050
# Copy fuzzers
5151
ls fuzz/fuzz* | grep -v "\." | while read -r i; do cp "$i" "$OUT"/; done

tests/performance/Makefile.in

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ top_srcdir = @top_srcdir@
44
top_builddir = @top_builddir@
55
VPATH = @srcdir@
66

7+
CFLAGS=@CFLAGS@
8+
AM_CFLAGS=@NDPI_CFLAGS@
9+
710
INC=-I $(top_srcdir)/src/include/ -I $(top_builddir)/src/include/ -I $(top_srcdir)/src/lib/third_party/include/
811
LIB=$(top_builddir)/src/lib/libndpi.a @ADDITIONAL_LIBS@ @LIBS@
912
GEN_HEADERS=$(top_builddir)/src/include/ndpi_config.h $(top_builddir)/src/include/ndpi_define.h
@@ -17,19 +20,19 @@ all: $(TESTS)
1720
tools: $(TOOLS)
1821

1922
gcrypt-int: $(srcdir)/gcrypt.c Makefile $(GEN_HEADERS)
20-
$(CC) $(INC) @NDPI_CFLAGS@ @CFLAGS@ $(srcdir)/gcrypt.c -o $@
23+
$(CC) $(INC) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/gcrypt.c -o $@
2124

2225
gcrypt-gnu: $(srcdir)/gcrypt.c Makefile $(GEN_HEADERS)
23-
$(CC) $(INC) @NDPI_CFLAGS@ @CFLAGS@ -DHAVE_LIBGCRYPT $(srcdir)/gcrypt.c -o $@ -lgcrypt
26+
$(CC) $(INC) $(AM_CFLAGS) $(CFLAGS) -DHAVE_LIBGCRYPT $(srcdir)/gcrypt.c -o $@ -lgcrypt
2427

2528
substringsearch: $(srcdir)/substringsearch.c Makefile $(GEN_HEADERS)
26-
$(CC) $(INC) @NDPI_CFLAGS@ @CFLAGS@ $(srcdir)/substringsearch.c -o substringsearch $(LIB)
29+
$(CC) $(INC) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/substringsearch.c -o substringsearch $(LIB)
2730

2831
strnstr: $(srcdir)/strnstr.cpp Makefile $(GEN_HEADERS)
29-
$(CXX) $(INC) @NDPI_CFLAGS@ @CFLAGS@ $(srcdir)/strnstr.cpp -o strnstr
32+
$(CXX) $(INC) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/strnstr.cpp -o strnstr
3033

3134
geo: $(srcdir)/geo.c Makefile $(GEN_HEADERS)
32-
$(CC) $(INC) @NDPI_CFLAGS@ @CFLAGS@ $(srcdir)/geo.c -o geo $(LIB)
35+
$(CC) $(INC) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/geo.c -o geo $(LIB)
3336

3437
substring_test: substringsearch top-1m.csv
3538
./substringsearch
@@ -43,7 +46,7 @@ geo_test: geo
4346
#
4447

4548
patriciasearch: $(srcdir)/patriciasearch.c Makefile $(GEN_HEADERS)
46-
$(CC) $(INC) @NDPI_CFLAGS@ @CFLAGS@ $(srcdir)/patriciasearch.c -o patriciasearch $(LIB)
49+
$(CC) $(INC) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/patriciasearch.c -o patriciasearch $(LIB)
4750

4851
patricia_test: patriciasearch blacklist-ip.txt
4952
./patriciasearch

0 commit comments

Comments
 (0)