xref: /openbsd-src/gnu/gcc/fixincludes/mkheaders.in (revision 404b540a9034ac75a6199ad1a32d1bbc7a0d4210)
1*404b540aSrobert#!/bin/sh
2*404b540aSrobert
3*404b540aSrobert# Copyright (C) 2002, 2007 Free Software Foundation, Inc.
4*404b540aSrobert
5*404b540aSrobert#This file is part of GCC.
6*404b540aSrobert
7*404b540aSrobert#GCC is free software; you can redistribute it and/or modify it under
8*404b540aSrobert#the terms of the GNU General Public License as published by the Free
9*404b540aSrobert#Software Foundation; either version 2, or (at your option) any later
10*404b540aSrobert#version.
11*404b540aSrobert
12*404b540aSrobert#GCC is distributed in the hope that it will be useful, but WITHOUT
13*404b540aSrobert#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14*404b540aSrobert#FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15*404b540aSrobert#for more details.
16*404b540aSrobert
17*404b540aSrobert#You should have received a copy of the GNU General Public License
18*404b540aSrobert#along with GCC; see the file COPYING.  If not, write to the Free
19*404b540aSrobert#Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20*404b540aSrobert#02110-1301, USA.
21*404b540aSrobert
22*404b540aSrobert# Basic information
23*404b540aSroberttarget=@target@
24*404b540aSroberttarget_noncanonical=@target_noncanonical@
25*404b540aSrobertversion=@gcc_version@
26*404b540aSrobert
27*404b540aSrobertVERBOSE=0
28*404b540aSrobertwhile [ x$1 = x-v ] ; do
29*404b540aSrobert    shift
30*404b540aSrobert    VERBOSE=`expr $VERBOSE + 1`
31*404b540aSrobertdone
32*404b540aSrobertexport VERBOSE
33*404b540aSrobert
34*404b540aSrobertif [ x$1 = x--help ] ; then
35*404b540aSrobert    echo "Usage: mkheaders [options] [prefix [isysroot]]"
36*404b540aSrobert    echo "Options:"
37*404b540aSrobert    echo "  -v        Print more output (may be repeated for even more output)"
38*404b540aSrobert    echo "  --help    This help"
39*404b540aSrobert    echo "  --version Print version information"
40*404b540aSrobert    exit 0
41*404b540aSrobertfi
42*404b540aSrobert
43*404b540aSrobertif [ x$1 = x--version ] ; then
44*404b540aSrobert    echo "mkheaders (GCC) version $version"
45*404b540aSrobert    echo "Copyright 2002, 2007 Free Software Foundation, Inc."
46*404b540aSrobert    echo "This program is free software; you may redistribute it under the"
47*404b540aSrobert    echo "terms of the GNU General Public License.  This program has"
48*404b540aSrobert    echo "absolutely no warranty."
49*404b540aSrobert    exit 0
50*404b540aSrobertfi
51*404b540aSrobert
52*404b540aSrobert# Common prefix for installation directories.
53*404b540aSrobertif [ x$1 != x ] ; then
54*404b540aSrobert  prefix=$1
55*404b540aSrobert  shift
56*404b540aSrobertelse
57*404b540aSrobert  prefix=@prefix@
58*404b540aSrobertfi
59*404b540aSrobert
60*404b540aSrobert# Allow for alternate isysroot in which to find headers
61*404b540aSrobertif [ x$1 != x ] ; then
62*404b540aSrobert  isysroot=$1
63*404b540aSrobert  shift
64*404b540aSrobertelse
65*404b540aSrobert  isysroot=
66*404b540aSrobertfi
67*404b540aSrobert
68*404b540aSrobert# Directory in which to put host dependent programs and libraries
69*404b540aSrobertexec_prefix=@exec_prefix@
70*404b540aSrobert# Directory in which to put the directories used by the compiler.
71*404b540aSrobertlibdir=@libdir@
72*404b540aSrobertlibexecdir=@libexecdir@
73*404b540aSrobert# Directory in which the compiler finds libraries, etc.
74*404b540aSrobertlibsubdir=${libdir}/gcc/${target_noncanonical}/${version}
75*404b540aSrobert# Directory in which the compiler finds executables
76*404b540aSrobertlibexecsubdir=${libexecdir}/gcc/${target_noncanonical}/${version}
77*404b540aSrobert
78*404b540aSrobertitoolsdir=${libexecsubdir}/install-tools
79*404b540aSrobertitoolsdatadir=${libsubdir}/install-tools
80*404b540aSrobertincdir=${libsubdir}/include
81*404b540aSrobert
82*404b540aSrobert. ${itoolsdatadir}/mkheaders.conf
83*404b540aSrobert
84*404b540aSrobertcd ${itoolsdir}
85*404b540aSrobertrm -rf ${incdir}/*
86*404b540aSrobert
87*404b540aSrobertif [ x${STMP_FIXINC} != x ] ; then
88*404b540aSrobert	TARGET_MACHINE="${target}" target_canonical="${target}" \
89*404b540aSrobert	    MACRO_LIST="${itoolsdatadir}/macro_list" \
90*404b540aSrobert	    @SHELL@ ./fixinc.sh ${incdir} \
91*404b540aSrobert	    ${isysroot}${SYSTEM_HEADER_DIR} ${OTHER_FIXINCLUDES_DIRS}
92*404b540aSrobert	rm -f ${incdir}/syslimits.h
93*404b540aSrobert	if [ -f ${incdir}/limits.h ]; then
94*404b540aSrobert	  mv ${incdir}/limits.h ${incdir}/syslimits.h
95*404b540aSrobert	else
96*404b540aSrobert	  cp ${itoolsdatadir}/gsyslimits.h ${incdir}/syslimits.h
97*404b540aSrobert	fi
98*404b540aSrobertfi
99*404b540aSrobert
100*404b540aSrobertcp ${itoolsdatadir}/include/* ${incdir}
101*404b540aSrobert
102*404b540aSrobertif [ x${STMP_FIXPROTO} != x ] ; then
103*404b540aSrobert  mkinstalldirs="@SHELL@ ${itoolsdir}/mkinstalldirs"
104*404b540aSrobert  export FIXPROTO_DEFINES mkinstalldirs
105*404b540aSrobert  @SHELL@ fixproto ${incdir} ${incdir} ${isysroot}${SYSTEM_HEADER_DIR} || exit 1
106*404b540aSrobertfi
107