Welcome! Log In Create A New Profile

Advanced

[njs] Configure: generating $NJS_LIB_OBJS using sed.

Dmitry Volyntsev
October 29, 2020 09:00AM
details: https://hg.nginx.org/njs/rev/19d2a8d68e3a
branches:
changeset: 1547:19d2a8d68e3a
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Thu Oct 29 12:46:19 2020 +0000
description:
Configure: generating $NJS_LIB_OBJS using sed.

diffstat:

auto/init | 36 ++++++++++++++++++++++++++++++++++++
auto/make | 36 ++++--------------------------------
configure | 32 +-------------------------------
3 files changed, 41 insertions(+), 63 deletions(-)

diffs (146 lines):

diff -r 3d8f6b9548c0 -r 19d2a8d68e3a auto/init
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/auto/init Thu Oct 29 12:46:19 2020 +0000
@@ -0,0 +1,36 @@
+
+# Copyright (C) Dmitry Volyntsev
+# Copyright (C) NGINX, Inc.
+
+# Initialize variables with null values if they are not defined.
+CFLAGS=${CFLAGS=}
+NJS_TEST_CFLAGS=${NJS_TEST_CFLAGS=}
+NJS_TEST_LIBS=${NJS_TEST_LIBS=}
+
+
+# Initialize variables with default if they are not defined.
+CC=${CC:-cc}
+AR=${AR:-ar}
+NJS_CFLAGS=${NJS_CFLAGS=}
+
+NJS_BUILD_DIR=${NJS_BUILD_DIR:-build}
+
+NJS_AUTOTEST=$NJS_BUILD_DIR/autotest
+NJS_AUTOCONF_ERR=$NJS_BUILD_DIR/autoconf.err
+NJS_AUTO_CONFIG_H=$NJS_BUILD_DIR/njs_auto_config.h
+NJS_MAKEFILE=$NJS_BUILD_DIR/Makefile
+
+test -d $NJS_BUILD_DIR || mkdir $NJS_BUILD_DIR
+
+> $NJS_AUTOCONF_ERR
+
+cat << END > $NJS_AUTO_CONFIG_H
+
+/* This file is auto-generated by configure */
+
+END
+
+NJS_LIBRT=
+
+njs_regex_cont=' \\\
+ '
diff -r 3d8f6b9548c0 -r 19d2a8d68e3a auto/make
--- a/auto/make Mon Oct 19 21:42:01 2020 +0200
+++ b/auto/make Thu Oct 29 12:46:19 2020 +0000
@@ -9,6 +9,8 @@ echo "creating $NJS_MAKEFILE"
mkdir -p $NJS_BUILD_DIR/src
mkdir -p $NJS_BUILD_DIR/test

+njs_objs=`echo $NJS_LIB_SRCS \
+ | sed -e "s# *\([^ ]*\.\)c#$NJS_BUILD_DIR/\1o$njs_regex_cont#g"`

cat << END > $NJS_MAKEFILE

@@ -20,38 +22,10 @@ NJS_LINK = ${CC} ${NJS_LD_OPT}
NJS_CFLAGS = ${NJS_CFLAGS} ${NJS_CC_OPT} ${CFLAGS}

default: $NJS_DEFAULT_TARGET
-END
-
-
-# The include paths list.
-
-printf "NJS_LIB_INCS =" >> $NJS_MAKEFILE
-
-for njs_inc in src $NJS_BUILD_DIR
-do
- printf " -I$njs_inc" >> $NJS_MAKEFILE
-done
-
-echo >> $NJS_MAKEFILE
-echo >> $NJS_MAKEFILE
-

-# The njs object files list.
-
-echo "NJS_LIB_OBJS = \\" >> $NJS_MAKEFILE
+NJS_LIB_INCS = -Isrc -I$NJS_BUILD_DIR

-for njs_src in $NJS_LIB_SRCS
-do
- fname=$(basename $njs_src)
- njs_obj="src/${fname%.c}.o"
- echo " $NJS_BUILD_DIR/$njs_obj \\" >> $NJS_MAKEFILE
-done
-
-echo >> $NJS_MAKEFILE
-
-# The njs static library.
-
-cat << END >> $NJS_MAKEFILE
+NJS_LIB_OBJS = $njs_objs

libnjs: $NJS_BUILD_DIR/libnjs.a

@@ -61,10 +35,8 @@ libnjs: $NJS_BUILD_DIR/libnjs.a

\$(NJS_STATIC_LINK) $NJS_BUILD_DIR/libnjs.a \\
\$(NJS_LIB_OBJS)
-
END

-
# object files.

for njs_src in $NJS_LIB_SRCS
diff -r 3d8f6b9548c0 -r 19d2a8d68e3a configure
--- a/configure Mon Oct 19 21:42:01 2020 +0200
+++ b/configure Thu Oct 29 12:46:19 2020 +0000
@@ -13,37 +13,7 @@ set -e
# Stop on uninitialized variable.
set -u

-
-# Initialize variables with null values if they are not defined.
-CFLAGS=${CFLAGS=}
-NJS_TEST_CFLAGS=${NJS_TEST_CFLAGS=}
-NJS_TEST_LIBS=${NJS_TEST_LIBS=}
-
-
-# Initialize variables with default if they are not defined.
-CC=${CC:-cc}
-AR=${AR:-ar}
-NJS_CFLAGS=${NJS_CFLAGS=}
-
-NJS_BUILD_DIR=${NJS_BUILD_DIR:-build}
-
-NJS_AUTOTEST=$NJS_BUILD_DIR/autotest
-NJS_AUTOCONF_ERR=$NJS_BUILD_DIR/autoconf.err
-NJS_AUTO_CONFIG_H=$NJS_BUILD_DIR/njs_auto_config.h
-NJS_MAKEFILE=$NJS_BUILD_DIR/Makefile
-
-test -d $NJS_BUILD_DIR || mkdir $NJS_BUILD_DIR
-
-> $NJS_AUTOCONF_ERR
-
-cat << END > $NJS_AUTO_CONFIG_H
-
-/* This file is auto-generated by configure */
-
-END
-
-NJS_LIBRT=
-
+. auto/init
. auto/os
. auto/options
. auto/cc
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Configure: generating $NJS_LIB_OBJS using sed.

Dmitry Volyntsev 113 October 29, 2020 09:00AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 68
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready