You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Paul Sutton <pc...@hyperreal.org> on 1997/09/03 10:30:09 UTC

cvs commit: apachen/src/os/unix Makefile.tmpl

pcs         97/09/03 01:30:08

  Modified:    src      Configure Makefile.tmpl
               src/main Makefile.tmpl
               src/os/unix Makefile.tmpl
  Log:
  Build sub-directories into libraries. Do not use object dependencies in
  src/Makefile. Make clean propagated to all sub-dirs.
  
  Revision  Changes    Path
  1.145     +49 -18    apachen/src/Configure
  
  Index: Configure
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/Configure,v
  retrieving revision 1.144
  retrieving revision 1.145
  diff -u -r1.144 -r1.145
  --- Configure	1997/08/28 01:36:57	1.144
  +++ Configure	1997/09/03 08:30:04	1.145
  @@ -836,19 +836,46 @@
   	 print "};"; \
      }'
   
  -# Add the module targets to the Makefile
  +# figure out which module dir require use to autocreate a Makefile.
  +# for these dirs we must not list the object files from the AddModule
  +# lines individually since the auto-generated Makefile will create
  +# a library called libMODDIR.a for it (MODDIR is the module dir
  +# name). We create two variable here:
  +#
  +#   AUTODIRS   Space separated list of module directories, relative to
  +#              src
  +#   AUTOLIBS   Space separated list of auto-generated library files
  +
  +for moddir in $MODDIRS 
  +do
  +	if [ -f modules/$moddir/Makefile.tmpl ] ; then
  +		AUTODIRS="$AUTODIRS modules/$moddir"
  +		AUTOLIBS="$AUTOLIBS modules/$moddir/lib$moddir.a"
  +	fi
  +done
   
  -awk >>Makefile <$tmpfile '\
  +# Add the module targets to the Makefile. Do not add inidividual object
  +# targets for auto-generated directories.
  +awk -v AUTODIRS="$AUTODIRS" >>Makefile <$tmpfile '\
  +   BEGIN { split ( AUTODIRS, tmp, / /); \
  +		for ( key in tmp ) { autodirs[tmp[key]] = 1; } } \
      /^Module/ { modules[n++] = $3 } \
      /^%Module/ { modules[n++] = $3 } \
  -   END { print "MODULES=\\"; \
  +   END { print "MODULES=\\";  \
   	 for (i = 0; i < n; ++i) { \
  -	     if (i < n-1) printf ("  %s \\\n", modules[i]); \
  -	     else printf ("  %s\n", modules[i]); \
  +	     split ( modules[i], pp, /\//); \
  +	     dir = pp[1] "/" pp[2] ; \
  +	     if ( dir in autodirs ) { continue; }\
  +	     else printf ("  %s\\\n", modules[i]); \
   	 } \
  -	 print "" \
          }'
   
  +# Now add the auto-generated library targets
  +for lib in $AUTOLIBS; do
  +	echo "  $lib \\" >> Makefile
  +done
  +echo >> Makefile
  +
   ####################################################################
   # Continue building Makefile.config.
   #
  @@ -951,39 +978,43 @@
   done
   ) >> modules/Makefile
   
  -for moddir in $MODDIRS ; do
  -	if [ ! -f modules/$moddir/Makefile.tmpl ] ; then
  -		continue
  -	fi
  -	echo "Creating Makefile in modules/$moddir"
  +for moddir in $AUTODIRS ; do
  +	echo "Creating Makefile in $moddir"
   
  -	cat Makefile.config > modules/$moddir/Makefile
  -	awk >> modules/$moddir/Makefile < $tmpfile '\
  +	cat Makefile.config > $moddir/Makefile
  +	basedir=`echo $moddir | sed 's|^[^/]*/||g'`
  +	awk >> $moddir/Makefile < $tmpfile '\
   	    BEGIN { printf "OBJS=" }\
  -	    ($1 == "Module" && $3 ~ /^modules\/'$moddir'\//) { \
  +	    ($1 == "Module" && $3 ~ /^modules\/'$basedir'\//) { \
   		split ($3, pp, "/"); \
   		printf "%s ", pp[3]; \
   	    	} \
   	   END {printf "\n"}'
   
  -	cat << 'EOF' >> modules/$moddir/Makefile
  +	echo "LIB=lib$basedir.a" >> $moddir/Makefile
  +	cat << 'EOF' >> $moddir/Makefile
   CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
   LIBS=$(EXTRA_LIBS) $(LIBS1)
   INCLUDES=$(INCLUDES1) $(EXTRA_INCLUDES)
   LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
   INCDIR=../../main
   
  -all:	$(OBJS)
  +all:	$(LIB)
  +
  +$(LIB): $(OBJS)
  +	rm -f $@
  +	ar crv $@ $(OBJS)
  +	$(RANLIB) $@
   
   .c.o:
   	$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
   
   clean:
  -	rm -f $(OBJS)
  +	rm -f $(OBJS) $(LIB)
   
   $(OBJS): Makefile
   EOF
  -cat >> modules/$moddir/Makefile < modules/$moddir/Makefile.tmpl
  +cat >> $moddir/Makefile < $moddir/Makefile.tmpl
   
   done
   
  
  
  
  1.61      +16 -25    apachen/src/Makefile.tmpl
  
  Index: Makefile.tmpl
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/Makefile.tmpl,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- Makefile.tmpl	1997/08/25 02:19:49	1.60
  +++ Makefile.tmpl	1997/09/03 08:30:04	1.61
  @@ -9,20 +9,17 @@
   LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
   
   OBJS= \
  -  main/alloc.o main/http_main.o main/http_core.o \
  -  main/http_config.o main/http_request.o main/http_log.o \
  -  main/http_protocol.o main/rfc1413.o main/util.o \
  -  main/util_script.o main/buff.o main/md5c.o \
  -  main/util_md5.o main/explain.o main/http_bprintf.o \
  -  main/util_date.o main/util_snprintf.o main/fnmatch.o \
     modules.o \
  -  $(OSOBJ) \
  -  $(MODULES)
  +  $(MODULES) \
  +  $(OSDIR)/libos.a \
  +  main/libmain.a
  +
  +SUBDIRS=main $(OSDIR) modules
   
   .c.o:
   	$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
   
  -all: @@Configuration@@ os-dir core-dir modules/last-built httpd 
  +all: @@Configuration@@ httpd
   
   @@Configuration@@: Configuration.tmpl
   	@echo "@@Configuration@@ older than Configuration.tmpl, or doesn't exist."
  @@ -31,36 +28,30 @@
   	@echo "If not, you will at least have to touch @@Configuration@@."
   	@false
   
  -httpd: $(REGLIB) $(OBJS)
  +httpd: $(REGLIB) modules.o subdirs
   	rm -f buildmark.c
   	echo 'const char SERVER_BUILT[] = "'`/bin/date`'";' > buildmark.c
   	$(CC) -c $(CFLAGS) buildmark.c
   	$(CC) $(LDFLAGS)  -o httpd buildmark.o $(OBJS) $(REGLIB) $(LIBS)
   
  -regex/libregex.a:
  -	(cd regex; $(MAKE) lib CC='$(CC)' AUX_CFLAGS='$(CFLAGS)' RANLIB='$(RANLIB)')
  +subdirs:
  +	for i in $(SUBDIRS); do \
  +		( cd $$i; $(MAKE) CC='$(CC)' AUX_CFLAGS='$(CFLAGS)' RANLIB='$(RANLIB)') \
  +	done
   
  -modules/last-built:
  -	(cd modules; \
  -	$(MAKE) CC='$(CC)' AUX_CFLAGS='$(CFLAGS)' RANLIB='$(RANLIB)')
  +$(REGLIB):
  +	(cd regex; $(MAKE) lib CC='$(CC)' AUX_CFLAGS='$(CFLAGS)' RANLIB='$(RANLIB)')
   
   support: support-dir
   
   support-dir:
   	cd support; $(MAKE) CC='$(CC)' AUX_CFLAGS='$(CFLAGS)' RANLIB='$(RANLIB)'
   
  -core-dir:
  -	cd main; $(MAKE) CC='$(CC)' AUX_CFLAGS='$(CFLAGS)' RANLIB='$(RANLIB)'
  -
  -os-dir:	
  -	cd $(OSDIR); $(MAKE) CC='$(CC)' AUX_CFLAGS='$(CFLAGS)' RANLIB='$(RANLIB)'
  -
   clean:
   	rm -f httpd *.o $(OBJS) 
  -	cd main; $(MAKE) clean
  -	cd regex; $(MAKE) clean
  -	cd modules; $(MAKE) clean
  -	cd support; $(MAKE) clean
  +	for i in $(SUBDIRS) regex; do \
  +		( cd $$i; $(MAKE) $@ ) \
  +	done
   
   dist.tar: 
   	# Assure a semi-sensible configuration going out...
  
  
  
  1.3       +9 -2      apachen/src/main/Makefile.tmpl
  
  Index: Makefile.tmpl
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/Makefile.tmpl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Makefile.tmpl	1997/08/13 09:28:46	1.2
  +++ Makefile.tmpl	1997/09/03 08:30:06	1.3
  @@ -16,10 +16,17 @@
   .c.o:
   	$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
   
  -all: $(OBJS)
  +LIB=	libmain.a
  +
  +all: $(LIB)
  +
  +$(LIB): $(OBJS)
  +	rm -f $@
  +	ar crv $@ $(OBJS)
  +	$(RANLIB) $@
   
   clean:
  -	rm -f $(OBJS) 
  +	rm -f $(OBJS) $(LIB)
   
   # Work around broken compilers
   http_bprintf.o: http_bprintf.c
  
  
  
  1.3       +10 -1     apachen/src/os/unix/Makefile.tmpl
  
  Index: Makefile.tmpl
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/os/unix/Makefile.tmpl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Makefile.tmpl	1997/08/23 22:25:26	1.2
  +++ Makefile.tmpl	1997/09/03 08:30:07	1.3
  @@ -6,13 +6,22 @@
   
   OBJS=	os.o
   
  -all:	$(OBJS)
  +LIB=	libos.a
  +
  +all: $(LIB) 
  +
  +$(LIB): $(OBJS)
  +	rm -f $@
  +	ar crv $@ $(OBJS)
  +	$(RANLIB) $@
   
   .c.o:
   	$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
   
   clean:
   	rm -f $(OBJS)
  +
  +$(OBJS): Makefile
   
   # DO NOT REMOVE
   os.o:	os.c