1255775Sian#!/bin/sh -
2255775Sian# Copyright (c) 2013 Garrett Cooper
3255775Sian# All rights reserved.
4255775Sian#
5255775Sian# Redistribution and use in source and binary forms, with or without
6255775Sian# modification, are permitted provided that the following conditions
7255775Sian# are met:
8255775Sian# 1. Redistributions of source code must retain the above copyright
9255775Sian#    notice, this list of conditions and the following disclaimer.
10255775Sian# 2. Redistributions in binary form must reproduce the above copyright
11255775Sian#    notice, this list of conditions and the following disclaimer in the
12255775Sian#    documentation and/or other materials provided with the distribution.
13255775Sian#
14255775Sian# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15255775Sian# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16255775Sian# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17255775Sian# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18255775Sian# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19255775Sian# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20255775Sian# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21255775Sian# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22255775Sian# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23255775Sian# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24255775Sian# SUCH DAMAGE.
25255775Sian#
26255775Sian# $FreeBSD: stable/10/include/mk-osreldate.sh 316781 2017-04-13 19:48:45Z ian $
27255775Sian
28255775Sianset -e
29255775Sian
30255775SianCURDIR=$(pwd)
31255775SianECHO=${ECHO:=echo}
32255775Sian
33255775Siantmpfile=$(mktemp osreldate.XXXXXXXX)
34255775Siantrap "rm -f $tmpfile" EXIT
35255775Sian
36255775Sian${ECHO} creating osreldate.h from newvers.sh
37255775Sian
38255929Snwhitehornset +e
39316781SianVARS_ONLY=1
40255929Snwhitehorn. "${NEWVERS_SH:=$CURDIR/../sys/conf/newvers.sh}" || exit 1
41255929Snwhitehornset -e
42255775Siancat > $tmpfile <<EOF
43255775Sian$COPYRIGHT
44255775Sian#ifdef _KERNEL
45255775Sian#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"
46255775Sian#else
47255775Sian#undef __FreeBSD_version
48255775Sian#define __FreeBSD_version $RELDATE
49255775Sian#endif
50255775SianEOF
51255957Sianchmod 644 $tmpfile
52291815Sbdrewerymv -f $tmpfile osreldate.h
53