make-src.sh (3532B)
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 28 SCRIPTDIR=$(dirname "${0}") 29 . "${SCRIPTDIR}/initscript.sh" 30 cd "${TOPDIR}/src" || exit 1 31 32 33 # Check if built-in manual can be generated. 34 35 USE_MANUAL= 36 if [ -f "${IFSDIR}/docs/curl.txt" ] && [ -n "${PASEPERL}" ] 37 then "${PASEPERL}" ./mkhelp.pl < "${IFSDIR}/docs/curl.txt" > tool_hugehelp.c 38 USE_MANUAL="'USE_MANUAL'" 39 fi 40 41 42 # Get source lists. 43 # CURL_CFILES are in the current directory. 44 # CURLX_CFILES are in the lib directory and need to be recompiled because 45 # some function names change using macros. 46 47 get_make_vars Makefile.inc 48 49 50 # Add hugehelp, as it is not included in Makefile.inc. 51 if [ "${USE_MANUAL}" = "'USE_MANUAL'" ] 52 then 53 CURL_CFILES="${CURL_CFILES} tool_hugehelp.c" 54 CURL_HFILES="${CURL_HFILES} tool_hugehelp.h" 55 fi 56 57 # Compile the sources into modules. 58 59 # shellcheck disable=SC2034 60 LINK= 61 MODULES= 62 # shellcheck disable=SC2034 63 INCLUDES="'${TOPDIR}/lib' '${TOPDIR}/lib/curlx'" 64 65 # shellcheck disable=SC2153 66 for SRC in ${CURLX_CFILES} 67 do MODULE=$(db2_name "${SRC}") 68 MODULE=$(db2_name "X${MODULE}") 69 make_module "${MODULE}" "${SRC}" "${USE_MANUAL}" 70 done 71 72 for SRC in ${CURL_CFILES} 73 do MODULE=$(db2_name "${SRC}") 74 make_module "${MODULE}" "${SRC}" "${USE_MANUAL}" 75 done 76 77 78 # Link modules into program. 79 80 MODULES="$(echo "${MODULES}" | sed "s/[^ ][^ ]*/${TARGETLIB}\/&/g")" 81 CMD="CRTPGM PGM(${TARGETLIB}/${CURLPGM})" 82 CMD="${CMD} ENTMOD(${TARGETLIB}/CURLMAIN)" 83 CMD="${CMD} MODULE(${MODULES})" 84 CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)" 85 CMD="${CMD} TGTRLS(${TGTRLS})" 86 CLcommand "${CMD}" 87 88 89 # Create the IFS command. 90 91 IFSBIN="${IFSDIR}/bin" 92 93 if action_needed "${IFSBIN}" 94 then mkdir -p "${IFSBIN}" 95 fi 96 97 rm -f "${IFSBIN}/curl" 98 ln -s "/QSYS.LIB/${TARGETLIB}.LIB/${CURLPGM}.PGM" "${IFSBIN}/curl" 99 100 101 # Create the CL interface program. 102 103 if action_needed "${LIBIFSNAME}/CURLCL.PGM" "${SCRIPTDIR}/curlcl.c" 104 then CMD="CRTBNDC PGM(${TARGETLIB}/${CURLCLI})" 105 CMD="${CMD} SRCSTMF('${SCRIPTDIR}/curlcl.c')" 106 CMD="${CMD} DEFINE('CURLPGM=\"${CURLPGM}\"')" 107 CMD="${CMD} TGTCCSID(${TGTCCSID})" 108 CLcommand "${CMD}" 109 fi 110 111 112 # Create the CL command. 113 114 if action_needed "${LIBIFSNAME}/${CURLCMD}.CMD" "${SCRIPTDIR}/curl.cmd" 115 then CMD="CRTCMD CMD(${TARGETLIB}/${CURLCMD}) PGM(${TARGETLIB}/${CURLCLI})" 116 CMD="${CMD} SRCSTMF('${SCRIPTDIR}/curl.cmd')" 117 CLcommand "${CMD}" 118 fi