xref: /freebsd/tools/tinder.sh (revision d0b2dbfa)
1bc14d7f4SMax Khon#!/bin/sh
2bc14d7f4SMax Khon#
3bc14d7f4SMax Khon# Copyright (c) 2011 Max Khon, The FreeBSD Project
4bc14d7f4SMax Khon# All rights reserved.
5bc14d7f4SMax Khon#
6bc14d7f4SMax Khon# Redistribution and use in source and binary forms, with or without
7bc14d7f4SMax Khon# modification, are permitted provided that the following conditions
8bc14d7f4SMax Khon# are met:
9bc14d7f4SMax Khon# 1. Redistributions of source code must retain the above copyright
10bc14d7f4SMax Khon#    notice, this list of conditions and the following disclaimer.
11bc14d7f4SMax Khon# 2. Redistributions in binary form must reproduce the above copyright
12bc14d7f4SMax Khon#    notice, this list of conditions and the following disclaimer in the
13bc14d7f4SMax Khon#    documentation and/or other materials provided with the distribution.
14bc14d7f4SMax Khon#
15bc14d7f4SMax Khon# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16bc14d7f4SMax Khon# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17bc14d7f4SMax Khon# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18bc14d7f4SMax Khon# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19bc14d7f4SMax Khon# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20bc14d7f4SMax Khon# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21bc14d7f4SMax Khon# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22bc14d7f4SMax Khon# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23bc14d7f4SMax Khon# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24bc14d7f4SMax Khon# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25bc14d7f4SMax Khon# SUCH DAMAGE.
26bc14d7f4SMax Khon#
27bc14d7f4SMax Khon#
28bc14d7f4SMax Khon
29bc14d7f4SMax Khon#
30bc14d7f4SMax Khon# Utility script to build specific parts of the source tree on all arches
31bc14d7f4SMax Khon#
32bc14d7f4SMax Khon# Example:
33bc14d7f4SMax Khon#
34bc14d7f4SMax Khon# cd /usr/src
35bc14d7f4SMax Khon# make toolchains		# build toolchain for all arches
36bc14d7f4SMax Khon# sh tools/tinder.sh gnu/lib/libdialog usr.sbin/sade NO_CLEAN=yes
37bc14d7f4SMax Khon#				# build libdialog and sade for all architectures
38bc14d7f4SMax Khon#				# without making clean
39c33e09b4SMax Khon# sh tools/tinder.sh gnu/lib/libdialog usr.sbin/sade TARGETS="amd64 i386"
40c33e09b4SMax Khon#				# build libdialog and sade only for amd64 and i386
41bc14d7f4SMax Khon#
42bc14d7f4SMax Khon
43bc14d7f4SMax Khonif [ $# -eq 0 ]; then
44bc14d7f4SMax Khon	echo 1>&2 "Usage: `basename $0` [MAKEVAR=value...] path..."
45bc14d7f4SMax Khon	exit 1
46bc14d7f4SMax Khonfi
47bc14d7f4SMax Khon
48bc14d7f4SMax Khon# MAKE_ARGS is intentionally not reset to allow caller to specify additional MAKE_ARGS
49bc14d7f4SMax KhonSUBDIR=
50bc14d7f4SMax Khonfor i in "$@"; do
51bc14d7f4SMax Khon	case "$i" in
52bc14d7f4SMax Khon	*=*)
53bc14d7f4SMax Khon		MAKE_ARGS="$MAKE_ARGS $i"
54bc14d7f4SMax Khon		;;
55bc14d7f4SMax Khon	*)
56bc14d7f4SMax Khon		SUBDIR="$SUBDIR $i"
57b8a1e4a8SMax Khon		;;
58bc14d7f4SMax Khon	esac
59bc14d7f4SMax Khondone
60497e8091SBryan Drewerymake tinderbox UNIVERSE_TARGET="_cleanobj _obj everything" $MAKE_ARGS SUBDIR_OVERRIDE="$SUBDIR"
61