dgaudet 97/10/07 12:53:33
Modified: src CHANGES Configure Makefile.tmpl
src/main Makefile.tmpl
src/modules/standard Makefile.tmpl
src/os/unix Makefile.tmpl
Added: src/modules/example Makefile.tmpl
src/modules/proxy Makefile.libdir Makefile.tmpl
Removed: src/modules/example Makefile
src/modules/proxy Makefile
Log:
Fix PR#1159: Configure always exits with return code 0 -- need a variable
to tell the trap what exitcode to use.
Eliminate the need to use `pwd` which was causing big long ugly -I lines
in the Makefiles. Instead we build variables INCLUDES_DEPTH0,
INCLUDES_DEPTH1, INCLUDES_DEPTH2 which have the appropriate level of -Is.
Add names to INCLUDES_AUTODEPTH and they'll be -Id to the right level.
Remove the symlinking of os.h and os-inline.c. Instead $(OSDIR) is added
to INCLUDES_AUTODEPTH.
modules/proxy/Makefile replaced by modules/proxy/Makefile.tmpl, which has
all the right substitutions done on it -- so that, for example, the proxy
gets the right regex.h.
To facilitate the previous, I had to touch a file
modules/proxy/Makefile.libdir... which just means "the tmpl includes all
the necessary Makefile recipies, just prepend Makefile.config to the
front". i.e. Configure shouldn't generate all the targets like it does
for modules/standard, and modules/extra. This is probably something that
we'd want for all AddModules modules/foo/libfoo.a ... but I didn't feel
like groking the awk fooness in Configure.
modules/example/Makefile replaced by (essentially empty)
modules/example/Makefile.tmpl. So that it has proper substitution done on
it.
Remove some last-built cruft that stuck around after some other patches.
Change rm $(OBJS) to rm *.o to ensure we remove all cruft .o files.
modules/Makefile now has Makefile.config prepended to it, so that, for
example, RANLIB is set properly.
Reviewed by: Jim Jagielski, Martin Kraemer
Revision Changes Path
1.461 +3 -0 apachen/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apachen/src/CHANGES,v
retrieving revision 1.460
retrieving revision 1.461
diff -u -r1.460 -r1.461
--- CHANGES 1997/10/07 19:44:39 1.460
+++ CHANGES 1997/10/07 19:53:19 1.461
@@ -1,5 +1,8 @@
Changes with Apache 1.3b1
+ *) Configure uses a sh trap and didn't set its exitcode properly.
+ [Dean Gaudet] PR#1159
+
*) Yet another vhost revamp. Add the NameVirtualHost directive which
explicitly lists the ip:port pairs that are to be used for name-vhosts.
From a given ip:port, regardless what the Host: header is, you can
1.160 +51 -46 apachen/src/Configure
Index: Configure
===================================================================
RCS file: /export/home/cvs/apachen/src/Configure,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -r1.159 -r1.160
--- Configure 1997/10/02 05:26:01 1.159
+++ Configure 1997/10/07 19:53:21 1.160
@@ -1,5 +1,6 @@
#!/bin/sh
-trap 'rm -f $tmpfile $tmpfile2 $tmpfile3 $awkfile; exit' 0 1 2 3 15
+exitcode=0
+trap 'rm -f $tmpfile $tmpfile2 $tmpfile3 $awkfile; exit $exitcode' 0 1 2 3 15
# Apache configuration script, first cut --- rst.
# Don't like it? Inspired to do something better? Go for it.
@@ -25,7 +26,6 @@
tmpfile2=$tmpfile.2
tmpfile3=$tmpfile.3
awkfile=$tmpfile.4
-SRCDIR=`pwd`
SUBDIRS='$(OSDIR) main modules'
####################################################################
@@ -37,6 +37,7 @@
shift 1; file=$1; shift 1
if [ ! -r $file ]; then
echo "$file does not exist or is not readable."
+ exitcode=1
exit 1
fi
else
@@ -48,6 +49,7 @@
if [ ! -r $file ]; then
echo "Can't see or read \"$file\""
+ exitcode=1
exit 1
fi
@@ -85,6 +87,7 @@
egrep -v '^%?Module[ ]+[A-Za-z0-9_]+[ ]+[^ ]+$' $tmpfile \
| egrep -v '^%?AddModule[ ]+[^ ]+$' \
| grep -v =
+ exitcode=1
exit 1
fi
@@ -516,6 +519,7 @@
echo [EMAIL PROTECTED] If you don\'t wish to do the port
echo yourself, please submit this output rather than the patches.
echo Thank you
+ exitcode=1
exit 1
;;
esac
@@ -575,6 +579,7 @@
echo "Error: could not find any of these C compilers"
echo " anywhere in your PATH: $lookedfor"
echo "Configure terminated"
+ exitcode=1
exit 1
fi
CC=$COMPILER
@@ -667,7 +672,7 @@
if [ "$RULE_WANTHSREGEX" = "yes" ]; then
REGLIB="regex/libregex.a"
SUBDIRS="$SUBDIRS regex"
- INCLUDES="$INCLUDES -I${SRCDIR}/regex"
+ INCLUDES_AUTODEPTH="$INCLUDES_AUTODEPTH regex"
fi
#
@@ -938,15 +943,26 @@
#
echo >> Makefile
echo "CFLAGS1=$CFLAGS">> Makefile.config
-echo "INCLUDES1=$INCLUDES -I${SRCDIR}/main">> Makefile.config
+echo "INCLUDES1=$INCLUDES">> Makefile.config
+
+INCLUDES_AUTODEPTH="$INCLUDES_AUTODEPTH $OSDIR main"
+incprefix="-I"
+for depth in 0 1 2; do
+ incvar="INCLUDES_DEPTH${depth}="
+ for i in $INCLUDES_AUTODEPTH; do
+ incvar="$incvar${incprefix}$i "
+ done
+ echo "$incvar" >>Makefile.config
+ incprefix="${incprefix}../"
+done
+
echo "LIBS1=$LIBS">> Makefile.config
echo "LDFLAGS1=$LDFLAGS">> Makefile.config
echo "BROKEN_BPRINTF_FLAGS=$OSBPRINTF">> Makefile.config
echo "REGLIB=$REGLIB">> Makefile.config
echo "RANLIB=$RANLIB">> Makefile.config
echo "SHELL=$SHELL">> Makefile.config
-echo "OSOBJ=${SRCDIR}/$OSDIR/os.o">> Makefile.config
-echo "OSDIR=${SRCDIR}/$OSDIR">> Makefile.config
+echo "OSDIR=$OSDIR">> Makefile.config
echo "SUBDIRS=$SUBDIRS">> Makefile.config
echo >> Makefile.config
echo "#### End of Configure created section ####">> Makefile.config
@@ -965,6 +981,7 @@
echo "** as gcc. The above error message from your compiler"
echo "** will also provide a clue."
echo " Aborting!"
+ exitcode=1
exit 1
fi
@@ -975,10 +992,6 @@
#
cat Makefile.config >> Makefile
sed -e "s#@@Configuration@@#$file#" "Makefile.tmpl" >>Makefile
-awk >>Makefile <$tmpfile '
- ($1 == "Module" && $3 ~ /modules\//) {
- printf "%s: modules/last-built ; @cat /dev/null\n\n", $3, $3
- }'
#
# directories to create makefiles in
@@ -989,32 +1002,18 @@
cat Makefile.config $dir/Makefile.tmpl > $dir/Makefile
done
-cat << EOF > modules/Makefile
-#
-# Simple Makefile for modules in src/modules.
-# Generated by src/Configure according to rules in src/Configuration;
-# hand-edit at your own risk!
-#
-
-SHELL=$SHELL
-EOF
-
-if [ "$RULE_WANTHSREGEX" = "yes" ]; then
- INCLUDES2="-I../../regex"
-fi
-
-echo "INCLUDES2=$INCLUDES2">> modules/Makefile
-echo "MOD_CFLAGS=\$(INCLUDES2) \$(AUX_CFLAGS)">> modules/Makefile
+cat Makefile.config >modules/Makefile
cat << EOF >> modules/Makefile
MODULES=$MODDIRS
+CFLAGS=\$(OPTIM) \$(CFLAGS1) \$(EXTRA_CFLAGS)
default: all
all clean ::
for i in \$(MODULES); do \\
(cd \$\$i; \\
- \$(MAKE) CC='\$(CC)' AUX_CFLAGS='\$(MOD_CFLAGS)' RANLIB='\$(RANLIB)'
\$@) || exit 1;\\
+ \$(MAKE) CC='\$(CC)' AUX_CFLAGS='\$(CFLAGS)' RANLIB='\$(RANLIB)' \$@)
|| exit 1;\\
done
EOF
@@ -1023,26 +1022,32 @@
echo "Creating Makefile in $moddir"
cat Makefile.config > $moddir/Makefile
- basedir=`echo $moddir | sed 's/^[^/]*\///g'`
- awk >> $moddir/Makefile < $tmpfile '
- BEGIN {
- printf "OBJS="
- }
- ($1 == "Module" && $3 ~ /^modules\/'$basedir'\//) {
- split ($3, pp, "/")
- printf "%s ", pp[3]
- }
- END {
- printf "\n"
- }'
-
- echo "LIB=lib$basedir.a" >> $moddir/Makefile
cat << 'EOF' >> $moddir/Makefile
CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
LIBS=$(EXTRA_LIBS) $(LIBS1)
-INCLUDES=$(INCLUDES1) $(EXTRA_INCLUDES)
+INCLUDES=$(INCLUDES1) $(INCLUDES_DEPTH2) $(EXTRA_INCLUDES)
LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
INCDIR=../../main
+EOF
+ if [ -f $moddir/Makefile.libdir ]; then
+ # it's responsible for the rest of its Makefile
+ :
+ else
+ basedir=`echo $moddir | sed 's/^[^/]*\///g'`
+ awk >> $moddir/Makefile < $tmpfile '
+ BEGIN {
+ printf "OBJS="
+ }
+ ($1 == "Module" && $3 ~ /^modules\/'$basedir'\//) {
+ split ($3, pp, "/")
+ printf "%s ", pp[3]
+ }
+ END {
+ printf "\n"
+ }'
+
+ echo "LIB=lib$basedir.a" >> $moddir/Makefile
+ cat << 'EOF' >> $moddir/Makefile
all: $(LIB)
@@ -1055,12 +1060,12 @@
$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
clean:
- rm -f $(OBJS) $(LIB)
+ rm -f *.o $(LIB)
$(OBJS): Makefile
EOF
-cat >> $moddir/Makefile < $moddir/Makefile.tmpl
-
-done
+ fi
+ cat >> $moddir/Makefile < $moddir/Makefile.tmpl
+done
1.68 +1 -1 apachen/src/Makefile.tmpl
Index: Makefile.tmpl
===================================================================
RCS file: /export/home/cvs/apachen/src/Makefile.tmpl,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- Makefile.tmpl 1997/09/26 03:05:24 1.67
+++ Makefile.tmpl 1997/10/07 19:53:21 1.68
@@ -5,7 +5,7 @@
CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
LIBS=$(EXTRA_LIBS) $(LIBS1)
-INCLUDES=$(INCLUDES1) $(EXTRA_INCLUDES)
+INCLUDES=$(INCLUDES1) $(INCLUDES_DEPTH0) $(EXTRA_INCLUDES)
LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
OBJS= \
1.6 +2 -2 apachen/src/main/Makefile.tmpl
Index: Makefile.tmpl
===================================================================
RCS file: /export/home/cvs/apachen/src/main/Makefile.tmpl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Makefile.tmpl 1997/10/07 19:33:56 1.5
+++ Makefile.tmpl 1997/10/07 19:53:25 1.6
@@ -5,7 +5,7 @@
CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
LIBS=$(EXTRA_LIBS) $(LIBS1)
-INCLUDES=$(INCLUDES1) $(EXTRA_INCLUDES)
+INCLUDES=$(INCLUDES1) $(INCLUDES_DEPTH1) $(EXTRA_INCLUDES)
LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
OBJS= alloc.o http_main.o http_core.o http_config.o http_request.o \
@@ -26,7 +26,7 @@
$(RANLIB) $@
clean:
- rm -f $(OBJS) $(LIB)
+ rm -f *.o $(LIB)
# Work around broken compilers
http_bprintf.o: http_bprintf.c
1.1 apachen/src/modules/example/Makefile.tmpl
Index: Makefile.tmpl
===================================================================
# this is enough to get us a default Makefile
1.1 apachen/src/modules/proxy/Makefile.libdir
Index: Makefile.libdir
===================================================================
This is a place-holder which indicates to Configure that it shouldn't
provide the default targets when building the Makefile in this directory.
Instead it'll just prepend all the important variable definitions, and
copy the Makefile.tmpl onto the end.
1.1 apachen/src/modules/proxy/Makefile.tmpl
Index: Makefile.tmpl
===================================================================
LIB=libproxy.a
OBJS=mod_proxy.o proxy_cache.o proxy_connect.o proxy_ftp.o proxy_http.o \
proxy_util.o
all: $(LIB)
$(LIB): $(OBJS)
rm -f $@
ar cr $@ $(OBJS)
$(RANLIB) $@
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
clean:
rm -f *.o $(LIB)
$(OBJS): Makefile
# dependencies
$(OBJS): mod_proxy.h $(INCDIR)/httpd.h $(INCDIR)/http_config.h
$(INCDIR)/http_protocol.h
proxy_cache.o proxy_connect.o proxy_http.o proxy_util.o: $(INCDIR)/http_main.h
proxy_cache.o proxy_connect.o proxy_http.o: $(INCDIR)/http_log.h
proxy_cache.o proxy_http.o: $(INCDIR)/util_date.h
proxy_cache.o proxy_util.o: $(INCDIR)/md5.h
proxy_ftp.o: $(INCDIR)/http_main.h ../standard/mod_mime.h
1.5 +1 -1 apachen/src/modules/standard/Makefile.tmpl
Index: Makefile.tmpl
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/Makefile.tmpl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Makefile.tmpl 1997/09/16 07:48:42 1.4
+++ Makefile.tmpl 1997/10/07 19:53:31 1.5
@@ -137,7 +137,7 @@
$(INCDIR)/http_core.h $(INCDIR)/http_log.h
mod_speling.o: mod_speling.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
- $(INCDIR)/os.h $(INCDIR)/os-inline.c $(INCDIR)/alloc.h \
+ ../../$(OSDIR)/os.h ../../$(OSDIR)/os-inline.c $(INCDIR)/alloc.h \
$(INCDIR)/buff.h $(INCDIR)/http_config.h $(INCDIR)/http_log.h
mod_status.o: mod_status.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
1.9 +2 -10 apachen/src/os/unix/Makefile.tmpl
Index: Makefile.tmpl
===================================================================
RCS file: /export/home/cvs/apachen/src/os/unix/Makefile.tmpl,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Makefile.tmpl 1997/09/24 21:32:06 1.8
+++ Makefile.tmpl 1997/10/07 19:53:32 1.9
@@ -1,21 +1,14 @@
CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
LIBS=$(EXTRA_LIBS) $(LIBS1)
-INCLUDES=$(INCLUDES1) $(EXTRA_INCLUDES)
+INCLUDES=$(INCLUDES1) $(INCLUDES_DEPTH2) $(EXTRA_INCLUDES)
LFLAGS=$(LFLAGS1) $(EXTRA_LFLAGS)
INCDIR=../../main
OBJS= os.o os-inline.o
-COPY= os.h os-inline.c
LIB= libos.a
-all: $(LIB) copy
-
-copy:
- for i in $(COPY); do \
- rm -f $(INCDIR)/$$i ;\
- ln -s `pwd`/$$i $(INCDIR)/$$i ;\
- done
+all: $(LIB)
$(LIB): $(OBJS)
rm -f $@
@@ -26,7 +19,6 @@
$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
clean:
- for i in $(COPY); do rm -f $(INCDIR)/$$i ; done
rm -f $(OBJS) $(LIB)
$(OBJS): Makefile