Makefile.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Sep 21 22:42:35 2011 +0200 (2011-09-21)
branch1.12
changeset 2685 86010f887870
parent 2577 6fc224df66e8
permissions -rw-r--r--
kernel/linux: add alternate download locations

Since kernel.org is dead, and there is no announced or known estimated
time or return to normality, it is impossible to download any kernel at
this time.

Add a known-working mirror.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from 7df89370f80537d1b36b2fda70e3a1c6bc237a65)
     1 # Makefile.in for building crosstool-NG
     2 # This file serves as source for the ./configure operation
     3 
     4 # This series of test is here because GNU make 3.81 will *not* use MAKEFLAGS
     5 # to set additional flags in the current Makfile ( see:
     6 # http://savannah.gnu.org/bugs/?20501 ), although the make manual says it
     7 # should ( see: http://www.gnu.org/software/make/manual/make.html#Options_002fRecursion )
     8 # so we have to work it around by calling ourselves back if needed
     9 
    10 # So why do we need not to use the built rules and variables? Because we
    11 # need to generate scripts/crosstool-NG.sh from scripts/crosstool-NG.sh.in
    12 # and there is a built-in implicit rule '%.sh:' that has neither a pre-requisite
    13 # nor a command associated, and that built-in implicit rule takes precedence
    14 # over our non-built-in implicit rule '%: %.in', below.
    15 
    16 # CT_MAKEFLAGS will be used later, below...
    17 
    18 # Do not print directories as we descend into them
    19 ifeq ($(filter --no-print-directory,$(MAKEFLAGS)),)
    20 CT_MAKEFLAGS += --no-print-directory
    21 endif
    22 
    23 # Use neither builtin rules, nor builtin variables
    24 # Note: dual test, because if -R and -r are given on the command line
    25 # (who knows?), MAKEFLAGS contains 'Rr' instead of '-Rr', while adding
    26 # '-Rr' to MAKEFLAGS adds it literaly ( and does not add 'Rr' )
    27 ifeq ($(filter Rr,$(MAKEFLAGS)),)
    28 ifeq ($(filter -Rr,$(MAKEFLAGS)),)
    29 CT_MAKEFLAGS += -Rr
    30 endif # No -Rr
    31 endif # No Rr
    32 
    33 # Remove any suffix rules
    34 .SUFFIXES:
    35 
    36 all: Makefile build
    37 
    38 ###############################################################################
    39 # Configuration variables
    40 
    41 VERSION:= @@VERSION@@
    42 BINDIR := @@BINDIR@@
    43 LIBDIR := @@LIBDIR@@
    44 DOCDIR := @@DOCDIR@@
    45 MANDIR := @@MANDIR@@
    46 DATE   := @@DATE@@
    47 LOCAL  := @@LOCAL@@
    48 
    49 # Paths found by ./configure
    50 install   := @@install@@
    51 bash      := @@bash@@
    52 grep      := @@grep@@
    53 make      := @@make@@
    54 sed       := @@sed@@
    55 libtool   := @@libtool@@
    56 libtoolize:= @@libtoolize@@
    57 objcopy   := @@objcopy@@
    58 objdump   := @@objdump@@
    59 readelf   := @@readelf@@
    60 patch     := @@patch@@
    61 
    62 # config options to push down to kconfig
    63 KCONFIG:= @@KCONFIG@@
    64 
    65 ###############################################################################
    66 # Non-configure variables
    67 MAN_SECTION := 1
    68 MAN_SUBDIR := /man$(MAN_SECTION)
    69 
    70 ###############################################################################
    71 # Sanity checks
    72 
    73 # Check if Makefile is up to date:
    74 Makefile: Makefile.in
    75 	@echo "$< did changed: you must re-run './configure'"
    76 	@false
    77 
    78 # If installing with DESTDIR, check it's an absolute path
    79 ifneq ($(strip $(DESTDIR)),)
    80   ifneq ($(DESTDIR),$(abspath /$(DESTDIR)))
    81     $(error DESTDIR is not an absolute PATH: '$(DESTDIR)')
    82   endif
    83 endif
    84 
    85 ###############################################################################
    86 # Global make rules
    87 
    88 # If any extra MAKEFLAGS were added, re-run ourselves
    89 # See top of file for an explanation of why this is needed...
    90 ifneq ($(strip $(CT_MAKEFLAGS)),)
    91 
    92 # Somehow, the new auto-completion for make in the recent distributions
    93 # trigger a behavior where our Makefile calls itself recursively, in a
    94 # never-ending loop (except on lack of ressources, swap, PIDs...)
    95 # Avoid this situation by cutting the recursion short at the first
    96 # level.
    97 # This has the side effect of only showing the real targets, and hiding our
    98 # internal ones. :-)
    99 ifneq ($(MAKELEVEL),0)
   100 $(error Recursion detected, bailing out...)
   101 endif
   102 
   103 MAKEFLAGS += $(CT_MAKEFLAGS)
   104 build install clean distclean uninstall:
   105 	@$(MAKE) $@
   106 
   107 else
   108 # There were no additional MAKEFLAGS to add, do the job
   109 
   110 TARGETS := bin lib doc man
   111 
   112 build: $(patsubst %,build-%,$(TARGETS))
   113 
   114 install: build real-install
   115 
   116 clean: $(patsubst %,clean-%,$(TARGETS))
   117 
   118 distclean: clean
   119 	@echo "  RM     'Makefile'"
   120 	@rm -f Makefile
   121 
   122 uninstall: real-uninstall
   123 
   124 ###############################################################################
   125 # Specific make rules
   126 
   127 #--------------------------------------
   128 # Build rules
   129 
   130 build-bin: ct-ng scripts/crosstool-NG.sh scripts/saveSample.sh scripts/showTuple.sh
   131 	@chmod 755 $^
   132 
   133 build-lib: paths.mk config/configure.in
   134 
   135 build-doc:
   136 
   137 build-man: docs/ct-ng.1.gz
   138 
   139 docs/ct-ng.1.gz: docs/ct-ng.1
   140 	@echo "  GZIP   '$@'"
   141 	@gzip -c9 $< >$@
   142 
   143 %: %.in Makefile
   144 	@echo "  SED    '$@'"
   145 	@$(sed) -r -e 's,@@CT_BINDIR@@,$(BINDIR),g;'    \
   146 	           -e 's,@@CT_LIBDIR@@,$(LIBDIR),g;'    \
   147 	           -e 's,@@CT_DOCDIR@@,$(DOCDIR),g;'    \
   148 	           -e 's,@@CT_MANDIR@@,$(MANDIR),g;'    \
   149 	           -e 's,@@CT_VERSION@@,$(VERSION),g;'	\
   150 	           -e 's,@@CT_DATE@@,$(DATE),g;'        \
   151 	           -e 's,@@CT_make@@,$(make),g;'        \
   152 	           -e 's,@@CT_bash@@,$(bash),g;'        \
   153 	           $@.in >$@
   154 
   155 # We create a script fragment that is parseable from inside a Makefile,
   156 # but also from inside a shell script, hence the reason why we don't
   157 # use := to set variables, although that will incur a (very small)
   158 # penalty from the Makefile that includes it (due to re-evaluation at
   159 # each call).
   160 paths.mk: FORCE
   161 	@echo "  GEN    '$@'"
   162 	@(echo "export install=$(install)"; \
   163 	  echo "export bash=$(bash)";       \
   164 	  echo "export grep=$(grep)";       \
   165 	  echo "export make=$(make)";       \
   166 	  echo "export sed=$(sed)";         \
   167 	  echo "export libtool=$(libtool)"; \
   168 	  echo "export libtoolize=$(libtoolize)"; \
   169 	  echo "export objcopy=$(objcopy)"; \
   170 	  echo "export objdump=$(objdump)"; \
   171 	  echo "export readelf=$(readelf)"; \
   172 	  echo "export patch=$(patch)";     \
   173 	 ) >paths.mk
   174 
   175 config/configure.in: FORCE
   176 	@echo "  GEN    '$@'"
   177 	@{  printf "# Generated file, do not edit\n";            \
   178 	    printf "# Default values as found by ./configure\n"; \
   179 	    for var in $(KCONFIG); do                            \
   180 	        printf "\n";                                     \
   181 	        printf "config CONFIGURE_$${var%%=*}\n";         \
   182 	        printf "    bool\n";                             \
   183 	        if [ "$${var#*=}" = "y" ]; then                  \
   184 	            printf "    default y\n";                    \
   185 	        fi;                                              \
   186 	    done;                                                \
   187 	 } >$@
   188 
   189 FORCE:
   190 
   191 #--------------------------------------
   192 # Clean rules
   193 
   194 clean-bin:
   195 	@echo "  RM     'ct-ng'"
   196 	@rm -f ct-ng
   197 	@echo "  RM     'scripts/crosstool-NG.sh'"
   198 	@rm -f scripts/crosstool-NG.sh
   199 	@echo "  RM     'scripts/saveSample.sh'"
   200 	@rm -f scripts/saveSample.sh
   201 	@echo "  RM     'scripts/showTuple.sh'"
   202 	@rm -f scripts/showTuple.sh
   203 
   204 clean-lib:
   205 	@echo "  RM     'paths.mk'"
   206 	@rm -f paths.mk
   207 	@echo "  RM     'config/configure.in'"
   208 	@rm -f config/configure.in
   209 
   210 clean-doc:
   211 
   212 clean-man:
   213 	@echo "  RM     'docs/ct-ng.1'"
   214 	@rm -f docs/ct-ng.1
   215 	@echo "  RM     'docs/ct-ng.1.gz'"
   216 	@rm -f docs/ct-ng.1.gz
   217 
   218 #--------------------------------------
   219 # Check for --local setup
   220 
   221 ifeq ($(strip $(LOCAL)),y)
   222 
   223 real-install:
   224 	@true
   225 
   226 real-uninstall:
   227 	@true
   228 
   229 else
   230 
   231 #--------------------------------------
   232 # Install rules
   233 
   234 real-install: $(patsubst %,install-%,$(TARGETS)) install-post
   235 
   236 install-bin: $(DESTDIR)$(BINDIR)
   237 	@echo "  INST    'ct-ng'"
   238 	@$(install) -m 755 ct-ng "$(DESTDIR)$(BINDIR)/ct-ng"
   239 
   240 # If one is hacking crosstool-NG, the patch set might change between any two
   241 # installations of the same VERSION, thus the patches must be removed prior
   242 # to being installed. It is simpler to remove the whole lib/ directory, as it
   243 # is the goal of the install-lib rule to install the lib/ directory...
   244 install-lib: uninstall-lib $(DESTDIR)$(LIBDIR) install-lib-main install-lib-samples
   245 
   246 LIB_SUB_DIR := config contrib kconfig patches scripts
   247 $(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): $(DESTDIR)$(LIBDIR)
   248 	@echo "  INSTDIR '$(patsubst install-lib-%-copy,%,$(@))/'"
   249 	@tar cf - --exclude='*.sh.in' $(patsubst install-lib-%-copy,%,$(@)) \
   250 	 |(cd "$(DESTDIR)$(LIBDIR)"; tar xf -)
   251 
   252 # Huh? It seems we need at least one command to make this rule kick-in.
   253 install-lib-%: install-lib-%-copy; @true
   254 
   255 # Huh? that one does not inherit the -opy dependency, above...
   256 install-lib-scripts: install-lib-scripts-copy
   257 	@chmod a+x $(DESTDIR)$(LIBDIR)/scripts/crosstool-NG.sh
   258 	@chmod a+x $(DESTDIR)$(LIBDIR)/scripts/saveSample.sh
   259 	@rm -f "$(DESTDIR)$(LIBDIR)/scripts/addToolVersion.sh"
   260 
   261 install-lib-main: $(DESTDIR)$(LIBDIR) $(patsubst %,install-lib-%,$(LIB_SUB_DIR))
   262 	@echo "  INST    'steps.mk'"
   263 	@$(install) -m 644 steps.mk "$(DESTDIR)$(LIBDIR)/steps.mk"
   264 	@echo "  INST    'paths.mk'"
   265 	@$(install) -m 644 paths.mk "$(DESTDIR)$(LIBDIR)/paths.mk"
   266 
   267 # Samples need a little love:
   268 #  - change every occurrence of CT_TOP_DIR to CT_LIB_DIR
   269 install-lib-samples: $(DESTDIR)$(LIBDIR) install-lib-main
   270 	@echo "  INSTDIR 'samples/'"
   271 	@for samp_dir in samples/*/; do                                         \
   272 	     mkdir -p "$(DESTDIR)$(LIBDIR)/$${samp_dir}";                       \
   273 	     $(sed) -r -e 's:\$$\{CT_TOP_DIR\}:\$$\{CT_LIB_DIR\}:;'             \
   274 	               -e 's:^(CT_WORK_DIR)=.*:\1="\$${CT_TOP_DIR}/.build":;'   \
   275 	            $${samp_dir}/crosstool.config                               \
   276 	            >"$(DESTDIR)$(LIBDIR)/$${samp_dir}/crosstool.config";       \
   277 	     $(install) -m 644 "$${samp_dir}/reported.by"                       \
   278 	                       "$(DESTDIR)$(LIBDIR)/$${samp_dir}";              \
   279 	     for libc_cfg in "$${samp_dir}/"*libc*.config; do                   \
   280 	         [ -f "$${libc_cfg}" ] || continue;                             \
   281 	         $(install) -m 644 "$${libc_cfg}"                               \
   282 	                           "$(DESTDIR)$(LIBDIR)/$${samp_dir}";          \
   283 	     done;                                                              \
   284 	 done
   285 	@$(install) -m 644 samples/samples.mk "$(DESTDIR)$(LIBDIR)/samples/samples.mk"
   286 
   287 install-doc: $(DESTDIR)$(DOCDIR)
   288 	@echo "  INST    'docs/*.txt'"
   289 	@for doc_file in docs/*.txt; do                              \
   290 	     $(install) -m 644 "$${doc_file}" "$(DESTDIR)$(DOCDIR)"; \
   291 	 done
   292 
   293 install-man: $(DESTDIR)$(MANDIR)$(MAN_SUBDIR)
   294 	@echo "  INST    'ct-ng.1.gz'"
   295 	@$(install) -m 644 docs/ct-ng.1.gz "$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)"
   296 
   297 $(sort $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(DOCDIR) $(DESTDIR)$(MANDIR)$(MAN_SUBDIR)):
   298 	@echo "  MKDIR   '$@/'"
   299 	@$(install) -m 755 -d "$@"
   300 
   301 install-post:
   302 	@echo
   303 	@echo "For auto-completion, do not forget to install 'ct-ng.comp' into"
   304 	@echo "your bash completion directory (usually /etc/bash_completion.d)"
   305 
   306 #--------------------------------------
   307 # Uninstall rules
   308 
   309 real-uninstall: $(patsubst %,uninstall-%,$(TARGETS))
   310 
   311 uninstall-bin:
   312 	@echo "  RM      '$(DESTDIR)$(BINDIR)/ct-ng'"
   313 	@rm -f "$(DESTDIR)$(BINDIR)/ct-ng"
   314 
   315 uninstall-lib:
   316 	@echo "  RMDIR   '$(DESTDIR)$(LIBDIR)/'"
   317 	@rm -rf "$(DESTDIR)$(LIBDIR)"
   318 
   319 uninstall-doc:
   320 	@echo "  RMDIR   '$(DESTDIR)$(DOCDIR)/'"
   321 	@rm -rf "$(DESTDIR)$(DOCDIR)"
   322 
   323 uninstall-man:
   324 	@echo "  RM      '$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)/ct-ng.1.gz'"
   325 	@rm -f "$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)/ct-ng.1"{,.gz}
   326 
   327 endif # Not --local
   328 
   329 endif # No extra MAKEFLAGS were added