3 # tests compilation script for the OS/400.
7 SCRIPTDIR=`dirname "${0}"`
8 . "${SCRIPTDIR}/initscript.sh"
12 # tests directory not implemented yet.
15 # Process the libtest subdirectory.
19 # Get definitions from the Makefile.inc file.
20 # The `sed' statement works as follows:
21 # _ Join \nl-separated lines.
22 # _ Retain only lines that begins with "identifier =".
23 # _ Turn these lines into shell variable assignments.
25 eval "`sed -e ': begin' \
31 -e '/^[A-Za-z_][A-Za-z0-9_]*[ ]*[=]/b keep' \
35 -e 's/=\\(.*[^ ]\\)[ ]*$/=\\"\\1\\"/' \
36 -e 's/\\$(\\([^)]*\\))/${\\1}/g' \
39 # Special case: redefine chkhostname compilation parameters.
41 chkhostname_SOURCES=chkhostname.c
42 chkhostname_LDADD=curl_gethostname.o
44 # Compile all programs.
45 # The list is found in variable "noinst_PROGRAMS"
47 INCLUDES="'${TOPDIR}/tests/libtest' '${TOPDIR}/lib'"
49 for PGM in ${noinst_PROGRAMS}
50 do DB2PGM=`db2_name "${PGM}"`
51 PGMIFSNAME="${LIBIFSNAME}/${DB2PGM}.PGM"
53 # Extract preprocessor symbol definitions from compilation
54 # options for the program.
56 PGMCFLAGS="`eval echo \"\\${${PGM}_CFLAGS}\"`"
59 for FLAG in ${PGMCFLAGS}
61 -D?*) DEFINE="`echo \"${FLAG}\" | sed 's/^..//'`"
62 PGMDEFINES="${PGMDEFINES} '${DEFINE}'"
67 # Compile all C sources for the program into modules.
69 PGMSOURCES="`eval echo \"\\${${PGM}_SOURCES}\"`"
73 for SOURCE in ${PGMSOURCES}
74 do case "${SOURCE}" in
75 *.c) # Special processing for libxxx.c files: their
76 # module name is determined by the target
80 lib*.c) MODULE="${DB2PGM}"
82 *) MODULE=`db2_name "${SOURCE}"`
86 make_module "${MODULE}" "${SOURCE}" "${PGMDEFINES}"
87 if action_needed "${PGMIFSNAME}" "${MODIFSNAME}"
94 # Link program if needed.
97 then PGMLDADD="`eval echo \"\\${${PGM}_LDADD}\"`"
98 for LDARG in ${PGMLDADD}
100 -*) ;; # Ignore non-module.
101 *) MODULES="${MODULES} "`db2_name "${LDARG}"`
105 MODULES="`echo \"${MODULES}\" |
106 sed \"s/[^ ][^ ]*/${TARGETLIB}\/&/g\"`"
107 CMD="CRTPGM PGM(${TARGETLIB}/${DB2PGM})"
108 CMD="${CMD} ENTMOD(QADRT/QADRTMAIN2)"
109 CMD="${CMD} MODULE(${MODULES})"
110 CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)"
111 CMD="${CMD} TGTRLS(${TGTRLS})"