make-tests.sh 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #!/bin/sh
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 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. # SPDX-License-Identifier: curl
  23. #
  24. ###########################################################################
  25. #
  26. # tests compilation script for the OS/400.
  27. #
  28. SCRIPTDIR=`dirname "${0}"`
  29. . "${SCRIPTDIR}/initscript.sh"
  30. cd "${TOPDIR}/tests"
  31. # Build programs in a directory.
  32. build_all_programs()
  33. {
  34. # Compile all programs.
  35. # The list is found in variable "noinst_PROGRAMS"
  36. INCLUDES="'`pwd`' '${TOPDIR}/lib' '${TOPDIR}/src'"
  37. MODS="${1}"
  38. SRVPGMS="${2}"
  39. for PGM in ${noinst_PROGRAMS}
  40. do DB2PGM=`db2_name "${PGM}"`
  41. PGMIFSNAME="${LIBIFSNAME}/${DB2PGM}.PGM"
  42. # Extract preprocessor symbol definitions from
  43. # compilation options for the program.
  44. PGMCFLAGS="`eval echo \"\\${${PGM}_CFLAGS}\"`"
  45. PGMDFNS=
  46. for FLAG in ${PGMCFLAGS}
  47. do case "${FLAG}" in
  48. -D?*) DEFINE="`echo \"${FLAG}\" | sed 's/^..//'`"
  49. PGMDFNS="${PGMDFNS} '${DEFINE}'"
  50. ;;
  51. esac
  52. done
  53. # Compile all C sources for the program into modules.
  54. PGMSOURCES="`eval echo \"\\${${PGM}_SOURCES}\"`"
  55. LINK=
  56. MODULES=
  57. for SOURCE in ${PGMSOURCES}
  58. do case "${SOURCE}" in
  59. *.c) # Special processing for libxxx.c files:
  60. # their module name is determined
  61. # by the target PROGRAM name.
  62. case "${SOURCE}" in
  63. lib*.c) MODULE="${DB2PGM}"
  64. ;;
  65. *) MODULE=`db2_name "${SOURCE}"`
  66. ;;
  67. esac
  68. # If source is in a sibling directory,
  69. # prefix module name with 'X'.
  70. case "${SOURCE}" in
  71. ../*) MODULE=`db2_name "X${MODULE}"`
  72. ;;
  73. esac
  74. make_module "${MODULE}" "${SOURCE}" "${PGMDFNS}"
  75. if action_needed "${PGMIFSNAME}" "${MODIFSNAME}"
  76. then LINK=yes
  77. fi
  78. ;;
  79. esac
  80. done
  81. # Link program if needed.
  82. if [ "${LINK}" ]
  83. then PGMLDADD="`eval echo \"\\${${PGM}_LDADD}\"`"
  84. for ARG in ${PGMLDADD}
  85. do case "${ARG}" in
  86. -*) ;; # Ignore non-module.
  87. *) MODULES="${MODULES} "`db2_name "${ARG}"`
  88. ;;
  89. esac
  90. done
  91. MODULES="`echo \"${MODULES}\" |
  92. sed \"s/[^ ][^ ]*/${TARGETLIB}\/&/g\"`"
  93. CMD="CRTPGM PGM(${TARGETLIB}/${DB2PGM})"
  94. CMD="${CMD} ENTMOD(${TARGETLIB}/CURLMAIN)"
  95. CMD="${CMD} MODULE(${MODULES} ${MODS})"
  96. CMD="${CMD} BNDSRVPGM(${SRVPGMS} QADRTTS)"
  97. CMD="${CMD} TGTRLS(${TGTRLS})"
  98. CLcommand "${CMD}"
  99. fi
  100. done
  101. }
  102. # Build programs in the server directory.
  103. (
  104. cd server
  105. get_make_vars Makefile.inc
  106. build_all_programs "${TARGETLIB}/OS400SYS"
  107. )
  108. # Build all programs in the libtest subdirectory.
  109. (
  110. cd libtest
  111. get_make_vars Makefile.inc
  112. # Special case: redefine chkhostname compilation parameters.
  113. chkhostname_SOURCES=chkhostname.c
  114. chkhostname_LDADD=curl_gethostname.o
  115. build_all_programs "" "${TARGETLIB}/${SRVPGM}"
  116. )