Admin/bash_process/build
changeset 76101 e59d7d6fe1bd
parent 73705 ac07f6be27ea
child 79749 a861b0df74b4
equal deleted inserted replaced
76100:758fd2fbde1e 76101:e59d7d6fe1bd
    10 # diagnostics
    10 # diagnostics
    11 
    11 
    12 function usage()
    12 function usage()
    13 {
    13 {
    14   echo
    14   echo
    15   echo "Usage: $PRG TARGET"
    15   echo "Usage: $PRG PLATFORM"
    16   echo
    16   echo
    17   exit 1
    17   exit 1
    18 }
    18 }
    19 
    19 
    20 function fail()
    20 function fail()
    25 
    25 
    26 
    26 
    27 # command line args
    27 # command line args
    28 
    28 
    29 [ "$#" -eq 0 ] && usage
    29 [ "$#" -eq 0 ] && usage
    30 TARGET="$1"; shift
    30 PLATFORM="$1"; shift
    31 
    31 
    32 [ "$#" -eq 0 ] || usage
    32 [ "$#" -eq 0 ] || usage
    33 
    33 
    34 
    34 
    35 # main
    35 # main
    36 
    36 
    37 mkdir -p "$TARGET"
    37 PLATFORM_DIR="platform_${PLATFORM}"
    38 
    38 
    39 case "$TARGET" in
    39 case "$PLATFORM" in
    40   arm64-linux)
    40   arm64-linux)
    41     cc -Wall bash_process.c -o "$TARGET/bash_process"
    41     mkdir -p "$PLATFORM_DIR"
       
    42     cc -Wall bash_process.c -o "$PLATFORM_DIR/bash_process"
    42     ;;
    43     ;;
    43   x86_64-linux | x86_64-darwin)
    44   x86_64-linux | x86_64-darwin)
    44     cc -Wall -m64 bash_process.c -o "$TARGET/bash_process"
    45     mkdir -p "$PLATFORM_DIR"
       
    46     cc -Wall -m64 bash_process.c -o "$PLATFORM_DIR/bash_process"
    45     ;;
    47     ;;
    46   x86_64-cygwin)
    48   x86_64-cygwin)
    47     cc -Wall bash_process.c -o "$TARGET/bash_process.exe"
    49     mkdir -p "$PLATFORM_DIR"
       
    50     cc -Wall bash_process.c -o "$PLATFORM_DIR/bash_process.exe"
    48     ;;
    51     ;;
    49   *)
    52   *)
    50     fail "Bad target platform: \"$TARGET\""
    53     fail "Bad target platform: \"$PLATFORM\""
    51     ;;
    54     ;;
    52 esac
    55 esac