make-tests.sh 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #!/bin/sh
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  10. #
  11. # This software is licensed as described in the file COPYING, which
  12. # you should have received as part of this distribution. The terms
  13. # are also available at https://curl.se/docs/copyright.html.
  14. #
  15. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  16. # copies of the Software, and permit persons to whom the Software is
  17. # furnished to do so, under the terms of the COPYING file.
  18. #
  19. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  20. # KIND, either express or implied.
  21. #
  22. ###########################################################################
  23. #
  24. # tests compilation script for the OS/400.
  25. #
  26. SCRIPTDIR=`dirname "${0}"`
  27. . "${SCRIPTDIR}/initscript.sh"
  28. cd "${TOPDIR}/tests"
  29. # tests directory not implemented yet.
  30. # Process the libtest subdirectory.
  31. cd libtest
  32. # Get definitions from the Makefile.inc file.
  33. # The `sed' statement works as follows:
  34. # _ Join \nl-separated lines.
  35. # _ Retain only lines that begins with "identifier =".
  36. # _ Turn these lines into shell variable assignments.
  37. eval "`sed -e ': begin' \
  38. -e '/\\\\$/{' \
  39. -e 'N' \
  40. -e 's/\\\\\\n/ /' \
  41. -e 'b begin' \
  42. -e '}' \
  43. -e '/^[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[=]/b keep' \
  44. -e 'd' \
  45. -e ': keep' \
  46. -e 's/[[:space:]]*=[[:space:]]*/=/' \
  47. -e 's/=\\(.*[^[:space:]]\\)[[:space:]]*$/=\\"\\1\\"/' \
  48. -e 's/\\$(\\([^)]*\\))/${\\1}/g' \
  49. < Makefile.inc`"
  50. # Special case: redefine chkhostname compilation parameters.
  51. chkhostname_SOURCES=chkhostname.c
  52. chkhostname_LDADD=curl_gethostname.o
  53. # Compile all programs.
  54. # The list is found in variable "noinst_PROGRAMS"
  55. INCLUDES="'${TOPDIR}/tests/libtest' '${TOPDIR}/lib'"
  56. for PGM in ${noinst_PROGRAMS}
  57. do DB2PGM=`db2_name "${PGM}"`
  58. PGMIFSNAME="${LIBIFSNAME}/${DB2PGM}.PGM"
  59. # Extract preprocessor symbol definitions from compilation
  60. # options for the program.
  61. PGMCFLAGS="`eval echo \"\\${${PGM}_CFLAGS}\"`"
  62. PGMDEFINES=
  63. for FLAG in ${PGMCFLAGS}
  64. do case "${FLAG}" in
  65. -D?*) DEFINE="`echo \"${FLAG}\" | sed 's/^..//'`"
  66. PGMDEFINES="${PGMDEFINES} '${DEFINE}'"
  67. ;;
  68. esac
  69. done
  70. # Compile all C sources for the program into modules.
  71. PGMSOURCES="`eval echo \"\\${${PGM}_SOURCES}\"`"
  72. LINK=
  73. MODULES=
  74. for SOURCE in ${PGMSOURCES}
  75. do case "${SOURCE}" in
  76. *.c) # Special processing for libxxx.c files: their
  77. # module name is determined by the target
  78. # PROGRAM name.
  79. case "${SOURCE}" in
  80. lib*.c) MODULE="${DB2PGM}"
  81. ;;
  82. *) MODULE=`db2_name "${SOURCE}"`
  83. ;;
  84. esac
  85. make_module "${MODULE}" "${SOURCE}" "${PGMDEFINES}"
  86. if action_needed "${PGMIFSNAME}" "${MODIFSNAME}"
  87. then LINK=yes
  88. fi
  89. ;;
  90. esac
  91. done
  92. # Link program if needed.
  93. if [ "${LINK}" ]
  94. then PGMLDADD="`eval echo \"\\${${PGM}_LDADD}\"`"
  95. for LDARG in ${PGMLDADD}
  96. do case "${LDARG}" in
  97. -*) ;; # Ignore non-module.
  98. *) MODULES="${MODULES} "`db2_name "${LDARG}"`
  99. ;;
  100. esac
  101. done
  102. MODULES="`echo \"${MODULES}\" |
  103. sed \"s/[^ ][^ ]*/${TARGETLIB}\/&/g\"`"
  104. CMD="CRTPGM PGM(${TARGETLIB}/${DB2PGM})"
  105. CMD="${CMD} ENTMOD(QADRT/QADRTMAIN2)"
  106. CMD="${CMD} MODULE(${MODULES})"
  107. CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)"
  108. CMD="${CMD} TGTRLS(${TGTRLS})"
  109. system "${CMD}"
  110. fi
  111. done