make-src.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. # Command line interface tool compilation script for the OS/400.
  27. SCRIPTDIR=$(dirname "${0}")
  28. . "${SCRIPTDIR}/initscript.sh"
  29. cd "${TOPDIR}/src" || exit 1
  30. # Get source lists.
  31. # CURL_CFILES are in the current directory.
  32. # CURLX_CFILES are in the lib directory and need to be recompiled because
  33. # some function names change using macros.
  34. get_make_vars Makefile.inc
  35. # Compile the sources into modules.
  36. # shellcheck disable=SC2034
  37. LINK=
  38. MODULES=
  39. # shellcheck disable=SC2034
  40. INCLUDES="'${TOPDIR}/lib'"
  41. for SRC in ${CURLX_CFILES}
  42. do MODULE=$(db2_name "${SRC}")
  43. MODULE=$(db2_name "X${MODULE}")
  44. make_module "${MODULE}" "${SRC}"
  45. done
  46. for SRC in ${CURL_CFILES}
  47. do MODULE=$(db2_name "${SRC}")
  48. make_module "${MODULE}" "${SRC}"
  49. done
  50. # Link modules into program.
  51. MODULES="$(echo "${MODULES}" | sed "s/[^ ][^ ]*/${TARGETLIB}\/&/g")"
  52. CMD="CRTPGM PGM(${TARGETLIB}/${CURLPGM})"
  53. CMD="${CMD} ENTMOD(${TARGETLIB}/CURLMAIN)"
  54. CMD="${CMD} MODULE(${MODULES})"
  55. CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)"
  56. CMD="${CMD} TGTRLS(${TGTRLS})"
  57. CLcommand "${CMD}"
  58. # Create the IFS command.
  59. IFSBIN="${IFSDIR}/bin"
  60. if action_needed "${IFSBIN}"
  61. then mkdir -p "${IFSBIN}"
  62. fi
  63. rm -f "${IFSBIN}/curl"
  64. ln -s "/QSYS.LIB/${TARGETLIB}.LIB/${CURLPGM}.PGM" "${IFSBIN}/curl"
  65. # Create the CL interface program.
  66. if action_needed "${LIBIFSNAME}/CURLCL.PGM" "${SCRIPTDIR}/curlcl.c"
  67. then CMD="CRTBNDC PGM(${TARGETLIB}/${CURLCLI})"
  68. CMD="${CMD} SRCSTMF('${SCRIPTDIR}/curlcl.c')"
  69. CMD="${CMD} DEFINE('CURLPGM=\"${CURLPGM}\"')"
  70. CMD="${CMD} TGTCCSID(${TGTCCSID})"
  71. CLcommand "${CMD}"
  72. fi
  73. # Create the CL command.
  74. if action_needed "${LIBIFSNAME}/${CURLCMD}.CMD" "${SCRIPTDIR}/curl.cmd"
  75. then CMD="CRTCMD CMD(${TARGETLIB}/${CURLCMD}) PGM(${TARGETLIB}/${CURLCLI})"
  76. CMD="${CMD} SRCSTMF('${SCRIPTDIR}/curl.cmd')"
  77. CLcommand "${CMD}"
  78. fi