summaryrefslogtreecommitdiffhomepage
path: root/auto/modules/skel
diff options
context:
space:
mode:
Diffstat (limited to 'auto/modules/skel')
-rw-r--r--auto/modules/skel100
1 files changed, 100 insertions, 0 deletions
diff --git a/auto/modules/skel b/auto/modules/skel
new file mode 100644
index 00000000..386b61fa
--- /dev/null
+++ b/auto/modules/skel
@@ -0,0 +1,100 @@
+# Copyright (C) NGINX, Inc.
+
+
+shift
+
+if [ ! -f $NXT_AUTOCONF_DATA ]; then
+ echo
+ echo Please run common $0 before configuring module \"$nxt_module\".
+ echo
+ exit 1
+fi
+
+. $NXT_AUTOCONF_DATA
+
+$echo "configuring SKEL module"
+$echo "configuring SKEL module ..." >> $NXT_AUTOCONF_ERR
+
+NXT_SKEL=skel
+NXT_SKEL_MODULE=${NXT_SKEL_MODULE=${NXT_SKEL##*/}}
+
+NXT_SKEL_LDFLAGS=
+NXT_SKEL_ADDITIONAL_FLAGS=
+
+if grep ^$NXT_SKEL_MODULE: $NXT_MAKEFILE 2>&1 > /dev/null; then
+ $echo
+ $echo $0: error: duplicate \"$NXT_SKEL_MODULE\" module configured.
+ $echo
+ exit 1;
+fi
+
+$echo " + SKEL module: ${NXT_SKEL_MODULE}.unit.so"
+
+. auto/cc/deps
+
+$echo >> $NXT_MAKEFILE
+
+NXT_SKEL_MODULE_SRCS=" \
+ src/skel/nxt_skel.c \
+"
+
+# The skel module object files.
+
+nxt_objs=$NXT_BUILD_DIR/src/nxt_unit.o
+
+for nxt_src in $NXT_SKEL_MODULE_SRCS; do
+
+ nxt_obj=${nxt_src%.c}-$NXT_SKEL_MODULE.o
+ nxt_dep=${nxt_src%.c}-$NXT_SKEL_MODULE.dep
+ nxt_dep_flags=`nxt_gen_dep_flags`
+ nxt_dep_post=`nxt_gen_dep_post`
+ nxt_objs="$nxt_objs $NXT_BUILD_DIR/$nxt_obj"
+
+ cat << END >> $NXT_MAKEFILE
+
+$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
+ \$(v)mkdir -p $NXT_BUILD_DIR/src/skel
+ \$(PP_CC) \$@
+ \$(v)\$(CC) -c \$(CFLAGS) $NXT_SKEL_ADDITIONAL_FLAGS \$(NXT_INCS) \\
+ $nxt_dep_flags \\
+ -o $NXT_BUILD_DIR/$nxt_obj $nxt_src
+ $nxt_dep_post
+
+-include $NXT_BUILD_DIR/$nxt_dep
+
+END
+
+done
+
+
+cat << END >> $NXT_MAKEFILE
+
+.PHONY: ${NXT_SKEL_MODULE}
+.PHONY: ${NXT_SKEL_MODULE}-install
+.PHONY: ${NXT_SKEL_MODULE}-uninstall
+
+all: ${NXT_SKEL_MODULE}
+
+${NXT_SKEL_MODULE}: $NXT_BUILD_DIR/lib/unit/modules/${NXT_SKEL_MODULE}.unit.so
+
+$NXT_BUILD_DIR/lib/unit/modules/${NXT_SKEL_MODULE}.unit.so: $nxt_objs
+ \$(PP_LD) \$@
+ \$(v)\$(NXT_MODULE_LINK) -o \$@ \\
+ $nxt_objs ${NXT_SKEL_LDFLAGS} $NXT_LD_OPT
+
+
+install: ${NXT_SKEL_MODULE}-install
+
+${NXT_SKEL_MODULE}-install: ${NXT_SKEL_MODULE} install-check
+ install -d \$(DESTDIR)$NXT_MODULESDIR
+ install -p $NXT_BUILD_DIR/lib/unit/modules/${NXT_SKEL_MODULE}.unit.so \\
+ \$(DESTDIR)$NXT_MODULESDIR/
+
+
+uninstall: ${NXT_SKEL_MODULE}-uninstall
+
+${NXT_SKEL_MODULE}-uninstall:
+ rm -f \$(DESTDIR)$NXT_MODULESDIR/${NXT_SKEL_MODULE}.unit.so
+ @rmdir -p \$(DESTDIR)$NXT_MODULESDIR 2>/dev/null || true
+
+END