xref: /netbsd-src/external/gpl3/gcc/dist/libgcc/mkheader.sh (revision b1e838363e3c6fc78a55519254d99869742dd33c)
148fb7bfaSmrg#! /bin/sh
248fb7bfaSmrg
3*b1e83836Smrg# Copyright (C) 2001-2022 Free Software Foundation, Inc.
448fb7bfaSmrg# This file is part of GCC.
548fb7bfaSmrg
648fb7bfaSmrg# GCC is free software; you can redistribute it and/or modify
748fb7bfaSmrg# it under the terms of the GNU General Public License as published by
848fb7bfaSmrg# the Free Software Foundation; either version 3, or (at your option)
948fb7bfaSmrg# any later version.
1048fb7bfaSmrg
1148fb7bfaSmrg# GCC is distributed in the hope that it will be useful,
1248fb7bfaSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
1348fb7bfaSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1448fb7bfaSmrg# GNU General Public License for more details.
1548fb7bfaSmrg
1648fb7bfaSmrg# You should have received a copy of the GNU General Public License
1748fb7bfaSmrg# along with GCC; see the file COPYING3.  If not see
1848fb7bfaSmrg# <http://www.gnu.org/licenses/>.
1948fb7bfaSmrg
2048fb7bfaSmrg
2148fb7bfaSmrg# Print libgcc_tm.h to the standard output.
2248fb7bfaSmrg# DEFINES and HEADERS are expected to be set in the environment.
2348fb7bfaSmrg
2448fb7bfaSmrg# Add multiple inclusion protection guard, part one.
2548fb7bfaSmrgecho "#ifndef LIBGCC_TM_H"
2648fb7bfaSmrgecho "#define LIBGCC_TM_H"
2748fb7bfaSmrg
2848fb7bfaSmrg# Generate the body of the file
2948fb7bfaSmrgecho "/* Automatically generated by mkheader.sh.  */"
3048fb7bfaSmrgfor def in $DEFINES; do
3148fb7bfaSmrg    echo "#ifndef $def" | sed 's/=.*//'
3248fb7bfaSmrg    echo "# define $def" | sed 's/=/ /'
3348fb7bfaSmrg    echo "#endif"
3448fb7bfaSmrgdone
3548fb7bfaSmrg
3648fb7bfaSmrgfor file in $HEADERS; do
3748fb7bfaSmrg    echo "#include \"$file\""
3848fb7bfaSmrgdone
3948fb7bfaSmrg
4048fb7bfaSmrg# Add multiple inclusion protection guard, part two.
4148fb7bfaSmrgecho "#endif /* LIBGCC_TM_H */"
42