CUR_DIR=`pwd`
C_FILE="$CUR_DIR/modules_init.c"
H_FILE="$CUR_DIR/modules_init.h"
+MOD_FILE="$CUR_DIR/Make_modules"
+SRC_FILE="$CUR_DIR/Make_sources"
+
/usr/bin/printf "Scanning extension modules for entry points.\n"
-/usr/bin/printf "This version of echo $ECHO supports $MINUS_e $MINUS_E.\n"
#start of the files which inturn removes any existing file
#
+
+# start the Makefile included file for $SERV_MODULES
+cat <<EOF >$MOD_FILE
+#
+# Make_modules
+# This file is to be included by Makefile to dynamically add modules to the build process
+# THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE
+#
+
+EOF
+
+# start the Makefile included file for $SOURCES
+cat <<EOF >$SRC_FILE
+#
+# Make_sources
+# This file is to be included by Makefile to dynamically add modules to the build process
+# THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE
+#
+
+EOF
+
+# start the c file
cat <<EOF >$C_FILE
/*
* $C_FILE
for k in *.c
do
if [ -f "$k" ] ; then
+# Add this .c file to the Makefile included list of SOURCES
+cat <<EOF >> $SRC_FILE
+SOURCES += modules/$j/$k
+EOF
+
+# Generate a .o file name
+O_FILE=`basename $k .c`
+O_FILE="$O_FILE.o"
+# Add this .o file to the Makefile included list of SERV_MODULES
+cat <<EOF >> $MOD_FILE
+SERV_MODULES += modules/$j/$O_FILE
+EOF
+
RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
if [ $RES != "X" ] ; then
RES_OUT=`echo $RES | cut -b2-`
/usr/bin/printf "Found entry point in file modules/$j/$k\n"
+# Add this entry point to the .c file
cat <<EOF >> $C_FILE
lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
EOF
+# Add this entry point to the .h file
cat <<EOF >> $H_FILE
CTDL_MODULE_INIT($RES_OUT);
EOF
for k in *.c
do
if [ -f "$k" ] ; then
+# Add this .c file to the Makefile included list of SOURCES
+cat <<EOF >> $SRC_FILE
+SOURCES=\$(SOURCES) $k
+EOF
RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
if [ $RES != "X" ] ; then
RES_OUT=`echo $RES | cut -b2-`