From: <sg...@us...> - 2003-09-01 04:58:26
|
Update of /cvsroot/libfunutil/libfunutil/toc/make In directory sc8-pr-cvs1:/tmp/cvs-serv983/toc/make Modified Files: install.make Log Message: quoting-related fixes. Index: install.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/install.make,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- install.make 31 Aug 2003 21:34:36 -0000 1.23 +++ install.make 1 Sep 2003 04:58:22 -0000 1.24 @@ -48,15 +48,16 @@ # This whole echo/grep thing is to force it to work on some of my # older machines where more sane approaches don't seem to work. -TOC_MAKE_INSTALL_GREP_KLUDGE = test $(shell echo $(1) "" | grep -q '[a-zA-Z0-9]'; echo $$?) = 0 || exit 0 +# TOC_MAKE_INSTALL_GREP_KLUDGE = test $(shell echo $(1) "" | grep -q '[a-zA-Z0-9]'; echo $$?) = 0 || exit 0 +TOC_MAKE_INSTALL_GREP_KLUDGE = # toc_make_install call()able: # $1=file list # $2=destdir # $3=flags for $(INSTALLER_BIN) -toc_make_install = $(call TOC_MAKE_INSTALL_GREP_KLUDGE,$(1)); \ +toc_make_install = test "x$(1)" = x && exit 0; \ test -d $(2) || mkdir -p $(2) || exit; \ - for b in $(1) ""; do test -z "$$b" && continue; \ + for b in $(1) "x"; do test "x$$b" = "xx" && break; \ b=$$(basename $$b); \ target=$(2)/$$b; \ cmd="$(INSTALLER_BIN) $(3) $$b $$target"; echo $$cmd; $$cmd || exit; \ @@ -64,18 +65,18 @@ # toc_make_install_update: identical to toc_make_install # but does not update the target if it is the same as the source. -toc_make_install_update = $(call TOC_MAKE_INSTALL_GREP_KLUDGE,$(1)); \ +toc_make_install_update = test "x$(1)" = x && exit 0; \ test -d $(2) || mkdir -p $(2) || exit; \ for b in $(1) ""; do test -z "$$b" && continue; \ - b=$$(basename $$b); \ - target=$(2)/$$b; \ - cmp $$target $$b > /dev/null 2>&1 && continue; \ - cmd="$(INSTALLER_BIN) $(3) $$b $$target"; echo $$cmd; $$cmd || exit; \ + b="$$(basename $$b)"; \ + target="$(2)/$$b"; \ + cmp "$$target" "$$b" > /dev/null 2>&1 && continue; \ + cmd="$(INSTALLER_BIN) $(3) $$b $$target"; echo "$$cmd"; $$cmd || exit; \ done # toc_make_uninstall call()able: # removes all files listed in $(1) from target directory $(2) -toc_make_uninstall = $(call TOC_MAKE_INSTALL_GREP_KLUDGE,$(1)); \ +toc_make_uninstall = test "x$(1)" = x && exit 0; \ test -e "$(2)" || exit 0; \ for b in $(1) ""; do test -z "$$b" && continue; \ fp="$(2)/$$b"; test -e "$$fp" || continue; \ @@ -88,13 +89,15 @@ # Note that symlinks must be linked to absolute paths here, because we cannot # easily/reliably make a relative path from the target directory back to # the install source: -toc_make_install_symlink = $(call TOC_MAKE_INSTALL_GREP_KLUDGE,$(1)); \ +toc_make_install_symlink = test "x$(1)" = x && exit 0; \ test -d $(2) || mkdir -p $(2) || exit; \ for b in $(1) ""; do test -z "$$b" && continue; \ - target=$(2)/$$b; \ - pwd=$$(pwd); \ - test $$target -ef $$b && continue; \ - echo "Symlinking $$target"; ln -s -f $$pwd/$$b $$target || exit $$?; \ + target="$(2)/$$b"; \ + pwd="$$(pwd)"; \ + src="$$pwd/$$b"; \ + test "$$target" -ef "$$src" && continue; \ + test -f "$$target" && rm "$$target"; \ + echo "Symlinking $$target"; ln -s -f "$$src" "$$target" || exit $$?; \ done # toc_make_install_so: installs foo.so.X.Y.Z and symlinks foo.so, foo.so.X and foo.so.X.Y to it, @@ -102,13 +105,13 @@ # $1 = so name (foo.so) # $2-4 = Major, Minor, Patch version numbers # $5 = destination directory -toc_make_install_so = $(call TOC_MAKE_INSTALL_GREP_KLUDGE,$(1)); \ +toc_make_install_so = test "x$(1)" = x && exit 0; \ test -d $(5) || mkdir -p $(5) || exit; \ wholename=$(1).$(2).$(3).$(4); \ target=$(5)/$$wholename; \ test $$wholename -ef $$target || { \ echo "Installing/symlinking $$target"; \ - cmd="$(INSTALLER_BIN) -s $$wholename $$target"; \ + cmd="$(INSTALLER_BIN) -m 0755 $$wholename $$target"; \ $$cmd || exit; \ }; \ cd $(5); \ @@ -127,7 +130,8 @@ INSTALLER_BIN_FLAGS_BINS = -s -m 0755 INSTALLER_BIN_FLAGS_NONBINS = -m 0644 -INSTALLER_BIN_FLAGS_LIBS = -m 0755 +INSTALLER_BIN_FLAGS_LIBS = -m 0644 +INSTALLER_BIN_FLAGS_LIBEXECS = -m 0755 # default install flags for the installable file categories: @@ -135,7 +139,7 @@ INSTALL_SBINS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_BINS) INSTALL_LIBS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_LIBS) INSTALL_PACKAGE_LIBS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_LIBS) -INSTALL_LIBEXECS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_LIBS) +INSTALL_LIBEXECS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_LIBEXECS) INSTALL_HEADERS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_PACKAGE_HEADERS_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) INSTALL_PACKAGE_INSTALL_FLAGS ?= $(INSTALLER_BIN_FLAGS_NONBINS) @@ -152,7 +156,7 @@ # todo? move this into the configure process? $(INSTALL_DEPS_FILE): $(INSTALL_MAKEFILE) $(INSTALL_XXX_GENERATOR) ifneq (,$(strip $(filter clean distclean,$(MAKECMDGOALS)))) - @echo "$(MAKECMDGOALS): skipping INSTALL_XXX rules generation." +# @echo "$(MAKECMDGOALS): skipping INSTALL_XXX rules generation." else @echo "Generating rules for INSTALL_XXX."; \ $(call toc_generate_rules,INSTALL_XXX,\ @@ -160,31 +164,30 @@ SBINS=sbin \ LIBS=lib \ PACKAGE_LIBS='lib/$$(PACKAGE_NAME)' \ - LIBEXECS=libexec \ + LIBEXECS=lib \ HEADERS=include \ PACKAGE_HEADERS='include/$$(PACKAGE_NAME)' \ PACKAGE_DATA='share/$$(PACKAGE_NAME)' \ DOCS='share/doc/$$(PACKAGE_NAME)' \ ) > $@ endif - -include $(INSTALL_DEPS_FILE) -install: $(INSTALL_DEPS_FILE) -.PHONY: install-. uninstall-. deps: $(INSTALL_DEPS_FILE) + +.PHONY: install-. uninstall-. +subdirs-install: # implemented elsewhere install: install-. install-subdirs -install-update: install-subdirs-update -install-subdirs: - @$(call toc_make_subdirs,$(SUBDIRS),install) -install-subdirs-symlink: - @$(call toc_make_subdirs,$(SUBDIRS),install-symlink) -install-subdirs-update: - @$(call toc_make_subdirs,$(SUBDIRS),install-update) -uninstall-subdirs: - @$(call toc_make_subdirs,$(SUBDIRS),uninstall) +install-update: install-.-update install-subdirs-update +install-symlink: install-.-symlink install-subdirs-symlink +install-subdirs: subdirs-install +install-subdirs-symlink: subdirs-install-symlink +install-subdirs-update: subdirs-install-update +uninstall-subdirs: subdirs-uninstall uninstall: uninstall-. uninstall-subdirs -# implement these to hook in to the start of the install: +# implement these to hook in to the start of the install. Untested. :/ install-.: +install-.-update: +install-.-symlink: uninstall-.: |