Makefile.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Jun 11 21:45:57 2008 +0000 (2008-06-11)
changeset 554 be6197b5b33b
parent 553 b2261f6f9bc2
child 555 561285bdb5c8
permissions -rw-r--r--
Include the full version number in the directory paths installed.
Change the version string so that it does not break 'make', and so that it has no '/' (it would be a hell if installed directories would mirror the SVN branches... :-/ )
Do not use implicit rules for the Makefile.
Simplify and enc=hance the --local test to refuse (un)installing.
Double-quotes variables, they are based on user input.
Eye-candy in the 'compile' and install messages.

/trunk/configure | 26 14 12 0 ++++++++++---------
/trunk/Makefile.in | 83 45 38 0 +++++++++++++++++++++++++++++++++---------------------------
2 files changed, 59 insertions(+), 50 deletions(-)
     1 # Makefile.in for building crosstool-NG
     2 # This file serves as source for the ./configure operation
     3 
     4 MAKEFLAGS += --no-print-directory --no-builtin-rules
     5 
     6 all: Makefile build
     7 
     8 # Check if Makefile is up to date:
     9 Makefile: Makefile.in
    10 	@echo "$< did changed: you must re-run './configure'"
    11 	@false
    12 
    13 ###############################################################################
    14 # Configuration variables
    15 
    16 VERSION:= @@VERSION@@
    17 BINDIR := @@BINDIR@@
    18 LIBDIR := @@LIBDIR@@
    19 DOCDIR := @@DOCDIR@@
    20 MANDIR := @@MANDIR@@
    21 DATE   := @@DATE@@
    22 LOCAL  := @@LOCAL@@
    23 MAKE   := $(shell which $(MAKE) || type -p $(MAKE) || echo /usr/bin/make)
    24 
    25 ###############################################################################
    26 # Global make rules
    27 
    28 build: build-bin build-lib build-man
    29 
    30 install: build install-bin install-lib install-doc install-man
    31 
    32 clean: clean-bin clean-lib clean-doc
    33 
    34 distclean: clean
    35 	@echo "  RM     'Makefile'"
    36 	@rm -f Makefile
    37 
    38 uninstall: uninstall-bin uninstall-lib uninstall-doc uninstall-man
    39 
    40 ###############################################################################
    41 # Specific make rules
    42 
    43 #--------------------------------------
    44 # Build rules
    45 
    46 build-bin: ct-ng
    47 	@echo "  CHMOD  '$<'"
    48 	@chmod a+x $<
    49 
    50 build-lib:
    51 
    52 build-man: docs/ct-ng.1.gz
    53 
    54 docs/ct-ng.1.gz: docs/ct-ng.1
    55 	@echo "  GZIP   '$@'"
    56 	@gzip -c9 $< >$@
    57 
    58 %: %.in Makefile
    59 	@echo "  SED    '$@'"
    60 	@sed -r -e 's,@@CT_MAKE@@,$(MAKE),g;'       \
    61 	        -e 's,@@CT_BINDIR@@,$(BINDIR),g;'   \
    62 	        -e 's,@@CT_LIBDIR@@,$(LIBDIR),g;'   \
    63 	        -e 's,@@CT_DOCDIR@@,$(DOCDIR),g;'   \
    64 	        -e 's,@@CT_MANDIR@@,$(MANDIR),g;'   \
    65 	        -e 's,@@CT_VERSION@@,$(VERSION),g;'	\
    66 	        -e 's,@@CT_DATE@@,$(DATE),g;'       \
    67 	     $@.in >$@
    68 
    69 #--------------------------------------
    70 # Clean rules
    71 
    72 clean-bin:
    73 	@echo "  RM     'ct-ng'"
    74 	@rm -f ct-ng
    75 
    76 clean-lib:
    77 
    78 clean-doc:
    79 	@echo "  RM     'docs/ct-ng.1'"
    80 	@rm -f docs/ct-ng.1
    81 	@echo "  RM     'docs/ct-ng.1.gz'"
    82 	@rm -f docs/ct-ng.1.gz
    83 
    84 #--------------------------------------
    85 # Check for --local setup
    86 
    87 # If using locally, don't install
    88 local-test:
    89 	@if [ "$(LOCAL)" = "1" ]; then                                          \
    90 	     echo "You're using local copy as runtime. You can't (un)install."; \
    91 	     false;                                                             \
    92 	 fi
    93 
    94 #--------------------------------------
    95 # Install rules
    96 
    97 install-%: local-test
    98 
    99 install-bin: $(BINDIR)
   100 	@echo "  INST   'ct-ng'"
   101 	@install -m 755 ct-ng "$(BINDIR)/ct-ng"
   102 
   103 install-lib: uninstall-lib $(LIBDIR) install-lib-main install-lib-samples
   104 
   105 install-lib-main: $(LIBDIR)
   106 	@for src_dir in arch config kconfig patches scripts tools; do           \
   107 	     echo "  INST   '$${src_dir}/'";                                    \
   108 	     tar cf - --exclude=.svn $${src_dir} |(cd "$(LIBDIR)"; tar xf -);   \
   109 	 done
   110 	@rm -f "$(LIBDIR)/tools/addToolVersion.sh"
   111 	@echo "  INST   'steps.mk'"
   112 	@install -m 644 steps.mk "$(LIBDIR)/steps.mk"
   113 
   114 # Samples need a little love:
   115 #  - change every occurrence of CT_TOP_DIR to CT_LIB_DIR
   116 install-lib-samples: $(LIBDIR) install-lib-main
   117 	@echo "  INST   'samples/'"
   118 	@tar cf - --exclude=.svn samples |(cd "$(LIBDIR)"; tar xf -)
   119 	@for samp_file in "$(LIBDIR)/samples/"*"/crosstool.config"; do              \
   120 	     sed -r -i -e 's,\$$\{CT_TOP_DIR\},\$$\{CT_LIB_DIR\},g;' $${samp_file}; \
   121 	 done
   122 
   123 install-doc: $(DOCDIR)
   124 	@for doc_file in docs/CREDITS docs/overview.txt; do \
   125 	     echo "  INST   '$${doc_file}'";                \
   126 	     install -m 644 "$${doc_file}" "$(DOCDIR)";     \
   127 	 done
   128 
   129 install-man: $(MANDIR)
   130 	@echo "  INST   'ct-ng.1.gz'"
   131 	@install -m 644 docs/ct-ng.1.gz "$(MANDIR)"
   132 
   133 $(BINDIR) $(LIBDIR) $(DOCDIR) $(MANDIR)::
   134 	@echo "  MKDIR  '$@'"
   135 	@install -m 755 -d "$@"
   136 
   137 
   138 #--------------------------------------
   139 # Uninstall rules
   140 
   141 uninstall-%: local-test
   142 
   143 uninstall-bin:
   144 	@rm -f "$(BINDIR)/ct-ng"
   145 
   146 uninstall-lib:
   147 	@rm -rf "$(LIBDIR)"
   148 
   149 uninstall-doc:
   150 	@rm -rf "$(DOCDIR)"
   151 
   152 uninstall-man:
   153 	@rm -f "$(MANDIR)/ct-ng.1"{,.gz}