ENH: fix bug where sharedforward would not work if there was a space in the path...
[cmake.git] / Utilities / cmcurl-7.19.0 / packages / OS400 / make-tests.sh
blob5e3e9cb64e7357d8b56a62e7ed29db2862ea03df
1 #!/bin/sh
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"
10 cd "${TOPDIR}/tests"
13 # tests directory not implemented yet.
16 # Process the libtest subdirectory.
18 cd libtest
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' \
27 -e '/\\\\$/{' \
28 -e 'N' \
29 -e 's/\\\\\\n/ /' \
30 -e 'b begin' \
31 -e '}' \
32 -e '/^[A-Za-z_][A-Za-z0-9_]*[ ]*[=]/b keep' \
33 -e 'd' \
34 -e ': keep' \
35 -e 's/[ ]*=[ ]*/=/' \
36 -e 's/=\\(.*[^ ]\\)[ ]*$/=\\"\\1\\"/' \
37 -e 's/\\$(\\([^)]*\\))/${\\1}/g' \
38 < Makefile.am`"
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}\"`"
53 PGMDEFINES=
55 for FLAG in ${PGMCFLAGS}
56 do case "${FLAG}" in
57 -D?*) DEFINE="`echo \"${FLAG}\" | sed 's/^..//'`"
58 PGMDEFINES="${PGMDEFINES} '${DEFINE}'"
60 esac
61 done
63 # Compile all C sources for the program into modules.
65 PGMSOURCES="`eval echo \"\\${${PGM}_SOURCES}\"`"
66 LINK=
67 MODULES=
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
73 # PROGRAM name.
75 case "${SOURCE}" in
76 lib*.c) MODULE="${DB2PGM}"
78 *) MODULE=`db2_name "${SOURCE}"`
80 esac
82 make_module "${MODULE}" "${SOURCE}" "${PGMDEFINES}"
83 if action_needed "${PGMIFSNAME}" "${MODIFSNAME}"
84 then LINK=yes
87 esac
88 done
90 # Link program if needed.
92 if [ "${LINK}" ]
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})"
100 system "${CMD}"
102 done