# # $Id: program.subr.in,v 1.21 2004/05/14 22:20:21 jmmv Exp $ # Program type specification. # # buildtool # Copyright (c) 2003, 2004 Julio M. Merino Vidal. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # 3. Neither the name of the author nor the names of contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # BT_TARGET_DEFS+="BT_IS_TEST BT_MANPAGES BT_OBJECTS BT_SOURCES BT_REAL_FILE" program_defs() { local target="${1}" bt_source_depends ${BT_SOURCES} BT_DEPENDS+=${BT_MANPAGES} BT_EXEEXT= # XXX - Need to be set by bt_config BT_REAL_FILE=${BT_TARGET_FILE} BT_TARGET_FILE=real.bt/${BT_REAL_FILE} BT_DEPENDS+=run${target} eval "target_run${target}() { \ BT_TYPE=runscript; \ BT_TARGET_FILE='${BT_REAL_FILE}'; \ BT_FAKE_FILE='${BT_TARGET_FILE}'; \ BT_FLAGS_LD='${BT_FLAGS_LD}'; \ }" } program_build() { local lang=c echo ${BT_SOURCES} | egrep '\.(cc|cpp)' >/dev/null && lang=cxx mkdir -p real.bt bt_link_${lang} ${BT_FLAGS_LD} -o ${BT_TARGET_FILE} ${BT_OBJECTS} \ ${BT_LIBS} } program_deinstall() { local mp mpdir bt_remove ${BT_DIR_BIN}/${BT_REAL_FILE} rmdir -p ${BT_DIR_BIN} 2>/dev/null || true for mp in ${BT_MANPAGES}; do mpdir=${BT_DIR_MAN}/man$(echo ${mp} | sed -e 's/.*\.\([0-9]*\)$/\1/') bt_remove ${mpdir}/${mp##*/} rmdir -p ${mpdir} 2>/dev/null || true done } program_install() { local mp mpdir bt_install_dir ${BT_DIR_BIN} bt_install_bin ${BT_TARGET_FILE} ${BT_DIR_BIN}/${BT_REAL_FILE} for mp in ${BT_MANPAGES}; do mpdir=${BT_DIR_MAN}/man$(echo ${mp} | sed -e 's/.*\.\([0-9]*\)$/\1/') bt_install_dir ${mpdir} bt_install_data ${mp} ${mpdir} done } program_clean() { bt_remove "${BT_TARGET_FILE}" rmdir real.bt 2>/dev/null || true } program_test() { [ "${BT_IS_TEST}" = yes ] && ${BT_OBJDIR}/${BT_REAL_FILE} } # Local Variables: *** # mode: shell-script *** # End: *** # vim: syntax=sh