From 62367507a993a6e5b77deb2d763fbe51f6463ca4 Mon Sep 17 00:00:00 2001 From: "Roy T. Fielding" Date: Fri, 18 May 2001 00:48:57 +0000 Subject: [PATCH] Change the make targets and rules to be consistent in all of the Apache-owned source trees. Sanity is a good thing. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89140 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 + Makefile.in | 13 +-- acinclude.m4 | 3 + build/ltlib.mk | 2 +- build/rules.mk | 237 ++++++++++++++++++++++++-------------------- build/special.mk | 12 +-- configure.in | 2 +- modules/Makefile.in | 1 + server/Makefile.in | 2 +- support/Makefile.in | 2 +- test/Makefile.in | 2 +- 11 files changed, 152 insertions(+), 127 deletions(-) diff --git a/CHANGES b/CHANGES index 605455cdff..1a45636cf2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 2.0.18-dev + *) Change the make targets and rules to be consistent in all of the + Apache-owned source trees. [Roy Fielding] + *) Fix processing of the TRACE method. Previously we passed bogus parms to form_header_field() and it overlaid some vhost structures, resulting in a segfault in check_hostalias(). diff --git a/Makefile.in b/Makefile.in index 59673a0cc5..36740313ea 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,6 @@ SUBDIRS = srclib os server modules support +CLEAN_SUBDIRS = test PROGRAM_NAME = $(progname) PROGRAM_SOURCES = modules.c @@ -13,14 +14,14 @@ PROGRAM_DEPENDENCIES = \ $(AP_LIBS) PROGRAMS = $(PROGRAM_NAME) -targets = $(PROGRAMS) $(shared_build) $(other_targets) -phony_targets = $(srcdir)/buildmark.c -install_targets = install-conf install-htdocs install-icons install-other \ +TARGETS = $(PROGRAMS) $(shared_build) $(other_targets) +PHONY_TARGETS = $(srcdir)/buildmark.c +INSTALL_TARGETS = install-conf install-htdocs install-icons install-other \ install-cgi install-include install-suexec + DISTCLEAN_TARGETS = include/ap_config_auto.h include/ap_config_path.h \ - modules.c libtool -EXTRACLEAN_TARGETS = configure include/ap_config_auto.h.in \ - generated_lists + modules.c config.cache config.log config.status config_vars.mk +EXTRACLEAN_TARGETS = configure include/ap_config_auto.h.in generated_lists include $(top_srcdir)/build/rules.mk include $(top_srcdir)/build/program.mk diff --git a/acinclude.m4 b/acinclude.m4 index ee96803052..bf71ff8d08 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -76,6 +76,7 @@ AC_DEFUN(APACHE_GEN_CONFIG_VARS,[ APACHE_SUBST(LIBTOOL) APACHE_SUBST(SHELL) APACHE_SUBST(MODULE_DIRS) + APACHE_SUBST(MODULE_CLEANDIRS) APACHE_SUBST(PORT) APACHE_SUBST(CORE_IMPLIB_FILE) APACHE_SUBST(CORE_IMPLIB) @@ -144,6 +145,8 @@ AC_DEFUN(APACHE_MODPATH_FINISH,[ echo "shared = $modpath_shared" >> $modpath_current/modules.mk if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then MODULE_DIRS="$MODULE_DIRS $current_dir" + else + MODULE_CLEANDIRS="$MODULE_CLEANDIRS $current_dir" fi APACHE_FAST_OUTPUT($modpath_current/Makefile) ])dnl diff --git a/build/ltlib.mk b/build/ltlib.mk index 9b89d9c309..d9b8e4e242 100644 --- a/build/ltlib.mk +++ b/build/ltlib.mk @@ -54,7 +54,7 @@ # The build environment was provided by Sascha Schumann. # -targets = $(LTLIBRARY_NAME) +TARGETS = $(LTLIBRARY_NAME) include $(top_srcdir)/build/rules.mk include $(top_srcdir)/build/library.mk diff --git a/build/rules.mk b/build/rules.mk index f050bbc89a..c7ef27312c 100644 --- a/build/rules.mk +++ b/build/rules.mk @@ -51,7 +51,7 @@ # information on the Apache Software Foundation, please see # . # -# The build environment was provided by Sascha Schumann. +# The build environment was originally provided by Sascha Schumann. # include $(top_builddir)/config_vars.mk @@ -94,8 +94,122 @@ INSTALL = $(abs_srcdir)/build/install.sh -c INSTALL_DATA = $(INSTALL) -m 644 INSTALL_PROGRAM = $(INSTALL) -m 755 $(INSTALL_PROG_FLAGS) -# Suffixes +# +# Standard build rules +# +all: all-recursive +depend: depend-recursive +clean: clean-recursive +distclean: distclean-recursive +extraclean: extraclean-recursive + +install: all-recursive local-install +shared-build: shared-build-recursive + +all-recursive depend-recursive: + @otarget=`echo $@|sed s/-recursive//`; \ + list='$(SUBDIRS)'; \ + for i in $$list; do \ + if test -d "$$i"; then \ + target="$$otarget"; \ + echo "Making $$target in $$i"; \ + if test "$$i" = "."; then \ + made_local=yes; \ + target="local-$$target"; \ + fi; \ + (cd $$i && $(MAKE) $$target) || exit 1; \ + fi; \ + done; \ + if test "$$otarget" = "all" && test -z '$(TARGETS)'; then \ + made_local=yes; \ + fi; \ + if test "$$made_local" != "yes"; then \ + $(MAKE) "local-$$otarget" || exit 1; \ + fi + +clean-recursive distclean-recursive extraclean-recursive: + @otarget=`echo $@|sed s/-recursive//`; \ + list='$(SUBDIRS) $(CLEAN_SUBDIRS)'; \ + for i in $$list; do \ + if test -d "$$i"; then \ + target="$$otarget"; \ + echo "Making $$target in $$i"; \ + if test "$$i" = "."; then \ + made_local=yes; \ + target="local-$$target"; \ + fi; \ + (cd $$i && $(MAKE) $$target); \ + fi; \ + done; \ + if test "$$otarget" = "all" && test -z '$(TARGETS)'; then \ + made_local=yes; \ + fi; \ + if test "$$made_local" != "yes"; then \ + $(MAKE) "local-$$otarget"; \ + fi + +shared-build-recursive: + @if test `pwd` = "$(top_builddir)"; then \ + $(PRE_SHARED_CMDS) ; \ + fi; \ + list='$(SUBDIRS)'; for i in $$list; do \ + target="shared-build"; \ + if test "$$i" = "."; then \ + made_local=yes; \ + target="local-shared-build"; \ + fi; \ + if test "$$i" != "srclib"; then \ + (cd $$i && $(MAKE) $$target) || exit 1; \ + fi; \ + done; \ + if test -f 'modules.mk'; then \ + if test -n '$(SHARED_TARGETS)'; then \ + echo "Building shared: $(SHARED_TARGETS)"; \ + if test "$$made_local" != "yes"; then \ + $(MAKE) "local-shared-build" || exit 1; \ + fi; \ + fi; \ + fi; \ + if test `pwd` = "$(top_builddir)"; then \ + $(POST_SHARED_CMDS) ; \ + fi + +local-all: $(TARGETS) + +local-shared-build: $(SHARED_TARGETS) + +local-depend: x-local-depend + if test "`echo $(srcdir)/*.c`" != "$(srcdir)'/*.c'"; then \ + $(CC) -MM $(ALL_CPPFLAGS) $(ALL_INCLUDES) $(srcdir)/*.c | sed 's/\.o:/.lo:/' > $(builddir)/.deps || true; \ + fi + +local-clean: x-local-clean + rm -f *.o *.lo *.slo *.obj *.a *.la $(CLEAN_TARGETS) $(TARGETS) + rm -rf .libs + +local-distclean: local-clean x-local-distclean + rm -f .deps Makefile $(DISTCLEAN_TARGETS) + +local-extraclean: local-distclean x-local-extraclean + @if test -n "$(EXTRACLEAN_TARGETS)"; then \ + echo "rm -f $(EXTRACLEAN_TARGETS)"; \ + rm -f $(EXTRACLEAN_TARGETS) ; \ + fi + +local-install: $(TARGETS) $(SHARED_TARGETS) $(INSTALL_TARGETS) + @if test -n '$(PROGRAMS)'; then \ + test -d $(bindir) || $(MKINSTALLDIRS) $(bindir); \ + list='$(PROGRAMS)'; for i in $$list; do \ + $(INSTALL_PROGRAM) $$i $(bindir); \ + done; \ + fi +# to be filled in by the actual Makefile if extra commands are needed +x-local-depend x-local-clean x-local-distclean x-local-extraclean: + +# +# Implicit rules for creating outputs from input files +# CXX_SUFFIX = cpp SHLIB_SUFFIX = so @@ -132,117 +246,20 @@ SHLIB_SUFFIX = so .l.c: $(LEX) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@ - -all: all-recursive -shared-modules: shared-modules-recursive -install: install-recursive - - # Makes an import library from a def file .def.la: $(LIBTOOL) --mode=compile $(MK_IMPLIB) -o $@ $< - -# if we are doing a distclean, we actually want to hit every -# directory that has ever been configured. To do this, we just do a quick -# find for all the leftover Makefiles, and then run make distclean in those -# directories. -# Exception: Skip APR directories (other than the base APR directory), -# because APR knows how to do these tasks better than we do. -distclean-recursive clean-recursive depend-recursive all-recursive install-recursive: - @otarget=`echo $@|sed s/-recursive//`; \ - list='$(SUBDIRS)'; for i in $$list; do \ - target="$$otarget"; \ - echo "Making $$target in $$i"; \ - if test "$$i" = "."; then \ - ok=yes; \ - target="$$target-p"; \ - fi; \ - (cd $$i && $(MAKE) $$target) || exit 1; \ - done; \ - if test "$$otarget" = "all" && test -z '$(targets)'; then ok=yes; fi;\ - if test "$$ok" != "yes"; then $(MAKE) "$$otarget-p" || exit 1; fi; \ - if test "$$otarget" = "distclean" ; then\ - for d in `find . -name Makefile`; do \ - i=`dirname "$$d"`; \ - target="$$otarget"; \ - in_apr=`echo $$i|sed 's%^.*apr/.*$$%ignore_apr_subdirs%'`; \ - in_apr=`echo $$in_apr|sed 's%^.*apr-util/.*$$%ignore_apr_subdirs%'`; \ - if test "x$$in_apr" != "xignore_apr_subdirs"; then \ - echo "Making $$target in $$i"; \ - if test "$$i" = "."; then \ - ok=yes; \ - target="$$target-p"; \ - fi; \ - (cd $$i && $(MAKE) $$target) || exit 1; \ - fi; \ - done; \ - fi - -shared-modules-recursive: - @if test `pwd` = "$(top_builddir)"; then \ - $(PRE_SHARED_CMDS) ; \ - fi; \ - list='$(SUBDIRS)'; for i in $$list; do \ - target="shared-modules"; \ - if test "$$i" = "."; then \ - ok = yes; \ - target="shared-modules-p"; \ - fi; \ - if test "$$i" != "srclib"; then \ - (cd $$i && $(MAKE) $$target) || exit 1; \ - fi; \ - done; \ - if test -f 'modules.mk'; then \ - if test -n '$(shared_targets)'; then \ - echo "Building shared modules: $(shared_targets)"; \ - if test -z '$(shared_targets)'; then ok=yes; fi; \ - if test "$$ok" != "yes"; then \ - $(MAKE) "shared-modules-p" || exit 1; \ - fi; \ - fi; \ - fi; \ - if test `pwd` = "$(top_builddir)"; then \ - $(POST_SHARED_CMDS) ; \ - fi - -all-p: $(targets) -shared-modules-p: $(shared_targets) - -install-p: $(targets) $(shared_targets) $(install_targets) - @if test -n '$(PROGRAMS)'; then \ - test -d $(bindir) || $(MKINSTALLDIRS) $(bindir); \ - for i in $(PROGRAMS) ""; do \ - if test "x$$i" != "x"; then \ - $(INSTALL_PROGRAM) $$i $(bindir); \ - fi; \ - done; \ - fi - -distclean-p depend-p clean-p: - -depend: depend-recursive - if test "`echo $(srcdir)/*.c`" != "$(srcdir)'/*.c'"; then \ - $(CC) -MM $(ALL_CPPFLAGS) $(ALL_INCLUDES) $(srcdir)/*.c | sed 's/\.o:/.lo:/' > $(builddir)/.deps || true; \ - fi -# test "`echo *.c`" = '*.c' || perl $(top_srcdir)/build/mkdep.perl $(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) *.c > .deps - -clean: clean-recursive clean-x - -clean-x: - rm -f $(targets) *.slo *.lo *.la *.o *.obj $(CLEAN_TARGETS) - rm -rf .libs - -distclean: distclean-recursive clean-x - rm -f config.cache config.log config.status config_vars.mk \ - stamp-h Makefile shlibtool .deps $(DISTCLEAN_TARGETS) - -extraclean: distclean - rm -f $(EXTRACLEAN_TARGETS) - +# +# Dependencies +# include $(builddir)/.deps -.PHONY: all-recursive clean-recursive install-recursive \ -$(install_targets) install all clean depend depend-recursive shared \ -distclean-recursive distclean clean-x all-p install-p distclean-p \ -depend-p clean-p $(phony_targets) +.PHONY: all all-recursive local-all $(PHONY_TARGETS) \ + shared-build shared-build-recursive local-shared-build \ + depend depend-recursive local-depend x-local-depend \ + clean clean-recursive local-clean x-local-clean \ + distclean distclean-recursive local-distclean x-local-distclean \ + extraclean extraclean-recursive local-extraclean x-local-extraclean \ + install local-install $(INSTALL_TARGETS) + diff --git a/build/special.mk b/build/special.mk index ef0b47ee0a..3d974f1a72 100644 --- a/build/special.mk +++ b/build/special.mk @@ -57,17 +57,17 @@ all: all-recursive include $(builddir)/modules.mk -targets = $(static) -shared_targets = $(shared) -install_targets = install-modules +TARGETS = $(static) +SHARED_TARGETS = $(shared) +INSTALL_TARGETS = install-modules install-modules: - @shared='$(shared)'; \ - builtin='$(BUILTIN_LIBS)'; \ + @builtin='$(BUILTIN_LIBS)'; \ has_mod_so=`echo $$builtin|sed 's/^.*mod_so.*$$/has_mod_so/'`; \ if [ "x$$has_mod_so" = "xhas_mod_so" ]; then \ $(MKINSTALLDIRS) $(libexecdir); \ - for i in $$shared; do \ + @list='$(shared)'; \ + for i in $$list; do \ $(SH_LIBTOOL) --mode=install cp $$i $(libexecdir); \ done; \ fi diff --git a/configure.in b/configure.in index 6a71e01f97..3f158b9af4 100644 --- a/configure.in +++ b/configure.in @@ -246,7 +246,7 @@ if test "$apache_need_shared" = "yes"; then HTTPD_LDFLAGS="$HTTPD_LDFLAGS --main=$abs_srcdir/server/main.o --core-dll=$abs_srcdir/apachecore.dll" SH_LDFLAGS="$SH_LDFLAGS --core-dll=$abs_srcdir/apachecore.dll" esac - shared_build="shared-modules" + shared_build="shared-build" fi APACHE_SUBST(PRE_SHARED_CMDS) diff --git a/modules/Makefile.in b/modules/Makefile.in index ecb043547b..79d278248f 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -1,5 +1,6 @@ SUBDIRS = $(MODULE_DIRS) +CLEAN_SUBDIRS = $(MODULE_CLEANDIRS) include $(top_srcdir)/build/rules.mk diff --git a/server/Makefile.in b/server/Makefile.in index 24aef10277..c7d5451601 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -16,7 +16,7 @@ LTLIBRARY_SOURCES = \ util_filter.c exports.c buildmark.c scoreboard.c \ error_bucket.c protocol.c core.c request.c -targets = delete-exports $(LTLIBRARY_NAME) $(CORE_IMPLIB_FILE) +TARGETS = delete-exports $(LTLIBRARY_NAME) $(CORE_IMPLIB_FILE) include $(top_srcdir)/build/rules.mk include $(top_srcdir)/build/library.mk diff --git a/support/Makefile.in b/support/Makefile.in index ff5f6a4e26..70f287b9e7 100644 --- a/support/Makefile.in +++ b/support/Makefile.in @@ -2,7 +2,7 @@ DISTCLEAN_TARGETS = apxs apachectl dbmmanage log_server_status logresolve.pl \ phf_abuse_log.cgi split-logfile PROGRAMS = htpasswd htdigest rotatelogs logresolve ab -targets = $(PROGRAMS) +TARGETS = $(PROGRAMS) PROGRAM_LDADD = $(EXTRA_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS) PROGRAM_DEPENDENCIES = \ diff --git a/test/Makefile.in b/test/Makefile.in index 1426e44c95..7d0a9b0ace 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,7 +1,7 @@ # no targets: we don't want to build anything by default. if you want the # test programs, then "make test" -targets = +TARGETS = PROGRAMS = -- 2.40.0