3 # tests compilation script for the OS/400.
5 # $Id: make-tests.sh,v 1.1 2008-09-23 16:32:05 hoffman Exp $
8 SCRIPTDIR
=`dirname "${0}"`
9 .
"${SCRIPTDIR}/initscript.sh"
13 # tests directory not implemented yet.
16 # Process the libtest subdirectory.
20 # Get definitions from the Makefile.am file.
21 # The `sed' statement works as follows:
22 # _ Join \nl-separated lines.
23 # _ Retain only lines that begins with "identifier =".
24 # _ Turn these lines into shell variable assignments.
26 eval "`sed -e ': begin' \
32 -e '/^[A-Za-z_][A-Za-z0-9_]*[ ]*[=]/b keep' \
36 -e 's/=\\(.*[^ ]\\)[ ]*$/=\\"\\1\\"/' \
37 -e 's/\\$(\\([^)]*\\))/${\\1}/g' \
40 # Compile all programs.
41 # The list is found in variable "noinst_PROGRAMS"
43 INCLUDES
="'${TOPDIR}/tests/libtest' '${TOPDIR}/lib'"
45 for PGM
in ${noinst_PROGRAMS}
46 do DB2PGM
=`db2_name "${PGM}"`
47 PGMIFSNAME
="${LIBIFSNAME}/${DB2PGM}.PGM"
49 # Extract preprocessor symbol definitions from compilation
50 # options for the program.
52 PGMCFLAGS
="`eval echo \"\\${${PGM}_CFLAGS}\"`"
55 for FLAG
in ${PGMCFLAGS}
57 -D?
*) DEFINE
="`echo \"${FLAG}\" | sed 's/^..//'`"
58 PGMDEFINES
="${PGMDEFINES} '${DEFINE}'"
63 # Compile all C sources for the program into modules.
65 PGMSOURCES
="`eval echo \"\\${${PGM}_SOURCES}\"`"
69 for SOURCE
in ${PGMSOURCES}
70 do case "${SOURCE}" in
71 *.c
) # Special processing for libxxx.c files: their
72 # module name is determined by the target
76 lib
*.c
) MODULE
="${DB2PGM}"
78 *) MODULE
=`db2_name "${SOURCE}"`
82 make_module
"${MODULE}" "${SOURCE}" "${PGMDEFINES}"
83 if action_needed
"${PGMIFSNAME}" "${MODIFSNAME}"
90 # Link program if needed.
93 then MODULES
="`echo \"${MODULES}\" |
94 sed \"s/[^ ][^ ]*/${TARGETLIB}\/&/g\"`"
95 CMD
="CRTPGM PGM(${TARGETLIB}/${DB2PGM})"
96 CMD
="${CMD} ENTMOD(QADRT/QADRTMAIN2)"
97 CMD
="${CMD} MODULE(${MODULES})"
98 CMD
="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)"
99 CMD
="${CMD} TGTRLS(${TGTRLS})"