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 # Compile all programs.
40 # The list is found in variable "noinst_PROGRAMS"
42 INCLUDES="'${TOPDIR}/tests/libtest' '${TOPDIR}/lib'"
44 for PGM in ${noinst_PROGRAMS}
45 do DB2PGM=`db2_name "${PGM}"`
46 PGMIFSNAME="${LIBIFSNAME}/${DB2PGM}.PGM"
48 # Extract preprocessor symbol definitions from compilation
49 # options for the program.
51 PGMCFLAGS="`eval echo \"\\${${PGM}_CFLAGS}\"`"
54 for FLAG in ${PGMCFLAGS}
56 -D?*) DEFINE="`echo \"${FLAG}\" | sed 's/^..//'`"
57 PGMDEFINES="${PGMDEFINES} '${DEFINE}'"
62 # Compile all C sources for the program into modules.
64 PGMSOURCES="`eval echo \"\\${${PGM}_SOURCES}\"`"
68 for SOURCE in ${PGMSOURCES}
69 do case "${SOURCE}" in
70 *.c) # Special processing for libxxx.c files: their
71 # module name is determined by the target
75 lib*.c) MODULE="${DB2PGM}"
77 *) MODULE=`db2_name "${SOURCE}"`
81 make_module "${MODULE}" "${SOURCE}" "${PGMDEFINES}"
82 if action_needed "${PGMIFSNAME}" "${MODIFSNAME}"
89 # Link program if needed.
92 then MODULES="`echo \"${MODULES}\" |
93 sed \"s/[^ ][^ ]*/${TARGETLIB}\/&/g\"`"
94 CMD="CRTPGM PGM(${TARGETLIB}/${DB2PGM})"
95 CMD="${CMD} ENTMOD(QADRT/QADRTMAIN2)"
96 CMD="${CMD} MODULE(${MODULES})"
97 CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)"
98 CMD="${CMD} TGTRLS(${TGTRLS})"