File: generate_headers

package info (click to toggle)
debian-cd 3.2.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,848 kB
  • sloc: sh: 6,129; perl: 4,129; makefile: 413
file content (92 lines) | stat: -rwxr-xr-x 1,819 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
#
# Tool to generate HEADER.html in various directories with
# context-specific documentation
#
# Call as:
# 
# generate_headers $INPUT_FILE $OUTPUT_DIR $ARCH

set -e

TOPDIR=$(dirname $0)
if [ "$TOPDIR" = "." ] ; then
    TOPDIR=`pwd`
fi
export TOPDIR

. ${TOPDIR}/CONF.sh
. ${TOPDIR}/settings.sh
. ${TOPDIR}/common.sh

CPP="cpp -traditional -undef -P -C -nostdinc"

if [ "$1"x = ""x ] ; then
   echo "$0: Need to be told what input file to use!"
   exit 1
fi
INPUT=$1

if [ "$2"x = ""x ] ; then
   echo "$0: Need to be told which directory to target!"
   exit 1
fi
WORK=$2

if [ "$3"x = ""x ] ; then
   echo "$0: Need to be told which architecture to target!"
   exit 1
fi
INARCH=$3

case $INARCH in
    i386|amd64|arm64)
	EXTRAS="-DISOHYBRID"
	ARCH=$INARCH
	;;
    multi-arch)
	EXTRAS="-DISOHYBRID -DONEonly"
	ARCH="multi"
	;;
    *)            
	ARCH=$INARCH
	EXTRAS=""
	;;
esac

case $WORK in
    *daily*)
	# for daily builds, don't mention large sets - we're only
	# making netinsts...
	EXTRAS="$EXTRAS -DONEonly"
	;;
esac

case $ARCH in
    kfreebsd*)
	KERNEL="kFreeBSD"
	;;
    hurd*)
	KERNEL="Hurd"
	;;
    *)
	KERNEL="Linux"
	;;
esac

cd $WORK
for DIR1 in *-* tar; do
    STYLE=$(echo $DIR1 | sed 's,^.*/,,g;s,-.*$,,g')
    TYPE=$(echo $DIR1 | sed 's,^.*-,,g')
    if [ -d $DIR1 ]; then
	UPDATES=""
	if (ls -l $DIR1 | grep -q update); then
	    UPDATES="-DUPDATES"
	fi
	#echo "Found directory $DIR (ARCH $ARCH, STYLE $STYLE, TYPE $TYPE)"
	$CPP -DARCH=${ARCH} -DARCH${ARCH} -DKERNEL=${KERNEL} -DSTYLE${STYLE} -DSTYLE=${STYLE} -DTYPE${TYPE} $UPDATES $EXTRAS $INPUT > $DIR1/HEADER.html
	if [ -e $DIR1/.errata.html ]; then
	    $CPP -DARCH=${ARCH} -DARCH${ARCH} -DKERNEL=${KERNEL} -DSTYLE${STYLE} -DSTYLE=${STYLE} -DTYPE${TYPE} $UPDATES $EXTRAS $DIR1/.errata.html >> $DIR1/HEADER.html
	fi
    fi
done