[njs] Fixed include directories order.

Dmitry Volyntsev xeioex at nginx.com
Tue Nov 7 23:37:01 UTC 2023


details:   https://hg.nginx.org/njs/rev/d0f7f3c071ad
branches:  
changeset: 2229:d0f7f3c071ad
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Tue Nov 07 15:35:35 2023 -0800
description:
Fixed include directories order.

Previously, when the previous version of njs.h is installed, an outdated
version of njs.h might be included causing build failures.

The fix is to ensure that the local include directories are included
first.

diffstat:

 auto/make |  27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diffs (86 lines):

diff -r eab7fa4b82b6 -r d0f7f3c071ad auto/make
--- a/auto/make	Tue Nov 07 15:35:25 2023 -0800
+++ b/auto/make	Tue Nov 07 15:35:35 2023 -0800
@@ -53,6 +53,7 @@ NJS_CC = ${CC}
 NJS_STATIC_LINK = ${AR} -r -c
 NJS_LINK = ${CC} ${NJS_LD_OPT}
 NJS_CFLAGS = ${NJS_CFLAGS} ${NJS_CC_OPT} ${CFLAGS}
+NJS_LIB_AUX_CFLAGS = ${NJS_LIB_AUX_CFLAGS}
 
 NJS_VER = $(grep NJS_VERSION src/njs.h | sed -e 's#.*"\(.*\)".*#\1#')
 NJS_TYPES_VER = \$(NJS_VER)
@@ -85,8 +86,8 @@ do
     cat << END >> $NJS_MAKEFILE
 
 $NJS_BUILD_DIR/$njs_obj: $njs_src
-	\$(NJS_CC) -c \$(NJS_CFLAGS) $NJS_LIB_AUX_CFLAGS \\
-		\$(NJS_LIB_INCS) \\
+	\$(NJS_CC) -c \$(NJS_LIB_INCS) \$(NJS_CFLAGS) \\
+		\$(NJS_LIB_AUX_CFLAGS) \\
 		-o $NJS_BUILD_DIR/$njs_obj \\
 		$njs_dep_flags \\
 		$njs_src
@@ -105,8 +106,8 @@ cat << END >> $NJS_MAKEFILE
 $NJS_BUILD_DIR/njs: \\
 	$NJS_BUILD_DIR/libnjs.a \\
 	external/njs_shell.c
-	\$(NJS_LINK) -o $NJS_BUILD_DIR/njs \$(NJS_CFLAGS) \\
-		$NJS_LIB_AUX_CFLAGS \$(NJS_LIB_INCS) \\
+	\$(NJS_LINK) -o $NJS_BUILD_DIR/njs \$(NJS_LIB_INCS) \\
+		\$(NJS_CFLAGS) \$(NJS_LIB_AUX_CFLAGS)\\
 		external/njs_shell.c \\
 		$NJS_BUILD_DIR/libnjs.a \\
 		$NJS_LD_OPT -lm $NJS_LIBS $NJS_LIB_AUX_LIBS $NJS_READLINE_LIB
@@ -119,8 +120,8 @@ cat << END >> $NJS_MAKEFILE
 
 $NJS_BUILD_DIR/njs_process_script_fuzzer.o: \\
 	external/njs_shell.c
-	\$(NJS_CC) -c \$(CFLAGS) $NJS_LIB_AUX_CFLAGS \\
-		\$(NJS_LIB_INCS) \\
+	\$(NJS_CC) -c \$(NJS_LIB_INCS) \$(CFLAGS) \\
+		\$(NJS_LIB_AUX_CFLAGS) \\
 		-DNJS_FUZZER_TARGET \\
 		-o $NJS_BUILD_DIR/njs_process_script_fuzzer.o \\
 		external/njs_shell.c
@@ -129,7 +130,7 @@ cat << END >> $NJS_MAKEFILE
 	$NJS_BUILD_DIR/libnjs.a \\
 	$NJS_BUILD_DIR/njs_process_script_fuzzer.o
 	\$(CXX) \$(CXXFLAGS) -o $NJS_BUILD_DIR/njs_process_script_fuzzer \\
-		$NJS_LIB_AUX_CFLAGS \$(NJS_LIB_INCS) \\
+		\$(NJS_LIB_AUX_CFLAGS) \\
 		\$(LIB_FUZZING_ENGINE) \\
 		$NJS_BUILD_DIR/njs_process_script_fuzzer.o \\
 		$NJS_BUILD_DIR/libnjs.a \\
@@ -150,8 +151,8 @@ do
 
 $NJS_BUILD_DIR/$njs_bin: $njs_src \\
 	$NJS_BUILD_DIR/libnjs.a
-	\$(NJS_LINK) -o $NJS_BUILD_DIR/$njs_bin \$(NJS_CFLAGS) \\
-		\$(NJS_LIB_INCS) $njs_dep_flags \\
+	\$(NJS_LINK) -o $NJS_BUILD_DIR/$njs_bin \$(NJS_LIB_INCS) \\
+		\$(NJS_CFLAGS) $njs_dep_flags \\
 		$njs_src $NJS_BUILD_DIR/libnjs.a \\
 		$njs_dep_post -lm $NJS_LD_OPT
 
@@ -175,8 +176,8 @@ cat << END >> $NJS_MAKEFILE
 
 $NJS_BUILD_DIR/$njs_externals_obj: \\
     $njs_src
-	\$(NJS_CC) -c \$(NJS_CFLAGS) $NJS_LIB_AUX_CFLAGS \\
-		\$(NJS_LIB_INCS) \\
+	\$(NJS_CC) -c \$(NJS_LIB_INCS) \$(NJS_CFLAGS) \\
+		\$(NJS_LIB_AUX_CFLAGS) \\
 		-o $NJS_BUILD_DIR/$njs_externals_obj \\
 		$njs_dep_flags \\
 		$njs_src
@@ -198,8 +199,8 @@ do
 $NJS_BUILD_DIR/$njs_bin: $njs_src \\
 	$NJS_BUILD_DIR/libnjs.a \\
 	$NJS_BUILD_DIR/$njs_externals_obj
-	\$(NJS_LINK) -o $NJS_BUILD_DIR/$njs_bin \$(NJS_CFLAGS) \\
-		$NJS_LIB_AUX_CFLAGS \$(NJS_LIB_INCS) \\
+	\$(NJS_LINK) -o $NJS_BUILD_DIR/$njs_bin \$(NJS_LIB_INCS) \\
+		\$(NJS_CFLAGS) \$(NJS_LIB_AUX_CFLAGS) \\
 		$njs_dep_flags \\
 		$NJS_BUILD_DIR/$njs_externals_obj \\
 		$njs_src $NJS_BUILD_DIR/libnjs.a \\


More information about the nginx-devel mailing list