blob: 1fa1d599cd01cb19d86bd730d4d81ade04bfe346 [file] [log] [blame]
Nigel Tao4c1826a2018-08-05 21:55:50 +10001#!/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
20for 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 Tao845ffbe2018-08-05 22:24:03 +100024 g++ -O3 $f/*.cc -o $f/a.out
Nigel Tao4c1826a2018-08-05 21:55:50 +100025 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 Tao845ffbe2018-08-05 22:24:03 +100029 gcc -O3 -static -I.. $f/*.c gen/lib/c/gcc-static/libwuffs.a -o $f/a.out
Nigel Tao4c1826a2018-08-05 21:55:50 +100030 elif [ -e $f/*.c ]; then
Nigel Tao845ffbe2018-08-05 22:24:03 +100031 gcc -O3 $f/*.c -o $f/a.out
Nigel Tao4c1826a2018-08-05 21:55:50 +100032 fi
33done