]> code.citadel.org Git - citadel.git/blobdiff - citadel/mk_module_init.sh
Added a simple comment to include/ctdl_module.h
[citadel.git] / citadel / mk_module_init.sh
index 8db772c68982f188f51afbe560a5ec6a8370a011..49c0f47dd6c4e93b1e47510a5f15c69dc6bcad56 100755 (executable)
@@ -23,13 +23,37 @@ ECHO=/usr/bin/printf
 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
@@ -106,13 +130,28 @@ if [ -d "modules" ] ; then
                        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
@@ -135,6 +174,10 @@ if [ -d "user_modules" ] ; then
                        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-`