1bfe5c479SIan Lepore#!/bin/sh - 2*4d846d26SWarner Losh# SPDX-License-Identifier: BSD-2-Clause 3e58eb3c4SPedro F. Giffuni# 4bfe5c479SIan Lepore# Copyright (c) 2013 Garrett Cooper 5bfe5c479SIan Lepore# All rights reserved. 6bfe5c479SIan Lepore# 7bfe5c479SIan Lepore# Redistribution and use in source and binary forms, with or without 8bfe5c479SIan Lepore# modification, are permitted provided that the following conditions 9bfe5c479SIan Lepore# are met: 10bfe5c479SIan Lepore# 1. Redistributions of source code must retain the above copyright 11bfe5c479SIan Lepore# notice, this list of conditions and the following disclaimer. 12bfe5c479SIan Lepore# 2. Redistributions in binary form must reproduce the above copyright 13bfe5c479SIan Lepore# notice, this list of conditions and the following disclaimer in the 14bfe5c479SIan Lepore# documentation and/or other materials provided with the distribution. 15bfe5c479SIan Lepore# 16bfe5c479SIan Lepore# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17bfe5c479SIan Lepore# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18bfe5c479SIan Lepore# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19bfe5c479SIan Lepore# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20bfe5c479SIan Lepore# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21bfe5c479SIan Lepore# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22bfe5c479SIan Lepore# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23bfe5c479SIan Lepore# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24bfe5c479SIan Lepore# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25bfe5c479SIan Lepore# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26bfe5c479SIan Lepore# SUCH DAMAGE. 27bfe5c479SIan Lepore# 28bfe5c479SIan Lepore 29bfe5c479SIan Leporeset -e 30bfe5c479SIan Lepore 31bfe5c479SIan LeporeCURDIR=$(pwd) 32bfe5c479SIan LeporeECHO=${ECHO:=echo} 33bfe5c479SIan Lepore 34bfe5c479SIan Leporetmpfile=$(mktemp osreldate.XXXXXXXX) 35bfe5c479SIan Leporetrap "rm -f $tmpfile" EXIT 36bfe5c479SIan Lepore 37bfe5c479SIan Lepore${ECHO} creating osreldate.h from newvers.sh 38bfe5c479SIan Lepore 3936ddc868SNathan Whitehornset +e 400dd16fd9SWarner LoshCOPYRIGHT=$(sh ${NEWVERS_SH:=$CURDIR/../sys/conf/newvers.sh} -c) || exit 1 410dd16fd9SWarner Losheval $(sh ${NEWVERS_SH} -V RELDATE) || exit 1 4236ddc868SNathan Whitehornset -e 43bfe5c479SIan Leporecat > $tmpfile <<EOF 44bfe5c479SIan Lepore$COPYRIGHT 45bfe5c479SIan Lepore#ifdef _KERNEL 46bfe5c479SIan Lepore#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>" 47bfe5c479SIan Lepore#else 48bfe5c479SIan Lepore#undef __FreeBSD_version 49bfe5c479SIan Lepore#define __FreeBSD_version $RELDATE 50bfe5c479SIan Lepore#endif 51bfe5c479SIan LeporeEOF 5298c636beSIan Leporechmod 644 $tmpfile 53bd831db6SSimon J. Gerratymv -f $tmpfile osreldate.h 54