echo "#line 1" >> __tmpsrcf.c
cat "${2}" >> __tmpsrcf.c
CMD="CRTCMOD MODULE(${TARGETLIB}/${1}) SRCSTMF('__tmpsrcf.c')"
-# CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)"
- CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST)"
+ CMD="${CMD} SYSIFCOPT(*IFS64IO *ASYNCSIGNAL)"
+# CMD="${CMD} OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)"
+ CMD="${CMD} OPTION(*INCDIRFIRST)"
CMD="${CMD} LOCALETYPE(*LOCALE) FLAG(10)"
CMD="${CMD} INCDIR('${QADRTDIR}/include'"
CMD="${CMD} '${TOPDIR}/include/curl' '${TOPDIR}/include' '${SRCDIR}'"
# The `sed' statement works as follows:
# - Join \nl-separated lines.
# - Retain only lines that begins with "identifier =".
+# - Replace @...@ sustitutions by shell variable references.
# - Turn these lines into shell variable assignments.
get_make_vars()
-e 'b begin' \
-e '}' \
-e '/^[A-Za-z_][A-Za-z0-9_]*[[:space:]]*=/!d' \
+ -e 's/@\\([A-Za-z0-9_]*\\)@/${\\1}/g' \
-e 's/[[:space:]]*=[[:space:]]*/=/' \
-e 's/=\\(.*[^[:space:]]\\)[[:space:]]*$/=\\"\\1\\"/' \
-e 's/\\\$(\\([^)]*\\))/\${\\1}/g' \
cd "${TOPDIR}/tests"
-# tests directory not implemented yet.
+# Build programs in a directory.
+build_all_programs()
-# Process the libtest subdirectory.
+{
+ # Compile all programs.
+ # The list is found in variable "noinst_PROGRAMS"
-cd libtest
+ INCLUDES="'`pwd`' '${TOPDIR}/lib' '${TOPDIR}/src'"
+ MODS="${1}"
+ SRVPGMS="${2}"
-# Get definitions from the Makefile.inc file.
+ for PGM in ${noinst_PROGRAMS}
+ do DB2PGM=`db2_name "${PGM}"`
+ PGMIFSNAME="${LIBIFSNAME}/${DB2PGM}.PGM"
-get_make_vars Makefile.inc
+ # Extract preprocessor symbol definitions from
+ # compilation options for the program.
-# Special case: redefine chkhostname compilation parameters.
+ PGMCFLAGS="`eval echo \"\\${${PGM}_CFLAGS}\"`"
+ PGMDFNS=
-chkhostname_SOURCES=chkhostname.c
-chkhostname_LDADD=curl_gethostname.o
+ for FLAG in ${PGMCFLAGS}
+ do case "${FLAG}" in
+ -D?*) DEFINE="`echo \"${FLAG}\" | sed 's/^..//'`"
+ PGMDFNS="${PGMDFNS} '${DEFINE}'"
+ ;;
+ esac
+ done
-# Compile all programs.
-# The list is found in variable "noinst_PROGRAMS"
+ # Compile all C sources for the program into modules.
+
+ PGMSOURCES="`eval echo \"\\${${PGM}_SOURCES}\"`"
+ LINK=
+ MODULES=
+
+ for SOURCE in ${PGMSOURCES}
+ do case "${SOURCE}" in
+ *.c) # Special processing for libxxx.c files:
+ # their module name is determined
+ # by the target PROGRAM name.
+
+ case "${SOURCE}" in
+ lib*.c) MODULE="${DB2PGM}"
+ ;;
+ *) MODULE=`db2_name "${SOURCE}"`
+ ;;
+ esac
+
+ # If source is in a sibling directory,
+ # prefix module name with 'X'.
+
+ case "${SOURCE}" in
+ ../*) MODULE=`db2_name "X${MODULE}"`
+ ;;
+ esac
+
+ make_module "${MODULE}" "${SOURCE}" "${PGMDFNS}"
+ if action_needed "${PGMIFSNAME}" "${MODIFSNAME}"
+ then LINK=yes
+ fi
+ ;;
+ esac
+ done
-INCLUDES="'${TOPDIR}/tests/libtest' '${TOPDIR}/lib'"
+ # Link program if needed.
+
+ if [ "${LINK}" ]
+ then PGMLDADD="`eval echo \"\\${${PGM}_LDADD}\"`"
+ for ARG in ${PGMLDADD}
+ do case "${ARG}" in
+ -*) ;; # Ignore non-module.
+ *) MODULES="${MODULES} "`db2_name "${ARG}"`
+ ;;
+ esac
+ done
+ MODULES="`echo \"${MODULES}\" |
+ sed \"s/[^ ][^ ]*/${TARGETLIB}\/&/g\"`"
+ CMD="CRTPGM PGM(${TARGETLIB}/${DB2PGM})"
+ CMD="${CMD} ENTMOD(${TARGETLIB}/CURLMAIN)"
+ CMD="${CMD} MODULE(${MODULES} ${MODS})"
+ CMD="${CMD} BNDSRVPGM(${SRVPGMS} QADRTTS)"
+ CMD="${CMD} TGTRLS(${TGTRLS})"
+ CLcommand "${CMD}"
+ fi
+ done
+}
-for PGM in ${noinst_PROGRAMS}
-do DB2PGM=`db2_name "${PGM}"`
- PGMIFSNAME="${LIBIFSNAME}/${DB2PGM}.PGM"
- # Extract preprocessor symbol definitions from compilation
- # options for the program.
+# Build programs in the server directory.
- PGMCFLAGS="`eval echo \"\\${${PGM}_CFLAGS}\"`"
- PGMDEFINES=
+(
+ cd server
+ get_make_vars Makefile.inc
+ build_all_programs "${TARGETLIB}/OS400SYS"
+)
- for FLAG in ${PGMCFLAGS}
- do case "${FLAG}" in
- -D?*) DEFINE="`echo \"${FLAG}\" | sed 's/^..//'`"
- PGMDEFINES="${PGMDEFINES} '${DEFINE}'"
- ;;
- esac
- done
- # Compile all C sources for the program into modules.
+# Build all programs in the libtest subdirectory.
- PGMSOURCES="`eval echo \"\\${${PGM}_SOURCES}\"`"
- LINK=
- MODULES=
+(
+ cd libtest
+ get_make_vars Makefile.inc
- for SOURCE in ${PGMSOURCES}
- do case "${SOURCE}" in
- *.c) # Special processing for libxxx.c files: their
- # module name is determined by the target
- # PROGRAM name.
+ # Special case: redefine chkhostname compilation parameters.
- case "${SOURCE}" in
- lib*.c) MODULE="${DB2PGM}"
- ;;
- *) MODULE=`db2_name "${SOURCE}"`
- ;;
- esac
-
- make_module "${MODULE}" "${SOURCE}" "${PGMDEFINES}"
- if action_needed "${PGMIFSNAME}" "${MODIFSNAME}"
- then LINK=yes
- fi
- ;;
- esac
- done
+ chkhostname_SOURCES=chkhostname.c
+ chkhostname_LDADD=curl_gethostname.o
- # Link program if needed.
-
- if [ "${LINK}" ]
- then PGMLDADD="`eval echo \"\\${${PGM}_LDADD}\"`"
- for LDARG in ${PGMLDADD}
- do case "${LDARG}" in
- -*) ;; # Ignore non-module.
- *) MODULES="${MODULES} "`db2_name "${LDARG}"`
- ;;
- esac
- done
- MODULES="`echo \"${MODULES}\" |
- sed \"s/[^ ][^ ]*/${TARGETLIB}\/&/g\"`"
- CMD="CRTPGM PGM(${TARGETLIB}/${DB2PGM})"
- CMD="${CMD} ENTMOD(${TARGETLIB}/CURLMAIN)"
- CMD="${CMD} MODULE(${MODULES})"
- CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)"
- CMD="${CMD} TGTRLS(${TGTRLS})"
- CLcommand "${CMD}"
- fi
-done
+ build_all_programs "" "${TARGETLIB}/${SRVPGM}"
+)