source: wspkg/wspkg-sh/packages-cpp.sh @ 4a0c481

Last change on this file since 4a0c481 was 4a0c481, checked in by Ting-Wei Lan <lantw44@…>, 8 years ago

將所有資料檔移出這個 repo,讓資料檔和 script 分開管理

  • Property mode set to 100755
File size: 556 bytes
Line 
1#!/bin/sh
2
3toupper () {
4    echo "$1" | sed 's/^-//' | tr '[:lower:]' '[:upper:]'
5}
6
7[ -z "$1" ] && echo "Usage: $0 input_file cpp_args" && exit 1
8[ -z "$2" ] && default="yes"
9
10input_file="$1"
11shift
12
13: ${CPP:="cpp"}
14: ${CPPFLAGS:="-I."}
15while [ "$1" ]; do
16    case "$1" in
17        -*)
18            selarg="$selarg -D`toupper "$1"`"
19            ;;
20        *)
21            selarg="$selarg -DWSPKG_`toupper "$1"`"
22            ;;
23    esac
24    shift
25done
26
27${CPP} ${CPPFLAGS} $selarg "$input_file" | \
28    sed -e '/^#/d' -e '/^ *$/d' | tr ' ' '\n' | sed '/^ *$/d'
Note: See TracBrowser for help on using the repository browser.