tinder.sh revision 228066
1230557Sjimharris#!/bin/sh
2230557Sjimharris#
3230557Sjimharris# Copyright (c) 2011 Max Khon, The FreeBSD Project
4230557Sjimharris# All rights reserved.
5230557Sjimharris#
6230557Sjimharris# Redistribution and use in source and binary forms, with or without
7230557Sjimharris# modification, are permitted provided that the following conditions
8230557Sjimharris# are met:
9230557Sjimharris# 1. Redistributions of source code must retain the above copyright
10230557Sjimharris#    notice, this list of conditions and the following disclaimer.
11230557Sjimharris# 2. Redistributions in binary form must reproduce the above copyright
12230557Sjimharris#    notice, this list of conditions and the following disclaimer in the
13230557Sjimharris#    documentation and/or other materials provided with the distribution.
14230557Sjimharris#
15230557Sjimharris# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16230557Sjimharris# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17230557Sjimharris# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18230557Sjimharris# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19230557Sjimharris# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20230557Sjimharris# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21230557Sjimharris# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22230557Sjimharris# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23230557Sjimharris# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24230557Sjimharris# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25230557Sjimharris# SUCH DAMAGE.
26230557Sjimharris#
27230557Sjimharris# $FreeBSD: head/tools/tinder.sh 228066 2011-11-28 14:03:36Z fjoe $
28230557Sjimharris#
29230557Sjimharris
30230557Sjimharris#
31230557Sjimharris# Utility script to build specific parts of the source tree on all arches
32230557Sjimharris#
33230557Sjimharris# Example:
34230557Sjimharris#
35230557Sjimharris# cd /usr/src
36230557Sjimharris# make toolchains		# build toolchain for all arches
37230557Sjimharris# sh tools/tinder.sh gnu/lib/libdialog usr.sbin/sade NO_CLEAN=yes
38230557Sjimharris#				# build libdialog and sade for all architectures
39230557Sjimharris#				# without making clean
40230557Sjimharris# sh tools/tinder.sh gnu/lib/libdialog usr.sbin/sade TARGETS="amd64 i386"
41230557Sjimharris#				# build libdialog and sade only for amd64 and i386
42230557Sjimharris#
43230557Sjimharris
44230557Sjimharrisif [ $# -eq 0 ]; then
45230557Sjimharris	echo 1>&2 "Usage: `basename $0` [MAKEVAR=value...] path..."
46230557Sjimharris	exit 1
47230557Sjimharrisfi
48230557Sjimharris
49230557Sjimharris# MAKE_ARGS is intentionally not reset to allow caller to specify additional MAKE_ARGS
50230557SjimharrisSUBDIR=
51230557Sjimharrisfor i in "$@"; do
52230557Sjimharris	case "$i" in
53230557Sjimharris	*=*)
54230557Sjimharris		MAKE_ARGS="$MAKE_ARGS $i"
55230557Sjimharris		;;
56230557Sjimharris	*)
57230557Sjimharris		SUBDIR="$SUBDIR $i"
58230557Sjimharris		;;
59230557Sjimharris	esac
60230557Sjimharrisdone
61230557Sjimharrismake tinderbox UNIVERSE_TARGET="_cleanobj _obj _depend everything" $MAKE_ARGS SUBDIR_OVERRIDE="$SUBDIR"
62230557Sjimharris