/[cvs]/eggdrop1.7/misc/makedepend
ViewVC logotype

Contents of /eggdrop1.7/misc/makedepend

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Mon Nov 20 13:53:32 2006 UTC (12 years, 7 months ago) by tothwolf
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +2 -2 lines
* Updated copyright dates for 2006 (better late than never).

1 #! /bin/sh
2 #
3 # makedepend - updates Makefile dependencies throughout the tree
4 #
5 # Copyright (C) 2004 - 2006 Eggheads Development Team
6 #
7 # This file is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
25 #
26 # $Id: makedepend,v 1.3 2005/01/21 01:43:38 wcc Exp $
27
28 show_usage() {
29 echo "Usage: `basename $0` [-h|-f]"
30 echo ""
31 echo " -h, --help - Print this help and exit."
32 echo " -n, --nocleanup - Don't run 'make distclean' when finished."
33 echo " -f, --force - Continue even if 'make depend' fails."
34 exit 1
35 }
36
37 update_makefile() {
38 if test ! -f ${1}/.depend; then
39 echo "Warning: no .depend found in ${1}/; skipping."
40 elif ! grep '#safety hash' >/dev/null 2>/dev/null ${1}/${2}; then
41 echo "Warning: no '#safety hash' found in ${1}/${2}; skipping."
42 else
43 sed '/#safety hash/,$d' < ${1}/$2 > ${1}/${2}_
44 echo "#safety hash" >> ${1}/${2}_
45 cat ${1}/.depend >> ${1}/${2}_
46 mv ${1}/${2}_ ${1}/${2}
47 echo "Updated ${1}/${2}."
48 fi
49 }
50
51 update_disabled() {
52 cd ./src/mod/${1}.mod/ && make 'CC=gcc' \
53 'CFLAGS = -I. -I../../.. -I../../../src/mod -DMAKING_DEPEND -DHAVE_CONFIG_H -DMAKING_MODS' depend
54 if test ! $? = 0; then
55 echo "Error: 'make depend' failed in ./src/mod/${1}.mod/." >&2
56 echo "" >&2
57 test $use_force = 1 || exit 1
58 fi
59 cd $CURRENT_PWD
60 }
61
62 if test ! -f src/main.c; then
63 echo "You are not in the Eggdrop root directory."
64 exit 1
65 fi
66
67 use_force=0
68 no_cleanup=0
69 for arg in $@; do
70 if test "x${arg}" = "x-h" || test "x${arg}" = "x--help"; then
71 show_usage
72 fi
73 if test "x${arg}" = "x-f" || test "x${arg}" = "x--force"; then
74 use_force=1
75 fi
76 if test "x${arg}" = "x-n" || test "x${arg}" = "x--nocleanup"; then
77 no_cleanup=1
78 fi
79 done
80
81 echo ""
82 echo -n "Running 'make distclean'..."
83 make distclean >/dev/null 2>/dev/null
84 echo " done."
85 echo -n "Running configure..."
86 sh configure >/dev/null 2>/dev/null && make config >/dev/null 2>/dev/null
87 echo " done."
88
89 echo ""
90 echo "Running 'make depend'..."
91 echo ""
92 make depend
93 if test ! $? = 0; then
94 echo "Error: 'make depend' failed." >&2
95 echo "" >&2
96 test $use_force = 1 || exit 1
97 fi
98
99 echo ""
100 echo "Running 'make depend' for disabled modules..."
101 echo ""
102 DISABLED_MODULES=$(cat disabled_modules | grep '^[a-z]')
103 CURRENT_PWD=$(pwd)
104 for i in ${DISABLED_MODULES}; do
105 update_disabled $i
106 done
107
108 echo ""
109 echo "Updating Makefiles and Makefile.ins..."
110 echo ""
111 for i in $(find ./src/ -name "Makefile.in" -exec dirname '{}' ';' | grep -v '^\./src/mod$'); do
112 update_makefile $i "Makefile.in"
113 done
114
115 for i in $(find ./src/ -name "Makefile" -exec dirname '{}' ';' | grep -v '^\./src/mod$'); do
116 update_makefile $i "Makefile"
117 done
118
119 if test $no_cleanup = 0; then
120 echo ""
121 echo -n "Running 'make distclean'..."
122 make distclean >/dev/null
123 echo " done."
124 fi
125
126 echo ""
127 echo "Complete."
128 echo ""

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23