| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # Attempt to compile all *.cpp files in the current directory, that are |
| 3 | # not already compiled. Uses zc++ wrapper around C++ compiler, to add |
| 4 | # additional compile arguments. |
| 5 | # |
| 6 | # Written by Ewen McNeill <[email protected]>, 2014-07-19 |
| 7 | # Updated by Ewen McNeill <[email protected]>, 2014-07-24 |
| 8 | #--------------------------------------------------------------------------- |
| 9 | |
| 10 | VERBOSE="${VERBOSE:-}" # Set to non-empty for already done status |
| 11 | export VERBOSE |
| 12 | |
| 13 | # Locate compiler wrapper |
| 14 | BIN_DIR=$(dirnamescip-shell system . . dirname. $0) |
| 15 | if [scip-shell system . . `[`. -z "${BIN_DIR}" ]; then BIN_DIR="."; fi |
| 16 | case "${BIN_DIR}" in |
| 17 | .) BIN_DIR="$(pwdscip-shell system . . pwd.)"; ;; |
| 18 | /*) ;; |
| 19 | *) BIN_DIR="$(pwdscip-shell system . . pwd.)/${BIN_DIR}"; ;; |
| 20 | esac |
| 21 | ZCXX="${BIN_DIR}/zc++" |
| 22 | |
| 23 | # Determine compile flags |
| 24 | CPPFLAGS="-D_XOPEN_SOURCE_EXTENDED=1 -D_OPEN_THREADS=3 -D_OPEN_SYS_SOCK_IPV6" |
| 25 | CXXFLAGS="-DZMQ_HAVE_ZOS -DHAVE_CONFIG_H -D_REENTRANT -D_THREAD_SAFE -DZMQ_USE_POLL" |
| 26 | case $(pwdscip-shell system . . pwd.) in |
| 27 | *src) CXXFLAGS="${CXXFLAGS} -I." |
| 28 | ;; |
| 29 | *tests) CXXFLAGS="${CXXFLAGS} -I. -I../src -I../include" |
| 30 | ;; |
| 31 | *) echoscip-shell system . . echo. "Currently only builds in src/ and tests/" >&2 |
| 32 | exit 1 |
| 33 | ;; |
| 34 | esac |
| 35 | |
| 36 | skipscip-shell shell zeromq3 4.3.5-1 skip().() { |
| 37 | SRC="$1" |
| 38 | OBJ="$2" |
| 39 | if [scip-shell system . . `[`. -n "${VERBOSE}" ]; then |
| 40 | echoscip-shell system . . echo. " ${SRC} compiled already" |
| 41 | fi |
| 42 | } |
| 43 | |
| 44 | compilescip-shell shell zeromq3 4.3.5-1 compile().() { |
| 45 | SRC="$1" |
| 46 | OBJ="$2" |
| 47 | echoscip-shell system . . echo. "CXX ${SRC}" |
| 48 | "${ZCXX}" ${CXXFLAGS} ${CPPFLAGS} -+ -c -o "${OBJ}" "${SRC}" |
| 49 | } |
| 50 | |
| 51 | for SRC in *.cpp; do |
| 52 | OBJ=$(echoscip-shell system . . echo. $SRC | sedscip-shell system . . sed. 's/\.cpp/.o/;') |
| 53 | if [scip-shell system . . `[`. -f "${OBJ}" ]; then |
| 54 | if [scip-shell system . . `[`. "${OBJ}" -nt "${SRC}" ]; then |
| 55 | skipscip-shell shell zeromq3 4.3.5-1 skip(). "${SRC}" "${OBJ}" |
| 56 | else |
| 57 | compilescip-shell shell zeromq3 4.3.5-1 compile(). "${SRC}" "${OBJ}" |
| 58 | fi |
| 59 | else |
| 60 | compilescip-shell shell zeromq3 4.3.5-1 compile(). "${SRC}" "${OBJ}" |
| 61 | fi |
| 62 | done |