Makefile.in
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Thu Jan 10 00:27:13 2013 +0100 (2013-01-10)
changeset 3159 fb71cad4b085
parent 2999 4ccfca658d9b
child 3185 f89f8e6f8766
permissions -rw-r--r--
arch/arm: OABI is no more, switch to only EABI

Well, leave the prompt as an OBSOLETE thing, scheduled to
be removed soon.

As an indication OABI lives its last days, gcc-4.8 will no
longer recognise non-EABI targets.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
yann@197
     1
# Makefile.in for building crosstool-NG
yann@182
     2
# This file serves as source for the ./configure operation
yann@182
     3
yann@1156
     4
# This series of test is here because GNU make 3.81 will *not* use MAKEFLAGS
yann@1156
     5
# to set additional flags in the current Makfile ( see:
yann@1156
     6
# http://savannah.gnu.org/bugs/?20501 ), although the make manual says it
yann@1156
     7
# should ( see: http://www.gnu.org/software/make/manual/make.html#Options_002fRecursion )
yann@1156
     8
# so we have to work it around by calling ourselves back if needed
yann@1156
     9
yann@1156
    10
# So why do we need not to use the built rules and variables? Because we
yann@1156
    11
# need to generate scripts/crosstool-NG.sh from scripts/crosstool-NG.sh.in
yann@1156
    12
# and there is a built-in implicit rule '%.sh:' that has neither a pre-requisite
yann@1156
    13
# nor a command associated, and that built-in implicit rule takes precedence
yann@1156
    14
# over our non-built-in implicit rule '%: %.in', below.
yann@1156
    15
yann@1156
    16
# CT_MAKEFLAGS will be used later, below...
yann@1156
    17
yann@1156
    18
# Do not print directories as we descend into them
yann@1156
    19
ifeq ($(filter --no-print-directory,$(MAKEFLAGS)),)
yann@1156
    20
CT_MAKEFLAGS += --no-print-directory
yann@1156
    21
endif
yann@1156
    22
yann@1156
    23
# Use neither builtin rules, nor builtin variables
yann@1156
    24
# Note: dual test, because if -R and -r are given on the command line
yann@1156
    25
# (who knows?), MAKEFLAGS contains 'Rr' instead of '-Rr', while adding
yann@1156
    26
# '-Rr' to MAKEFLAGS adds it literaly ( and does not add 'Rr' )
yann@1156
    27
ifeq ($(filter Rr,$(MAKEFLAGS)),)
yann@1156
    28
ifeq ($(filter -Rr,$(MAKEFLAGS)),)
yann@1156
    29
CT_MAKEFLAGS += -Rr
yann@1156
    30
endif # No -Rr
yann@1156
    31
endif # No Rr
yann@1156
    32
yann@1156
    33
# Remove any suffix rules
yann@1156
    34
.SUFFIXES:
yann@554
    35
yann@382
    36
all: Makefile build
yann@382
    37
yann@1047
    38
###############################################################################
yann@182
    39
# Configuration variables
yann@182
    40
yann@2834
    41
# Stuff found by ./configure
yann@2835
    42
export DATE            := @DATE@
yann@2835
    43
export LOCAL           := @enable_local@
yann@2835
    44
export PROG_SED        := @program_transform_name@
yann@2835
    45
export PACKAGE_TARNAME := @PACKAGE_TARNAME@
yann@2835
    46
export VERSION         := @PACKAGE_VERSION@
yann@2835
    47
export prefix          := @prefix@
yann@2835
    48
export exec_prefix     := @exec_prefix@
yann@2835
    49
export bindir          := @bindir@
yann@2835
    50
export libdir          := @libdir@@sublibdir@
yann@2835
    51
export docdir          := @docdir@@subdocdir@
yann@2835
    52
export mandir          := @mandir@
yann@2835
    53
export datarootdir     := @datarootdir@
yann@2835
    54
export install         := @INSTALL@
yann@2835
    55
export bash            := @_BASH@
yann@2999
    56
export awk             := @_AWK@
yann@2839
    57
export grep            := @GREP@
yann@2835
    58
export make            := @MAKE@
yann@2835
    59
export sed             := @SED@
yann@2835
    60
export libtool         := @LIBTOOL@
yann@2835
    61
export libtoolize      := @LIBTOOLIZE@
yann@2835
    62
export objcopy         := @OBJCOPY@
yann@2835
    63
export objdump         := @OBJDUMP@
yann@2835
    64
export readelf         := @READELF@
yann@2835
    65
export patch           := @PATCH@
yann@2835
    66
export CC              := @CC@
yann@2835
    67
export CPP             := @CPP@
yann@2835
    68
export CPPFLAGS        := @CPPFLAGS@
yann@2835
    69
export CFLAGS          := @CFLAGS@
yann@2835
    70
export LDFLAGS         := @LDFLAGS@
yann@2835
    71
export LIBS            := @LIBS@
yann@2835
    72
export curses_hdr      := @ac_ct_curses_hdr@
yann@2835
    73
export gettext         := @gettext@
yann@1109
    74
yann@2481
    75
# config options to push down to kconfig
yann@2834
    76
KCONFIG:= @kconfig_options@
yann@2481
    77
yann@1109
    78
###############################################################################
yann@2026
    79
# Non-configure variables
yann@2026
    80
MAN_SECTION := 1
yann@2026
    81
MAN_SUBDIR := /man$(MAN_SECTION)
yann@2026
    82
yann@2834
    83
PROG_NAME := $(shell echo 'ct-ng' |$(sed) -r -e '$(PROG_SED)' )
yann@2620
    84
yann@2026
    85
###############################################################################
yann@1109
    86
# Sanity checks
yann@1109
    87
yann@1109
    88
# Check if Makefile is up to date:
yann@1109
    89
Makefile: Makefile.in
yann@1109
    90
	@echo "$< did changed: you must re-run './configure'"
yann@1109
    91
	@false
yann@1109
    92
yann@1109
    93
# If installing with DESTDIR, check it's an absolute path
yann@1109
    94
ifneq ($(strip $(DESTDIR)),)
yann@1109
    95
  ifneq ($(DESTDIR),$(abspath /$(DESTDIR)))
yann@1109
    96
    $(error DESTDIR is not an absolute PATH: '$(DESTDIR)')
yann@1109
    97
  endif
yann@1109
    98
endif
yann@182
    99
yann@182
   100
###############################################################################
yann@182
   101
# Global make rules
yann@182
   102
yann@1156
   103
# If any extra MAKEFLAGS were added, re-run ourselves
yann@1156
   104
# See top of file for an explanation of why this is needed...
yann@1156
   105
ifneq ($(strip $(CT_MAKEFLAGS)),)
yann@1156
   106
yann@2505
   107
# Somehow, the new auto-completion for make in the recent distributions
yann@2505
   108
# trigger a behavior where our Makefile calls itself recursively, in a
yann@2505
   109
# never-ending loop (except on lack of ressources, swap, PIDs...)
yann@2505
   110
# Avoid this situation by cutting the recursion short at the first
yann@2505
   111
# level.
yann@2505
   112
# This has the side effect of only showing the real targets, and hiding our
yann@2505
   113
# internal ones. :-)
yann@2505
   114
ifneq ($(MAKELEVEL),0)
yann@2505
   115
$(error Recursion detected, bailing out...)
yann@2505
   116
endif
yann@2505
   117
yann@1156
   118
MAKEFLAGS += $(CT_MAKEFLAGS)
yann@2834
   119
build install clean distclean mrproper uninstall:
yann@1156
   120
	@$(MAKE) $@
yann@1156
   121
yann@1156
   122
else
yann@1156
   123
# There were no additional MAKEFLAGS to add, do the job
yann@1156
   124
yann@2835
   125
TARGETS := bin lib lib-kconfig doc man
yann@182
   126
yann@555
   127
build: $(patsubst %,build-%,$(TARGETS))
yann@182
   128
yann@1101
   129
install: build real-install
yann@555
   130
yann@555
   131
clean: $(patsubst %,clean-%,$(TARGETS))
yann@182
   132
yann@182
   133
distclean: clean
yann@554
   134
	@echo "  RM     'Makefile'"
yann@182
   135
	@rm -f Makefile
yann@182
   136
yann@2834
   137
mrproper: distclean
yann@2834
   138
	@echo "  RM     'autostuff'"
yann@2834
   139
	@ rm -rf autom4te.cache config.log config.status configure
yann@2834
   140
yann@1048
   141
uninstall: real-uninstall
yann@182
   142
yann@182
   143
###############################################################################
yann@182
   144
# Specific make rules
yann@182
   145
yann@182
   146
#--------------------------------------
yann@182
   147
# Build rules
yann@182
   148
yann@2835
   149
build-bin: $(PROG_NAME)             \
yann@2835
   150
           scripts/crosstool-NG.sh  \
yann@2835
   151
           scripts/saveSample.sh    \
yann@2835
   152
           scripts/showTuple.sh
yann@1297
   153
	@chmod 755 $^
yann@182
   154
yann@2838
   155
build-lib: config/configure.in  \
yann@2838
   156
           paths.mk             \
yann@2838
   157
           paths.sh
yann@2835
   158
yann@2835
   159
build-lib-kconfig:
yann@2835
   160
	@$(MAKE) -C kconfig
yann@182
   161
yann@555
   162
build-doc:
yann@555
   163
yann@2620
   164
build-man: docs/$(PROG_NAME).1.gz
yann@309
   165
yann@2620
   166
docs/$(PROG_NAME).1.gz: docs/$(PROG_NAME).1
yann@554
   167
	@echo "  GZIP   '$@'"
yann@317
   168
	@gzip -c9 $< >$@
yann@182
   169
yann@2621
   170
define sed_it
yann@2621
   171
	@echo "  SED    '$@'"
yann@2834
   172
	@$(sed) -r -e 's,@@CT_BINDIR@@,$(bindir),g;'        \
yann@2834
   173
	           -e 's,@@CT_LIBDIR@@,$(libdir),g;'        \
yann@2834
   174
	           -e 's,@@CT_DOCDIR@@,$(docdir),g;'        \
yann@2834
   175
	           -e 's,@@CT_MANDIR@@,$(mandir),g;'        \
yann@2621
   176
	           -e 's,@@CT_PROG_NAME@@,$(PROG_NAME),g;'  \
yann@2621
   177
	           -e 's,@@CT_VERSION@@,$(VERSION),g;'	    \
yann@2621
   178
	           -e 's,@@CT_DATE@@,$(DATE),g;'            \
yann@2621
   179
	           -e 's,@@CT_make@@,$(make),g;'            \
yann@2621
   180
	           -e 's,@@CT_bash@@,$(bash),g;'            \
yann@2999
   181
	           -e 's,@@CT_awk@@,$(awk),g;'              \
yann@2621
   182
	           $< >$@
yann@2621
   183
endef
yann@2621
   184
yann@2622
   185
docs/$(PROG_NAME).1: docs/ct-ng.1.in Makefile
yann@2622
   186
	$(call sed_it)
yann@2622
   187
yann@2623
   188
$(PROG_NAME): ct-ng.in Makefile
yann@2621
   189
	$(call sed_it)
yann@2621
   190
yann@470
   191
%: %.in Makefile
yann@2621
   192
	$(call sed_it)
yann@1153
   193
yann@1153
   194
# We create a script fragment that is parseable from inside a Makefile,
yann@2838
   195
# and one from inside a shell script
yann@2481
   196
paths.mk: FORCE
yann@1153
   197
	@echo "  GEN    '$@'"
yann@2838
   198
	@(echo 'export install=$(install)';         \
yann@2838
   199
	  echo 'export bash=$(bash)';               \
yann@2999
   200
	  echo 'export awk=$(awk)';                 \
yann@2838
   201
	  echo 'export grep=$(grep)';               \
yann@2838
   202
	  echo 'export make=$(make)';               \
yann@2838
   203
	  echo 'export sed=$(sed)';                 \
yann@2838
   204
	  echo 'export libtool=$(libtool)';         \
yann@2838
   205
	  echo 'export libtoolize=$(libtoolize)';   \
yann@2838
   206
	  echo 'export objcopy=$(objcopy)';         \
yann@2838
   207
	  echo 'export objdump=$(objdump)';         \
yann@2838
   208
	  echo 'export readelf=$(readelf)';         \
yann@2838
   209
	  echo 'export patch=$(patch)';             \
yann@2838
   210
	 ) >$@
yann@2838
   211
yann@2838
   212
paths.sh: FORCE
yann@2838
   213
	@echo "  GEN    '$@'"
yann@2838
   214
	@(echo 'export install="$(install)"';       \
yann@2838
   215
	  echo 'export bash="$(bash)"';             \
yann@2999
   216
	  echo 'export awk="$(awk)"';               \
yann@2838
   217
	  echo 'export grep="$(grep)"';             \
yann@2838
   218
	  echo 'export make="$(make)"';             \
yann@2838
   219
	  echo 'export sed="$(sed)"';               \
yann@2838
   220
	  echo 'export libtool="$(libtool)"';       \
yann@2838
   221
	  echo 'export libtoolize="$(libtoolize)"'; \
yann@2838
   222
	  echo 'export objcopy="$(objcopy)"';       \
yann@2838
   223
	  echo 'export objdump="$(objdump)"';       \
yann@2838
   224
	  echo 'export readelf="$(readelf)"';       \
yann@2838
   225
	  echo 'export patch="$(patch)"';           \
yann@2838
   226
	 ) >$@
yann@182
   227
yann@2481
   228
config/configure.in: FORCE
yann@2481
   229
	@echo "  GEN    '$@'"
yann@2481
   230
	@{  printf "# Generated file, do not edit\n";            \
yann@2481
   231
	    printf "# Default values as found by ./configure\n"; \
yann@2481
   232
	    for var in $(KCONFIG); do                            \
yann@2481
   233
	        printf "\n";                                     \
yann@2481
   234
	        printf "config CONFIGURE_$${var%%=*}\n";         \
yann@2481
   235
	        if [ "$${var#*=}" = "y" ]; then                  \
yann@2631
   236
	            printf "    def_bool y\n";                   \
yann@2631
   237
	        else                                             \
yann@2631
   238
	            printf "    bool\n";                         \
yann@2481
   239
	        fi;                                              \
yann@2481
   240
	    done;                                                \
yann@2481
   241
	 } >$@
yann@2481
   242
yann@2481
   243
FORCE:
yann@2481
   244
yann@182
   245
#--------------------------------------
yann@182
   246
# Clean rules
yann@182
   247
yann@182
   248
clean-bin:
yann@2620
   249
	@echo "  RM     '$(PROG_NAME)'"
yann@2620
   250
	@rm -f $(PROG_NAME)
yann@1339
   251
	@echo "  RM     'scripts/crosstool-NG.sh'"
yann@1158
   252
	@rm -f scripts/crosstool-NG.sh
yann@1339
   253
	@echo "  RM     'scripts/saveSample.sh'"
yann@1186
   254
	@rm -f scripts/saveSample.sh
yann@1339
   255
	@echo "  RM     'scripts/showTuple.sh'"
yann@1336
   256
	@rm -f scripts/showTuple.sh
yann@182
   257
yann@182
   258
clean-lib:
yann@2838
   259
	@echo "  RM     'paths'"
yann@2838
   260
	@rm -f paths.mk paths.sh
yann@2481
   261
	@echo "  RM     'config/configure.in'"
yann@2481
   262
	@rm -f config/configure.in
yann@182
   263
yann@2835
   264
clean-lib-kconfig:
yann@2835
   265
	@$(MAKE) -C kconfig clean
yann@2835
   266
yann@182
   267
clean-doc:
yann@555
   268
yann@555
   269
clean-man:
yann@2620
   270
	@echo "  RM     'docs/$(PROG_NAME).1'"
yann@2620
   271
	@rm -f docs/$(PROG_NAME).1
yann@2620
   272
	@echo "  RM     'docs/$(PROG_NAME).1.gz'"
yann@2620
   273
	@rm -f docs/$(PROG_NAME).1.gz
yann@182
   274
yann@182
   275
#--------------------------------------
yann@554
   276
# Check for --local setup
yann@182
   277
yann@2834
   278
ifeq ($(strip $(LOCAL)),yes)
yann@1048
   279
yann@1101
   280
real-install:
yann@1297
   281
	@true
yann@1048
   282
yann@1048
   283
real-uninstall:
yann@1048
   284
	@true
yann@1048
   285
yann@1048
   286
else
yann@285
   287
yann@554
   288
#--------------------------------------
yann@554
   289
# Install rules
yann@554
   290
yann@1876
   291
real-install: $(patsubst %,install-%,$(TARGETS)) install-post
yann@1048
   292
yann@2834
   293
install-bin: $(DESTDIR)$(bindir)
yann@2620
   294
	@echo "  INST    '$(PROG_NAME)'"
yann@2834
   295
	@$(install) -m 755 $(PROG_NAME) "$(DESTDIR)$(bindir)/$(PROG_NAME)"
yann@182
   296
yann@555
   297
# If one is hacking crosstool-NG, the patch set might change between any two
yann@555
   298
# installations of the same VERSION, thus the patches must be removed prior
yann@555
   299
# to being installed. It is simpler to remove the whole lib/ directory, as it
yann@555
   300
# is the goal of the install-lib rule to install the lib/ directory...
yann@2835
   301
install-lib: uninstall-lib          \
yann@2835
   302
             $(DESTDIR)$(libdir)    \
yann@2835
   303
             install-lib-main       \
yann@2835
   304
             install-lib-samples
yann@182
   305
yann@2835
   306
LIB_SUB_DIR := config contrib patches scripts
yann@2834
   307
$(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): $(DESTDIR)$(libdir)
yann@1994
   308
	@echo "  INSTDIR '$(patsubst install-lib-%-copy,%,$(@))/'"
yann@1994
   309
	@tar cf - --exclude='*.sh.in' $(patsubst install-lib-%-copy,%,$(@)) \
yann@2834
   310
	 |(cd "$(DESTDIR)$(libdir)"; tar xf -)
yann@1994
   311
yann@1994
   312
# Huh? It seems we need at least one command to make this rule kick-in.
yann@1994
   313
install-lib-%: install-lib-%-copy; @true
yann@1994
   314
yann@1994
   315
# Huh? that one does not inherit the -opy dependency, above...
yann@1994
   316
install-lib-scripts: install-lib-scripts-copy
yann@2834
   317
	@chmod a+x $(DESTDIR)$(libdir)/scripts/crosstool-NG.sh
yann@2834
   318
	@chmod a+x $(DESTDIR)$(libdir)/scripts/saveSample.sh
yann@2834
   319
	@rm -f "$(DESTDIR)$(libdir)/scripts/addToolVersion.sh"
yann@1994
   320
yann@2834
   321
install-lib-main: $(DESTDIR)$(libdir) $(patsubst %,install-lib-%,$(LIB_SUB_DIR))
yann@1994
   322
	@echo "  INST    'steps.mk'"
yann@2834
   323
	@$(install) -m 644 steps.mk "$(DESTDIR)$(libdir)/steps.mk"
yann@2838
   324
	@echo "  INST    'paths'"
yann@2838
   325
	@$(install) -m 644 paths.mk paths.sh "$(DESTDIR)$(libdir)"
yann@182
   326
yann@182
   327
# Samples need a little love:
yann@425
   328
#  - change every occurrence of CT_TOP_DIR to CT_LIB_DIR
yann@2834
   329
install-lib-samples: $(DESTDIR)$(libdir) install-lib-main
yann@1994
   330
	@echo "  INSTDIR 'samples/'"
yann@2577
   331
	@for samp_dir in samples/*/; do                                         \
yann@2834
   332
	     mkdir -p "$(DESTDIR)$(libdir)/$${samp_dir}";                       \
yann@2422
   333
	     $(sed) -r -e 's:\$$\{CT_TOP_DIR\}:\$$\{CT_LIB_DIR\}:;'             \
yann@2422
   334
	               -e 's:^(CT_WORK_DIR)=.*:\1="\$${CT_TOP_DIR}/.build":;'   \
yann@2577
   335
	            $${samp_dir}/crosstool.config                               \
yann@2834
   336
	            >"$(DESTDIR)$(libdir)/$${samp_dir}/crosstool.config";       \
yann@2577
   337
	     $(install) -m 644 "$${samp_dir}/reported.by"                       \
yann@2834
   338
	                       "$(DESTDIR)$(libdir)/$${samp_dir}";              \
yann@2577
   339
	     for libc_cfg in "$${samp_dir}/"*libc*.config; do                   \
yann@2577
   340
	         [ -f "$${libc_cfg}" ] || continue;                             \
yann@2577
   341
	         $(install) -m 644 "$${libc_cfg}"                               \
yann@2834
   342
	                           "$(DESTDIR)$(libdir)/$${samp_dir}";          \
yann@2577
   343
	     done;                                                              \
yann@182
   344
	 done
yann@2834
   345
	@$(install) -m 644 samples/samples.mk "$(DESTDIR)$(libdir)/samples/samples.mk"
yann@182
   346
yann@2835
   347
KCONFIG_FILES := conf mconf nconf kconfig.mk
yann@2835
   348
install-lib-kconfig: $(DESTDIR)$(libdir) install-lib-main
yann@2835
   349
	@echo "  INST    'kconfig/'"
titus@3103
   350
	@mkdir -p "$(DESTDIR)$(libdir)/kconfig"
yann@2835
   351
	@for f in $(KCONFIG_FILES); do                                      \
titus@3103
   352
	    install "kconfig/$${f}" "$(DESTDIR)$(libdir)/kconfig/$${f}";    \
yann@2835
   353
	 done
yann@2835
   354
yann@2834
   355
install-doc: $(DESTDIR)$(docdir)
yann@2076
   356
	@echo "  INST    'docs/*.txt'"
yann@2076
   357
	@for doc_file in docs/*.txt; do                              \
yann@2834
   358
	     $(install) -m 644 "$${doc_file}" "$(DESTDIR)$(docdir)"; \
yann@182
   359
	 done
yann@249
   360
yann@2834
   361
install-man: $(DESTDIR)$(mandir)$(MAN_SUBDIR)
yann@2620
   362
	@echo "  INST    '$(PROG_NAME).1.gz'"
yann@2834
   363
	@$(install) -m 644 docs/$(PROG_NAME).1.gz "$(DESTDIR)$(mandir)$(MAN_SUBDIR)"
yann@182
   364
yann@2834
   365
$(sort $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(docdir) $(DESTDIR)$(mandir)$(MAN_SUBDIR)):
yann@1994
   366
	@echo "  MKDIR   '$@/'"
yann@1153
   367
	@$(install) -m 755 -d "$@"
yann@182
   368
yann@1876
   369
install-post:
yann@1876
   370
	@echo
yann@2620
   371
	@echo "For auto-completion, do not forget to install '$(PROG_NAME).comp' into"
yann@1994
   372
	@echo "your bash completion directory (usually /etc/bash_completion.d)"
yann@182
   373
yann@182
   374
#--------------------------------------
yann@182
   375
# Uninstall rules
yann@182
   376
yann@1048
   377
real-uninstall: $(patsubst %,uninstall-%,$(TARGETS))
yann@1048
   378
yann@554
   379
uninstall-bin:
yann@2834
   380
	@echo "  RM      '$(DESTDIR)$(bindir)/$(PROG_NAME)'"
yann@2834
   381
	@rm -f "$(DESTDIR)$(bindir)/$(PROG_NAME)"
yann@182
   382
yann@554
   383
uninstall-lib:
yann@2834
   384
	@echo "  RMDIR   '$(DESTDIR)$(libdir)/'"
yann@2834
   385
	@rm -rf "$(DESTDIR)$(libdir)"
yann@298
   386
yann@554
   387
uninstall-doc:
yann@2834
   388
	@echo "  RMDIR   '$(DESTDIR)$(docdir)/'"
yann@2834
   389
	@rm -rf "$(DESTDIR)$(docdir)"
yann@554
   390
yann@554
   391
uninstall-man:
yann@2834
   392
	@echo "  RM      '$(DESTDIR)$(mandir)$(MAN_SUBDIR)/$(PROG_NAME).1.gz'"
yann@2834
   393
	@rm -f "$(DESTDIR)$(mandir)$(MAN_SUBDIR)/$(PROG_NAME).1"{,.gz}
yann@1048
   394
yann@1048
   395
endif # Not --local
yann@1156
   396
yann@1156
   397
endif # No extra MAKEFLAGS were added
michael@2694
   398
michael@2694
   399
.PHONY: build $(patsubst %,build-%,$(TARGETS)) install