Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions auto/help
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ default: "$NJS_ADDRESS_SANITIZER"
--cc=FILE sets C compiler filename, default: "$CC"
--cc-opt=OPTIONS sets additional C compiler options, \
default: "$NJS_CC_OPT"
--pic=OPTION sets position independent code flag, \
default: "$NJS_PIC"
--debug=YES enables additional runtime checks, \
default: "$NJS_DEBUG"
--debug-memory=YES enables memory alloc debug, \
Expand Down
15 changes: 8 additions & 7 deletions auto/make
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ cat << END > $NJS_MAKEFILE
NJS_CC = ${CC}
NJS_STATIC_LINK = ${AR} -r -c
NJS_LINK = ${CC} ${NJS_LD_OPT}
NJS_CFLAGS = ${NJS_CFLAGS} ${NJS_CC_OPT} ${CFLAGS}
NJS_PIC = ${NJS_PIC}
CFLAGS = ${NJS_CC_OPT} ${CFLAGS:-${NJS_CFLAGS}}
NJS_LIB_AUX_CFLAGS = ${NJS_LIB_AUX_CFLAGS}

NJS_VER = $(grep NJS_VERSION src/njs.h | sed -e 's#.*"\(.*\)".*#\1#')
Expand Down Expand Up @@ -132,7 +133,7 @@ do
cat << END >> $NJS_MAKEFILE

$NJS_BUILD_DIR/$njs_obj: $njs_src
\$(NJS_CC) -c \$(NJS_LIB_INCS) \$(NJS_CFLAGS) \\
\$(NJS_CC) -c \$(NJS_LIB_INCS) \$(NJS_PIC) \$(CFLAGS) \\
\$(NJS_LIB_AUX_CFLAGS) \\
-o $NJS_BUILD_DIR/$njs_obj \\
$njs_dep_flags \\
Expand All @@ -154,7 +155,7 @@ do
cat << END >> $NJS_MAKEFILE

$NJS_BUILD_DIR/$njs_obj: $njs_src
\$(NJS_CC) -c \$(NJS_LIB_INCS) \$(NJS_CFLAGS) \\
\$(NJS_CC) -c \$(NJS_LIB_INCS) \$(NJS_PIC) \$(CFLAGS) \\
\$(NJS_LIB_AUX_CFLAGS) \\
-o $NJS_BUILD_DIR/$njs_obj \\
$njs_dep_flags \\
Expand All @@ -175,7 +176,7 @@ $NJS_BUILD_DIR/njs: \\
$NJS_BUILD_DIR/libnjs.a $QJS_LIB \\
external/njs_shell.c
\$(NJS_LINK) -o $NJS_BUILD_DIR/njs \$(NJS_LIB_INCS) \\
\$(NJS_CFLAGS) \$(NJS_LIB_AUX_CFLAGS)\\
\$(CFLAGS) \$(NJS_LIB_AUX_CFLAGS)\\
external/njs_shell.c \\
$NJS_BUILD_DIR/libnjs.a $QJS_LIB \\
$NJS_LD_OPT -lm $NJS_LIBS $NJS_LIB_AUX_LIBS $NJS_READLINE_LIB
Expand Down Expand Up @@ -220,7 +221,7 @@ do
$NJS_BUILD_DIR/$njs_bin: $njs_src \\
$NJS_BUILD_DIR/libnjs.a
\$(NJS_LINK) -o $NJS_BUILD_DIR/$njs_bin \$(NJS_LIB_INCS) \\
\$(NJS_CFLAGS) $njs_dep_flags \\
\$(CFLAGS) $njs_dep_flags \\
$njs_src $NJS_BUILD_DIR/libnjs.a \\
$njs_dep_post -lm $NJS_LD_OPT

Expand All @@ -244,7 +245,7 @@ cat << END >> $NJS_MAKEFILE

$NJS_BUILD_DIR/$njs_externals_obj: \\
$njs_src
\$(NJS_CC) -c \$(NJS_LIB_INCS) \$(NJS_CFLAGS) \\
\$(NJS_CC) -c \$(NJS_LIB_INCS) \$(CFLAGS) \\
\$(NJS_LIB_AUX_CFLAGS) \\
-o $NJS_BUILD_DIR/$njs_externals_obj \\
$njs_dep_flags \\
Expand All @@ -268,7 +269,7 @@ $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_LIB_INCS) \\
\$(NJS_CFLAGS) \$(NJS_LIB_AUX_CFLAGS) \\
\$(CFLAGS) \$(NJS_LIB_AUX_CFLAGS) \\
$njs_dep_flags \\
$NJS_BUILD_DIR/$njs_externals_obj \\
$njs_src $NJS_BUILD_DIR/libnjs.a \\
Expand Down
7 changes: 5 additions & 2 deletions auto/options
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# Copyright (C) NGINX, Inc.


NJS_CC_OPT=${NJS_CC_OPT:--O}
NJS_LD_OPT=${NJS_CC_OPT:--O}
NJS_CC_OPT=
NJS_LD_OPT=
NJS_PIC=-fPIC

NJS_DEBUG=NO
NJS_DEBUG_MEMORY=NO
Expand Down Expand Up @@ -40,6 +41,8 @@ do
--ld-opt=*) NJS_LD_OPT="$value" ;;
--ar=*) AR="$value" ;;

--pic=*) NJS_PIC="$value" ;;

--build-dir=*) NJS_BUILD_DIR="$value" ;;

--address-sanitizer=*) NJS_ADDRESS_SANITIZER="$value" ;;
Expand Down
2 changes: 1 addition & 1 deletion auto/summary
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ echo
echo "NJS configuration summary:"
echo
echo " + using CC: \"$CC\""
echo " + using CFLAGS: \"$NJS_CFLAGS $NJS_CC_OPT $CFLAGS\""
echo " + using CFLAGS: \"$NJS_CC_OPT ${CFLAGS:-$NJS_CFLAGS}\""
echo

if [ $NJS_HAVE_PCRE = YES ]; then
Expand Down