You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/10/07 10:30:01 UTC
[PATCH] yet more Configure/Makefile wrangling
hyperreal won't let me do a cvs diff right now... so the patch below may
not be entirely complete.
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.
Now I can "./Configure; make clean; make -j3 MAKE='make -j3'" and don't
get any annoyances due to the os.h files. And I can type "make" in any
subdirectory (except os, which has no Makefile) and it does the right
thing (this was broken in the proxy and example directories before).
Dean
diff -N -r -u -x CVS -x *.bak -x *.o -x *.a apachen3/src/Configure apachen2/src/Configure
--- apachen3/src/Configure Wed Oct 1 22:25:25 1997
+++ apachen2/src/Configure Tue Oct 7 01:15:34 1997
@@ -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 apache-bugs@apache.org. 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
diff -N -r -u -x CVS -x *.bak -x *.o -x *.a apachen3/src/Makefile.tmpl apachen2/src/Makefile.tmpl
--- apachen3/src/Makefile.tmpl Thu Sep 25 20:55:01 1997
+++ apachen2/src/Makefile.tmpl Mon Oct 6 23:51:56 1997
@@ -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= \
diff -N -r -u -x CVS -x *.bak -x *.o -x *.a apachen3/src/main/Makefile.tmpl apachen2/src/main/Makefile.tmpl
--- apachen3/src/main/Makefile.tmpl Thu Sep 11 10:15:13 1997
+++ apachen2/src/main/Makefile.tmpl Tue Oct 7 00:54:32 1997
@@ -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
diff -N -r -u -x CVS -x *.bak -x *.o -x *.a apachen3/src/modules/example/Makefile.tmpl apachen2/src/modules/example/Makefile.tmpl
--- apachen3/src/modules/example/Makefile.tmpl Wed Dec 31 16:00:00 1969
+++ apachen2/src/modules/example/Makefile.tmpl Tue Oct 7 01:17:22 1997
@@ -0,0 +1 @@
+# this is enough to get us a default Makefile
diff -N -r -u -x CVS -x *.bak -x *.o -x *.a apachen3/src/modules/proxy/Makefile.libdir apachen2/src/modules/proxy/Makefile.libdir
--- apachen3/src/modules/proxy/Makefile.libdir Wed Dec 31 16:00:00 1969
+++ apachen2/src/modules/proxy/Makefile.libdir Tue Oct 7 01:21:23 1997
@@ -0,0 +1,4 @@
+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.
diff -N -r -u -x CVS -x *.bak -x *.o -x *.a apachen3/src/modules/proxy/Makefile.tmpl apachen2/src/modules/proxy/Makefile.tmpl
--- apachen3/src/modules/proxy/Makefile.tmpl Wed Dec 31 16:00:00 1969
+++ apachen2/src/modules/proxy/Makefile.tmpl Tue Oct 7 00:00:49 1997
@@ -0,0 +1,26 @@
+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
diff -N -r -u -x CVS -x *.bak -x *.o -x *.a apachen3/src/modules/standard/Makefile.tmpl apachen2/src/modules/standard/Makefile.tmpl
--- apachen3/src/modules/standard/Makefile.tmpl Mon Sep 22 14:26:00 1997
+++ apachen2/src/modules/standard/Makefile.tmpl Tue Oct 7 00:27:25 1997
@@ -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 \
diff -N -r -u -x CVS -x *.bak -x *.o -x *.a apachen3/src/os/unix/Makefile.tmpl apachen2/src/os/unix/Makefile.tmpl
--- apachen3/src/os/unix/Makefile.tmpl Thu Sep 25 01:34:37 1997
+++ apachen2/src/os/unix/Makefile.tmpl Tue Oct 7 01:22:17 1997
@@ -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
Re: [PATCH] yet more Configure/Makefile wrangling
Posted by Martin Kraemer <Ma...@mch.sni.de>.
In the src/Makefile, a dependency is generated to depend Configuration
on Configuration.tmpl . Wouldn't it be useful to print a warning when
Configuration has been modified more recently than Makefile? This will
warn the user when she has modified Configuration but forgot to call
Configure afterwards.
Just a thought,
Martin
--
| S I E M E N S | <Ma...@mch.sni.de> | Siemens Nixdorf
| ------------- | Voice: +49-89-636-46021 | Informationssysteme AG
| N I X D O R F | FAX: +49-89-636-44994 | 81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request
Re: [PATCH] yet more Configure/Makefile wrangling
Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Tue, Oct 07, 1997 at 02:30:01AM -0700, Dean Gaudet wrote:
> And I can type "make" in any
> subdirectory (except os, which has no Makefile) and it does the right
> thing
Just Tested: Works like a charm! +1
Very good, I didn't like the absolute -I<path>s either.
Martin
--
| S I E M E N S | <Ma...@mch.sni.de> | Siemens Nixdorf
| ------------- | Voice: +49-89-636-46021 | Informationssysteme AG
| N I X D O R F | FAX: +49-89-636-44994 | 81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request