From f38b71646ad376a8442d49330c8eadb137c2bd06 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Sun, 22 Jul 2007 17:44:27 +0000 Subject: [PATCH] Re-instate the --local configure switch to not install and use the local crosstool-NG copy. --- Makefile.in | 24 ++++++++++++++++-------- configure | 11 +++++++++++ ct-ng.in | 2 +- kconfig/kconfig.mk | 8 +++----- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4940effe..54fe82cd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -12,14 +12,15 @@ LIBDIR := @@LIBDIR@@ DOCDIR := @@DOCDIR@@ MANDIR := @@MANDIR@@ DATE := @@DATE@@ -MAKE := $(shell which make || type -p make || echo /usr/bin/make) +LOCAL := @@LOCAL@@ +MAKE := $(shell which $(MAKE) || type -p $(MAKE) || echo /usr/bin/make) ############################################################################### # Global make rules build: build-bin build-lib build-doc -install: build install-bin install-lib install-doc +install: install-local-test build install-bin install-lib install-doc clean: clean-bin clean-lib clean-doc @@ -66,13 +67,20 @@ clean-doc: #-------------------------------------- # Install rules -install-bin: $(BINDIR) +# If using localy, don't install +install-local-test: + @if [ "$(LOCAL)" = "1" ]; then \ + echo "You're using local copy as runtime. You can't install."; \ + false; \ + fi + +install-bin: install-local-test $(BINDIR) @echo " INST ct-ng" @install -m 755 ct-ng $(BINDIR)/ct-ng -install-lib: $(LIBDIR) install-lib-main install-lib-samples +install-lib: install-local-test $(LIBDIR) install-lib-main install-lib-samples -install-lib-main: $(LIBDIR) +install-lib-main: install-local-test $(LIBDIR) @for src_dir in config kconfig patches scripts tools; do \ echo " INST $${src_dir}/"; \ tar cf - --exclude=.svn $${src_dir} |(cd $(LIBDIR); tar xf -); \ @@ -85,20 +93,20 @@ install-lib-main: $(LIBDIR) # Samples need a little love: # - change every occurence of CT_TOP_DIR to CT_LIB_DIR -install-lib-samples: $(LIBDIR) install-lib-main +install-lib-samples: install-local-test $(LIBDIR) install-lib-main @echo " INST samples/" @tar cf - --exclude=.svn samples |(cd $(LIBDIR); tar xf -) @for samp_file in $(LIBDIR)/samples/*/crosstool.config; do \ sed -r -i -e 's,\$$\{CT_TOP_DIR\},\$$\{CT_LIB_DIR\},g;' $${samp_file}; \ done -install-doc: install-man $(DOCDIR) +install-doc: install-local-test $(DOCDIR) @for doc_file in CREDITS docs/overview.txt; do \ echo " INST $${doc_file}"; \ install -m 644 "$${doc_file}" $(DOCDIR); \ done -install-man: $(MANDIR) +install-man: install-local-test $(MANDIR) @echo " INST ct-ng.1" @install -m 644 docs/ct-ng.1 $(MANDIR) diff --git a/configure b/configure index 8e28eb20..485932d5 100755 --- a/configure +++ b/configure @@ -9,6 +9,7 @@ BINDIR_set= LIBDIR_set= DOCDIR_set= MANDIR_set= +LOCAL_set= get_optval(){ local ret @@ -79,6 +80,7 @@ Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --prefix=PREFIX install files in PREFIX [${PREFIX_DEFAULT}] + --local don't install, and use current directory By default, \`make install' will install all the files in \`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc. You can specify @@ -102,12 +104,20 @@ while [ $# -ne 0 ]; do --libdir*) set_libdir "$1" "$2" && shift || shift 2;; --docdir*) set_docdir "$1" "$2" && shift || shift 2;; --mandir*) set_mandir "$1" "$2" && shift || shift 2;; + --local) LOCAL_set=1; shift;; --help|-h) do_help; exit 0;; *) do_help; exit 1;; esac done [ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}" +if [ "${LOCAL_set}" = "1" ]; then + set_prefix "" $(pwd) + set_bindir "" $(pwd) + set_libdir "" $(pwd) + set_docdir "" $(pwd)/docs + set_mandir "" $(pwd)/docs +fi sed -r -e "s,@@BINDIR@@,${BINDIR},g;" \ -e "s,@@LIBDIR@@,${LIBDIR},g;" \ @@ -115,6 +125,7 @@ sed -r -e "s,@@BINDIR@@,${BINDIR},g;" \ -e "s,@@MANDIR@@,${MANDIR},g;" \ -e "s,@@VERSION@@,${VERSION},g;" \ -e "s,@@DATE@@,${DATE},g;" \ + -e "s,@@LOCAL@@,${LOCAL_set},g;" \ Makefile.in >Makefile cat <<__EOF__ diff --git a/ct-ng.in b/ct-ng.in index dfa0f970..65cd7ba3 100644 --- a/ct-ng.in +++ b/ct-ng.in @@ -3,7 +3,7 @@ # Copyright 2006 Yann E. MORIN # Don't print directory as we descend into them -MAKEFLAGS += --no-print-directory +MAKEFLAGS += --no-print-directory --no-builtin-rules # Remember the name of the Makefile CT_MAKEFILE := $(lastword $(MAKEFILE_LIST)) diff --git a/kconfig/kconfig.mk b/kconfig/kconfig.mk index d812e828..8bd44bca 100644 --- a/kconfig/kconfig.mk +++ b/kconfig/kconfig.mk @@ -82,7 +82,7 @@ help-config:: # Cheesy build -SHIPPED = $(CT_LIB_DIR)/kconfig/zconf.tab.c $(CT_LIB_DIR)/kconfig/lex.zconf.c $(CT_LIB_DIR)/kconfig/zconf.hash.c +SHIPPED := $(CT_LIB_DIR)/kconfig/zconf.tab.c $(CT_LIB_DIR)/kconfig/lex.zconf.c $(CT_LIB_DIR)/kconfig/zconf.hash.c %.c: %.c_shipped @ln -s $(notdir $<) $@ @@ -101,9 +101,7 @@ $(obj)/conf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/conf.c clean:: @rm -f $(CT_TOP_DIR)/kconfig/{,m}conf + @rm -f $(SHIPPED) @rmdir --ignore-fail-on-non-empty $(CT_TOP_DIR)/kconfig 2>/dev/null || true - @rm -f $(CT_TOP_DIR)/config + @rm -f $(CT_TOP_DIR)/config 2>/dev/null || true @rm -rf $(CT_TOP_DIR)/config.gen - -distclean:: - @rm -f $(CT_TOP_DIR)/config