Nigel Tao | 4c1826a | 2018-08-05 21:55:50 +1000 | [diff] [blame] | 1 | #!/bin/bash -eu |
| 2 | # Copyright 2018 The Wuffs Authors. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | # ---------------- |
| 17 | |
| 18 | # See build-all.sh for commentary. |
| 19 | |
| 20 | for f in example/*; do |
| 21 | echo "Building $f" |
| 22 | if [ "$f" = "example/crc32" ]; then |
| 23 | # example/crc32 is unusual in that it's C++, not C. |
Nigel Tao | 845ffbe | 2018-08-05 22:24:03 +1000 | [diff] [blame] | 24 | g++ -O3 $f/*.cc -o $f/a.out |
Nigel Tao | 4c1826a | 2018-08-05 21:55:50 +1000 | [diff] [blame] | 25 | elif [ "$f" = "example/library" ]; then |
| 26 | # example/library is unusual in that it uses separately compiled libraries |
| 27 | # (built by "wuffs genlib" above) instead of directly #include'ing Wuffs' |
| 28 | # .c files. |
Nigel Tao | 845ffbe | 2018-08-05 22:24:03 +1000 | [diff] [blame] | 29 | gcc -O3 -static -I.. $f/*.c gen/lib/c/gcc-static/libwuffs.a -o $f/a.out |
Nigel Tao | 4c1826a | 2018-08-05 21:55:50 +1000 | [diff] [blame] | 30 | elif [ -e $f/*.c ]; then |
Nigel Tao | 845ffbe | 2018-08-05 22:24:03 +1000 | [diff] [blame] | 31 | gcc -O3 $f/*.c -o $f/a.out |
Nigel Tao | 4c1826a | 2018-08-05 21:55:50 +1000 | [diff] [blame] | 32 | fi |
| 33 | done |