]> git.saurik.com Git - wxWidgets.git/blame - build/update-setup-h
Minor header cleaning.
[wxWidgets.git] / build / update-setup-h
CommitLineData
ff3a660b
VZ
1#!/bin/sh
2##############################################################################
3# Name: build/update-setup.h
4# Purpose: run from root wx directory to update wx/*/setup.h files: those
5# having special comment markers in them will be update using
6# include/wx/setup_inc.h contents
7# Created: 2005-01-15
8# RCS-ID: $Id$
9# Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
10# Licence: wxWindows licence
11##############################################################################
12
13rc=0
14
15error()
16{
17 echo $* 1>&2
18}
19
8d51d7d2
VZ
20msg()
21{
22 # TODO: only output from here if "quiet" option is not given
23 echo "$*"
24}
25
26# write all the common options to stdout, massaging them specially if they are
27# meant to be included in a configure input file setup.h.in (the name of the
28# file the common options are meant to be included in is the parameter)
29cat_common_options_for()
30{
0818de2d
VZ
31 # get rid of the copyright header on top of the file
32 cmd="sed '1,/^$/d' include/wx/setup_inc.h"
8d51d7d2
VZ
33
34 # the file used for configure is special: we need to get rid of C++
35 # comments in it because it is included by some C code and we also have to
36 # set all options to 0 by default as they're put to 1 only by configure
37 # (and hence any #ifdefs setting default values for them become unneeded)
38 if [ $1 = "setup.h.in" ]; then
39 cmd="$cmd | sed -e '/^\/\//d' \
40 -e 's@ *//.*\$@@' \
de1efd2d 41 -e 's/# *define \(.\+\) \+1 *\$/#define \1 0/'"
8d51d7d2
VZ
42 fi
43
44 eval $cmd
45}
46
47# update the single setup.h file passed in as the parameter if it is out of
48# date
ff3a660b
VZ
49update_single_setup_h()
50{
8d51d7d2
VZ
51 if [ include/wx/setup_inc.h -ot $1 ]; then
52 echo "Skipping $1 which is already up to date."
53 return 0
54 fi
55
60b881f7 56 echo -n "Updating $1 ..."
8d51d7d2 57
ff3a660b
VZ
58 tmp=$i.$$.tmp
59 sed -e '/^\/\* --- start common options --- \*\/$/q' $1 > $tmp &&
8d51d7d2 60 cat_common_options_for $1 >> $tmp &&
ff3a660b
VZ
61 sed -n -e '/^\/\* --- end common options --- \*\/$/,$p' $1 >> $tmp &&
62 mv $tmp $1
63
64 if [ $? -ne 0 ]; then
8d51d7d2 65 msg " FAILED"
ff3a660b
VZ
66 error "$0: failed to update file $1"
67 rc=2
8d51d7d2
VZ
68 else
69 msg " ok"
ff3a660b
VZ
70 fi
71}
72
73# entry point
74if [ ! -f wxwin.m4 ]; then
75 error "$0: must be ran from root wx directory"
76 exit 1
77fi
78
79update_single_setup_h include/wx/msw/setup0.h
5e9ccdeb 80update_single_setup_h include/wx/msw/wince/setup.h
8d8f077e 81update_single_setup_h include/wx/mac/setup0.h
30e105e4
WS
82update_single_setup_h include/wx/palmos/setup0.h
83update_single_setup_h include/wx/os2/setup0.h
84update_single_setup_h include/wx/motif/setup0.h
2fddf893 85update_single_setup_h setup.h.in
ff3a660b
VZ
86
87exit $rc
8d8f077e 88