Makefile.in
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Tue Dec 11 12:54:05 2012 +0100 (2012-12-11)
changeset 3136 927ca2e79394
parent 2999 4ccfca658d9b
child 3185 f89f8e6f8766
permissions -rw-r--r--
kernel/linux: update revisions

Update Linux with the latest available revisions.

Signed-off-by: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Message-Id: <515f9ed69f58a0af21e9.1355226920@advdt005-ubuntu>
Patchwork-Id: 205183
     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 # Stuff found by ./configure
    42 export DATE            := @DATE@
    43 export LOCAL           := @enable_local@
    44 export PROG_SED        := @program_transform_name@
    45 export PACKAGE_TARNAME := @PACKAGE_TARNAME@
    46 export VERSION         := @PACKAGE_VERSION@
    47 export prefix          := @prefix@
    48 export exec_prefix     := @exec_prefix@
    49 export bindir          := @bindir@
    50 export libdir          := @libdir@@sublibdir@
    51 export docdir          := @docdir@@subdocdir@
    52 export mandir          := @mandir@
    53 export datarootdir     := @datarootdir@
    54 export install         := @INSTALL@
    55 export bash            := @_BASH@
    56 export awk             := @_AWK@
    57 export grep            := @GREP@
    58 export make            := @MAKE@
    59 export sed             := @SED@
    60 export libtool         := @LIBTOOL@
    61 export libtoolize      := @LIBTOOLIZE@
    62 export objcopy         := @OBJCOPY@
    63 export objdump         := @OBJDUMP@
    64 export readelf         := @READELF@
    65 export patch           := @PATCH@
    66 export CC              := @CC@
    67 export CPP             := @CPP@
    68 export CPPFLAGS        := @CPPFLAGS@
    69 export CFLAGS          := @CFLAGS@
    70 export LDFLAGS         := @LDFLAGS@
    71 export LIBS            := @LIBS@
    72 export curses_hdr      := @ac_ct_curses_hdr@
    73 export gettext         := @gettext@
    74 
    75 # config options to push down to kconfig
    76 KCONFIG:= @kconfig_options@
    77 
    78 ###############################################################################
    79 # Non-configure variables
    80 MAN_SECTION := 1
    81 MAN_SUBDIR := /man$(MAN_SECTION)
    82 
    83 PROG_NAME := $(shell echo 'ct-ng' |$(sed) -r -e '$(PROG_SED)' )
    84 
    85 ###############################################################################
    86 # Sanity checks
    87 
    88 # Check if Makefile is up to date:
    89 Makefile: Makefile.in
    90 	@echo "$< did changed: you must re-run './configure'"
    91 	@false
    92 
    93 # If installing with DESTDIR, check it's an absolute path
    94 ifneq ($(strip $(DESTDIR)),)
    95   ifneq ($(DESTDIR),$(abspath /$(DESTDIR)))
    96     $(error DESTDIR is not an absolute PATH: '$(DESTDIR)')
    97   endif
    98 endif
    99 
   100 ###############################################################################
   101 # Global make rules
   102 
   103 # If any extra MAKEFLAGS were added, re-run ourselves
   104 # See top of file for an explanation of why this is needed...
   105 ifneq ($(strip $(CT_MAKEFLAGS)),)
   106 
   107 # Somehow, the new auto-completion for make in the recent distributions
   108 # trigger a behavior where our Makefile calls itself recursively, in a
   109 # never-ending loop (except on lack of ressources, swap, PIDs...)
   110 # Avoid this situation by cutting the recursion short at the first
   111 # level.
   112 # This has the side effect of only showing the real targets, and hiding our
   113 # internal ones. :-)
   114 ifneq ($(MAKELEVEL),0)
   115 $(error Recursion detected, bailing out...)
   116 endif
   117 
   118 MAKEFLAGS += $(CT_MAKEFLAGS)
   119 build install clean distclean mrproper uninstall:
   120 	@$(MAKE) $@
   121 
   122 else
   123 # There were no additional MAKEFLAGS to add, do the job
   124 
   125 TARGETS := bin lib lib-kconfig doc man
   126 
   127 build: $(patsubst %,build-%,$(TARGETS))
   128 
   129 install: build real-install
   130 
   131 clean: $(patsubst %,clean-%,$(TARGETS))
   132 
   133 distclean: clean
   134 	@echo "  RM     'Makefile'"
   135 	@rm -f Makefile
   136 
   137 mrproper: distclean
   138 	@echo "  RM     'autostuff'"
   139 	@ rm -rf autom4te.cache config.log config.status configure
   140 
   141 uninstall: real-uninstall
   142 
   143 ###############################################################################
   144 # Specific make rules
   145 
   146 #--------------------------------------
   147 # Build rules
   148 
   149 build-bin: $(PROG_NAME)             \
   150            scripts/crosstool-NG.sh  \
   151            scripts/saveSample.sh    \
   152            scripts/showTuple.sh
   153 	@chmod 755 $^
   154 
   155 build-lib: config/configure.in  \
   156            paths.mk             \
   157            paths.sh
   158 
   159 build-lib-kconfig:
   160 	@$(MAKE) -C kconfig
   161 
   162 build-doc:
   163 
   164 build-man: docs/$(PROG_NAME).1.gz
   165 
   166 docs/$(PROG_NAME).1.gz: docs/$(PROG_NAME).1
   167 	@echo "  GZIP   '$@'"
   168 	@gzip -c9 $< >$@
   169 
   170 define sed_it
   171 	@echo "  SED    '$@'"
   172 	@$(sed) -r -e 's,@@CT_BINDIR@@,$(bindir),g;'        \
   173 	           -e 's,@@CT_LIBDIR@@,$(libdir),g;'        \
   174 	           -e 's,@@CT_DOCDIR@@,$(docdir),g;'        \
   175 	           -e 's,@@CT_MANDIR@@,$(mandir),g;'        \
   176 	           -e 's,@@CT_PROG_NAME@@,$(PROG_NAME),g;'  \
   177 	           -e 's,@@CT_VERSION@@,$(VERSION),g;'	    \
   178 	           -e 's,@@CT_DATE@@,$(DATE),g;'            \
   179 	           -e 's,@@CT_make@@,$(make),g;'            \
   180 	           -e 's,@@CT_bash@@,$(bash),g;'            \
   181 	           -e 's,@@CT_awk@@,$(awk),g;'              \
   182 	           $< >$@
   183 endef
   184 
   185 docs/$(PROG_NAME).1: docs/ct-ng.1.in Makefile
   186 	$(call sed_it)
   187 
   188 $(PROG_NAME): ct-ng.in Makefile
   189 	$(call sed_it)
   190 
   191 %: %.in Makefile
   192 	$(call sed_it)
   193 
   194 # We create a script fragment that is parseable from inside a Makefile,
   195 # and one from inside a shell script
   196 paths.mk: FORCE
   197 	@echo "  GEN    '$@'"
   198 	@(echo 'export install=$(install)';         \
   199 	  echo 'export bash=$(bash)';               \
   200 	  echo 'export awk=$(awk)';                 \
   201 	  echo 'export grep=$(grep)';               \
   202 	  echo 'export make=$(make)';               \
   203 	  echo 'export sed=$(sed)';                 \
   204 	  echo 'export libtool=$(libtool)';         \
   205 	  echo 'export libtoolize=$(libtoolize)';   \
   206 	  echo 'export objcopy=$(objcopy)';         \
   207 	  echo 'export objdump=$(objdump)';         \
   208 	  echo 'export readelf=$(readelf)';         \
   209 	  echo 'export patch=$(patch)';             \
   210 	 ) >$@
   211 
   212 paths.sh: FORCE
   213 	@echo "  GEN    '$@'"
   214 	@(echo 'export install="$(install)"';       \
   215 	  echo 'export bash="$(bash)"';             \
   216 	  echo 'export awk="$(awk)"';               \
   217 	  echo 'export grep="$(grep)"';             \
   218 	  echo 'export make="$(make)"';             \
   219 	  echo 'export sed="$(sed)"';               \
   220 	  echo 'export libtool="$(libtool)"';       \
   221 	  echo 'export libtoolize="$(libtoolize)"'; \
   222 	  echo 'export objcopy="$(objcopy)"';       \
   223 	  echo 'export objdump="$(objdump)"';       \
   224 	  echo 'export readelf="$(readelf)"';       \
   225 	  echo 'export patch="$(patch)"';           \
   226 	 ) >$@
   227 
   228 config/configure.in: FORCE
   229 	@echo "  GEN    '$@'"
   230 	@{  printf "# Generated file, do not edit\n";            \
   231 	    printf "# Default values as found by ./configure\n"; \
   232 	    for var in $(KCONFIG); do                            \
   233 	        printf "\n";                                     \
   234 	        printf "config CONFIGURE_$${var%%=*}\n";         \
   235 	        if [ "$${var#*=}" = "y" ]; then                  \
   236 	            printf "    def_bool y\n";                   \
   237 	        else                                             \
   238 	            printf "    bool\n";                         \
   239 	        fi;                                              \
   240 	    done;                                                \
   241 	 } >$@
   242 
   243 FORCE:
   244 
   245 #--------------------------------------
   246 # Clean rules
   247 
   248 clean-bin:
   249 	@echo "  RM     '$(PROG_NAME)'"
   250 	@rm -f $(PROG_NAME)
   251 	@echo "  RM     'scripts/crosstool-NG.sh'"
   252 	@rm -f scripts/crosstool-NG.sh
   253 	@echo "  RM     'scripts/saveSample.sh'"
   254 	@rm -f scripts/saveSample.sh
   255 	@echo "  RM     'scripts/showTuple.sh'"
   256 	@rm -f scripts/showTuple.sh
   257 
   258 clean-lib:
   259 	@echo "  RM     'paths'"
   260 	@rm -f paths.mk paths.sh
   261 	@echo "  RM     'config/configure.in'"
   262 	@rm -f config/configure.in
   263 
   264 clean-lib-kconfig:
   265 	@$(MAKE) -C kconfig clean
   266 
   267 clean-doc:
   268 
   269 clean-man:
   270 	@echo "  RM     'docs/$(PROG_NAME).1'"
   271 	@rm -f docs/$(PROG_NAME).1
   272 	@echo "  RM     'docs/$(PROG_NAME).1.gz'"
   273 	@rm -f docs/$(PROG_NAME).1.gz
   274 
   275 #--------------------------------------
   276 # Check for --local setup
   277 
   278 ifeq ($(strip $(LOCAL)),yes)
   279 
   280 real-install:
   281 	@true
   282 
   283 real-uninstall:
   284 	@true
   285 
   286 else
   287 
   288 #--------------------------------------
   289 # Install rules
   290 
   291 real-install: $(patsubst %,install-%,$(TARGETS)) install-post
   292 
   293 install-bin: $(DESTDIR)$(bindir)
   294 	@echo "  INST    '$(PROG_NAME)'"
   295 	@$(install) -m 755 $(PROG_NAME) "$(DESTDIR)$(bindir)/$(PROG_NAME)"
   296 
   297 # If one is hacking crosstool-NG, the patch set might change between any two
   298 # installations of the same VERSION, thus the patches must be removed prior
   299 # to being installed. It is simpler to remove the whole lib/ directory, as it
   300 # is the goal of the install-lib rule to install the lib/ directory...
   301 install-lib: uninstall-lib          \
   302              $(DESTDIR)$(libdir)    \
   303              install-lib-main       \
   304              install-lib-samples
   305 
   306 LIB_SUB_DIR := config contrib patches scripts
   307 $(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): $(DESTDIR)$(libdir)
   308 	@echo "  INSTDIR '$(patsubst install-lib-%-copy,%,$(@))/'"
   309 	@tar cf - --exclude='*.sh.in' $(patsubst install-lib-%-copy,%,$(@)) \
   310 	 |(cd "$(DESTDIR)$(libdir)"; tar xf -)
   311 
   312 # Huh? It seems we need at least one command to make this rule kick-in.
   313 install-lib-%: install-lib-%-copy; @true
   314 
   315 # Huh? that one does not inherit the -opy dependency, above...
   316 install-lib-scripts: install-lib-scripts-copy
   317 	@chmod a+x $(DESTDIR)$(libdir)/scripts/crosstool-NG.sh
   318 	@chmod a+x $(DESTDIR)$(libdir)/scripts/saveSample.sh
   319 	@rm -f "$(DESTDIR)$(libdir)/scripts/addToolVersion.sh"
   320 
   321 install-lib-main: $(DESTDIR)$(libdir) $(patsubst %,install-lib-%,$(LIB_SUB_DIR))
   322 	@echo "  INST    'steps.mk'"
   323 	@$(install) -m 644 steps.mk "$(DESTDIR)$(libdir)/steps.mk"
   324 	@echo "  INST    'paths'"
   325 	@$(install) -m 644 paths.mk paths.sh "$(DESTDIR)$(libdir)"
   326 
   327 # Samples need a little love:
   328 #  - change every occurrence of CT_TOP_DIR to CT_LIB_DIR
   329 install-lib-samples: $(DESTDIR)$(libdir) install-lib-main
   330 	@echo "  INSTDIR 'samples/'"
   331 	@for samp_dir in samples/*/; do                                         \
   332 	     mkdir -p "$(DESTDIR)$(libdir)/$${samp_dir}";                       \
   333 	     $(sed) -r -e 's:\$$\{CT_TOP_DIR\}:\$$\{CT_LIB_DIR\}:;'             \
   334 	               -e 's:^(CT_WORK_DIR)=.*:\1="\$${CT_TOP_DIR}/.build":;'   \
   335 	            $${samp_dir}/crosstool.config                               \
   336 	            >"$(DESTDIR)$(libdir)/$${samp_dir}/crosstool.config";       \
   337 	     $(install) -m 644 "$${samp_dir}/reported.by"                       \
   338 	                       "$(DESTDIR)$(libdir)/$${samp_dir}";              \
   339 	     for libc_cfg in "$${samp_dir}/"*libc*.config; do                   \
   340 	         [ -f "$${libc_cfg}" ] || continue;                             \
   341 	         $(install) -m 644 "$${libc_cfg}"                               \
   342 	                           "$(DESTDIR)$(libdir)/$${samp_dir}";          \
   343 	     done;                                                              \
   344 	 done
   345 	@$(install) -m 644 samples/samples.mk "$(DESTDIR)$(libdir)/samples/samples.mk"
   346 
   347 KCONFIG_FILES := conf mconf nconf kconfig.mk
   348 install-lib-kconfig: $(DESTDIR)$(libdir) install-lib-main
   349 	@echo "  INST    'kconfig/'"
   350 	@mkdir -p "$(DESTDIR)$(libdir)/kconfig"
   351 	@for f in $(KCONFIG_FILES); do                                      \
   352 	    install "kconfig/$${f}" "$(DESTDIR)$(libdir)/kconfig/$${f}";    \
   353 	 done
   354 
   355 install-doc: $(DESTDIR)$(docdir)
   356 	@echo "  INST    'docs/*.txt'"
   357 	@for doc_file in docs/*.txt; do                              \
   358 	     $(install) -m 644 "$${doc_file}" "$(DESTDIR)$(docdir)"; \
   359 	 done
   360 
   361 install-man: $(DESTDIR)$(mandir)$(MAN_SUBDIR)
   362 	@echo "  INST    '$(PROG_NAME).1.gz'"
   363 	@$(install) -m 644 docs/$(PROG_NAME).1.gz "$(DESTDIR)$(mandir)$(MAN_SUBDIR)"
   364 
   365 $(sort $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(docdir) $(DESTDIR)$(mandir)$(MAN_SUBDIR)):
   366 	@echo "  MKDIR   '$@/'"
   367 	@$(install) -m 755 -d "$@"
   368 
   369 install-post:
   370 	@echo
   371 	@echo "For auto-completion, do not forget to install '$(PROG_NAME).comp' into"
   372 	@echo "your bash completion directory (usually /etc/bash_completion.d)"
   373 
   374 #--------------------------------------
   375 # Uninstall rules
   376 
   377 real-uninstall: $(patsubst %,uninstall-%,$(TARGETS))
   378 
   379 uninstall-bin:
   380 	@echo "  RM      '$(DESTDIR)$(bindir)/$(PROG_NAME)'"
   381 	@rm -f "$(DESTDIR)$(bindir)/$(PROG_NAME)"
   382 
   383 uninstall-lib:
   384 	@echo "  RMDIR   '$(DESTDIR)$(libdir)/'"
   385 	@rm -rf "$(DESTDIR)$(libdir)"
   386 
   387 uninstall-doc:
   388 	@echo "  RMDIR   '$(DESTDIR)$(docdir)/'"
   389 	@rm -rf "$(DESTDIR)$(docdir)"
   390 
   391 uninstall-man:
   392 	@echo "  RM      '$(DESTDIR)$(mandir)$(MAN_SUBDIR)/$(PROG_NAME).1.gz'"
   393 	@rm -f "$(DESTDIR)$(mandir)$(MAN_SUBDIR)/$(PROG_NAME).1"{,.gz}
   394 
   395 endif # Not --local
   396 
   397 endif # No extra MAKEFLAGS were added
   398 
   399 .PHONY: build $(patsubst %,build-%,$(TARGETS)) install