make-src.sh 3.2 KB

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