makefile.sh 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. # curl compilation script for the OS/400.
  27. #
  28. #
  29. # This is a shell script since make is not a standard component of OS/400.
  30. SCRIPTDIR=$(dirname "${0}")
  31. . "${SCRIPTDIR}/initscript.sh"
  32. cd "${TOPDIR}" || exit 1
  33. # Create the OS/400 library if it does not exist.
  34. if action_needed "${LIBIFSNAME}"
  35. then CMD="CRTLIB LIB(${TARGETLIB}) TEXT('curl: multiprotocol support API')"
  36. CLcommand "${CMD}"
  37. fi
  38. # Create the DOCS source file if it does not exist.
  39. if action_needed "${LIBIFSNAME}/DOCS.FILE"
  40. then CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(240)"
  41. CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')"
  42. CLcommand "${CMD}"
  43. fi
  44. # Copy some documentation files if needed.
  45. for TEXT in "${TOPDIR}/COPYING" "${SCRIPTDIR}/README.OS400" \
  46. "${TOPDIR}/CHANGES" "${TOPDIR}/docs/THANKS" "${TOPDIR}/docs/FAQ" \
  47. "${TOPDIR}/docs/FEATURES" "${TOPDIR}/docs/SSLCERTS.md" \
  48. "${TOPDIR}/docs/RESOURCES" "${TOPDIR}/docs/VERSIONS.md" \
  49. "${TOPDIR}/docs/HISTORY.md"
  50. do MEMBER="$(basename "${TEXT}" .OS400)"
  51. MEMBER="$(basename "${MEMBER}" .md)"
  52. MEMBER="${LIBIFSNAME}/DOCS.FILE/$(db2_name "${MEMBER}").MBR"
  53. [ -e "${TEXT}" ] || continue
  54. if action_needed "${MEMBER}" "${TEXT}"
  55. then CMD="CPY OBJ('${TEXT}') TOOBJ('${MEMBER}') TOCCSID(${TGTCCSID})"
  56. CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
  57. CLcommand "${CMD}"
  58. fi
  59. done
  60. # Create the RPGXAMPLES source file if it does not exist.
  61. if action_needed "${LIBIFSNAME}/RPGXAMPLES.FILE"
  62. then CMD="CRTSRCPF FILE(${TARGETLIB}/RPGXAMPLES) RCDLEN(240)"
  63. CMD="${CMD} CCSID(${TGTCCSID}) TEXT('ILE/RPG examples')"
  64. CLcommand "${CMD}"
  65. fi
  66. # Copy RPG examples if needed.
  67. for EXAMPLE in "${SCRIPTDIR}/rpg-examples"/*
  68. do MEMBER="$(basename "${EXAMPLE}")"
  69. IFSMEMBER="${LIBIFSNAME}/RPGXAMPLES.FILE/$(db2_name "${MEMBER}").MBR"
  70. [ -e "${EXAMPLE}" ] || continue
  71. if action_needed "${IFSMEMBER}" "${EXAMPLE}"
  72. then CMD="CPY OBJ('${EXAMPLE}') TOOBJ('${IFSMEMBER}')"
  73. CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
  74. CLcommand "${CMD}"
  75. MBRTEXT=$(sed -e '1!d;/^ \*/!d;s/^ *\* *//' \
  76. -e 's/ *$//;s/'"'"'/&&/g' < "${EXAMPLE}")
  77. CMD="CHGPFM FILE(${TARGETLIB}/RPGXAMPLES) MBR(${MEMBER})"
  78. CMD="${CMD} SRCTYPE(RPGLE) TEXT('${MBRTEXT}')"
  79. CLcommand "${CMD}"
  80. fi
  81. done
  82. # Compile the QADRTMAIN2 replacement module.
  83. if action_needed "${LIBIFSNAME}/CURLMAIN.MODULE" "${SCRIPTDIR}/curlmain.c"
  84. then CMD="CRTCMOD MODULE(${TARGETLIB}/CURLMAIN)"
  85. CMD="${CMD} SRCSTMF('${SCRIPTDIR}/curlmain.c')"
  86. CMD="${CMD} SYSIFCOPT(*IFS64IO) LOCALETYPE(*LOCALE) FLAG(10)"
  87. CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})"
  88. CMD="${CMD} OUTPUT(${OUTPUT})"
  89. CMD="${CMD} OPTIMIZE(${OPTIMIZE})"
  90. CMD="${CMD} DBGVIEW(${DEBUG})"
  91. CLcommand "${CMD}"
  92. fi
  93. # Build in each directory.
  94. # for SUBDIR in include lib src tests
  95. for SUBDIR in include lib src
  96. do "${SCRIPTDIR}/make-${SUBDIR}.sh"
  97. done