config/config.mk
author Arnaud Lacombe <lacombar@gmail.com>
Thu Aug 05 17:59:51 2010 +0200 (2010-08-05)
changeset 2069 366bd2b22675
parent 1878 2c577664a23d
child 2444 896cb0d36c1a
permissions -rw-r--r--
complibs/mpc: fix MPC 0.8.1 build with MPFR 3.0.0

This is the change introduced by revision 734 of MPC repository.

Author: Paul Zimmermann <Paul.Zimmermann@loria.fr>
Revision log: [acos.c] fixed problem with GMP_RNDA (should be MPFR_RNDA, and code was wrong)

Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
yann@1
     1
# ===========================================================================
yann@945
     2
# crosstool-NG genererated config files
yann@1
     3
# These targets are used from top-level makefile
yann@1
     4
yann@926
     5
#-----------------------------------------------------------
yann@1001
     6
# List all config files, wether sourced or generated
yann@97
     7
yann@945
     8
# The top-level config file to be used be configurators
yann@945
     9
KCONFIG_TOP = config/config.in
yann@945
    10
yann@926
    11
# Build the list of all source config files
yann@1976
    12
STATIC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(shell find $(CT_LIB_DIR)/config -type f \( -name '*.in' -o -name '*.in.2' \) 2>/dev/null))
yann@926
    13
# ... and how to access them:
yann@926
    14
$(STATIC_CONFIG_FILES): config
yann@88
    15
yann@926
    16
# Build a list of per-component-type source config files
yann@1976
    17
ARCH_CONFIG_FILES     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in))
yann@1976
    18
ARCH_CONFIG_FILES_2   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in.2))
yann@1976
    19
KERNEL_CONFIG_FILES   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in))
yann@1976
    20
KERNEL_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in.2))
yann@1976
    21
CC_CONFIG_FILES       = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in))
yann@1976
    22
CC_CONFIG_FILES_2     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in.2))
yann@1976
    23
LIBC_CONFIG_FILES     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in))
yann@1976
    24
LIBC_CONFIG_FILES_2   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in.2))
yann@1976
    25
DEBUG_CONFIG_FILES    = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/debug/*.in))
yann@182
    26
yann@926
    27
# Build the list of generated config files
yann@926
    28
GEN_CONFIG_FILES = config.gen/arch.in     \
yann@926
    29
                   config.gen/kernel.in   \
yann@926
    30
                   config.gen/cc.in       \
yann@926
    31
                   config.gen/libc.in     \
yann@926
    32
                   config.gen/debug.in
yann@926
    33
# ... and how to access them:
yann@945
    34
# Generated files depends on config.mk (this file) because it has the
yann@926
    35
# functions needed to build the genrated files, and thus they might
yann@945
    36
# need re-generation if config.mk changes
yann@926
    37
$(GEN_CONFIG_FILES): config.gen                         \
yann@945
    38
                     $(CT_LIB_DIR)/config/config.mk
yann@182
    39
yann@945
    40
# Helper entry for the configurators
yann@945
    41
PHONY += config_files
yann@945
    42
config_files: $(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
yann@182
    43
yann@926
    44
# Where to access to the source config files from
yann@926
    45
config:
yann@940
    46
	@$(ECHO) "  LN    config"
yann@940
    47
	$(SILENT)ln -s $(CT_LIB_DIR)/config config
yann@926
    48
yann@926
    49
# Where to store the generated config files into
yann@926
    50
config.gen:
yann@940
    51
	@$(ECHO) "  MKDIR config.gen"
yann@940
    52
	$(SILENT)mkdir -p config.gen
yann@926
    53
yann@926
    54
#-----------------------------------------------------------
yann@926
    55
# Build list of per-component-type items to easily build generated files
yann@926
    56
yann@926
    57
ARCHS   = $(patsubst config/arch/%.in,%,$(ARCH_CONFIG_FILES))
yann@926
    58
KERNELS = $(patsubst config/kernel/%.in,%,$(KERNEL_CONFIG_FILES))
yann@926
    59
CCS     = $(patsubst config/cc/%.in,%,$(CC_CONFIG_FILES))
yann@926
    60
LIBCS   = $(patsubst config/libc/%.in,%,$(LIBC_CONFIG_FILES))
yann@926
    61
DEBUGS  = $(patsubst config/debug/%.in,%,$(DEBUG_CONFIG_FILES))
yann@926
    62
yann@926
    63
#-----------------------------------------------------------
yann@926
    64
# Helper functions to ease building generated config files
yann@926
    65
yann@926
    66
# The function 'build_gen_choice_in' builds a choice-menu of a list of
yann@926
    67
# components in the given list, also adding source-ing of associazted
yann@926
    68
# config files:
yann@912
    69
# $1 : destination file
yann@912
    70
# $2 : name for the entries family (eg. Architecture, kernel...)
yann@912
    71
# $3 : prefix for the choice entries (eg. ARCH, KERNEL...)
yann@912
    72
# $4 : base directory containing config files
yann@1868
    73
# $5 : generate backend conditionals if Y, don't if anything else
yann@1868
    74
# $6 : list of config entries (eg. for architectures: "alpha arm ia64"...,
yann@912
    75
#      and for kernels: "bare-metal linux"...)
yann@912
    76
# Example to build the kernels generated config file:
yann@920
    77
# $(call build_gen_choice_in,config.gen/kernel.in,Target OS,KERNEL,config/kernel,$(KERNELS))
yann@912
    78
define build_gen_choice_in
yann@940
    79
	@$(ECHO) '  IN    $(1)'
yann@1159
    80
	$(SILENT)(echo "# $(2) menu";                                           \
yann@1159
    81
	  echo "# Generated file, do not edit!!!";                              \
yann@1159
    82
	  echo "";                                                              \
yann@1159
    83
	  echo "choice";                                                        \
yann@1159
    84
	  echo "    bool";                                                      \
yann@1159
    85
	  echo "    prompt \"$(2)\"";                                           \
yann@1159
    86
	  echo "";                                                              \
yann@1868
    87
	  for entry in $(6); do                                                 \
yann@1159
    88
	    file="$(4)/$${entry}.in";                                           \
yann@1159
    89
	    _entry=$$(echo "$${entry}" |$(sed) -r -s -e 's/[-.+]/_/g;');        \
yann@1159
    90
	    echo "config $(3)_$${_entry}";                                      \
yann@1159
    91
	    echo "    bool";                                                    \
yann@1269
    92
	    echo "    prompt \"$${entry}\"";                                    \
yann@1269
    93
	    dep_val=$$($(grep) -E '^# depends on ' $${file} 2>/dev/null);       \
yann@1269
    94
	    if [ -n "$${dep_val}" ]; then                                       \
yann@1269
    95
	      echo "    $${dep_val#\# }";                                       \
yann@1159
    96
	    fi;                                                                 \
yann@1868
    97
	    if [ "$(5)" = "Y" ]; then                                           \
yann@1877
    98
	      echo "    depends on $(3)_$${_entry}_AVAILABLE";                  \
yann@1868
    99
	    fi;                                                                 \
yann@1256
   100
	    echo "";                                                            \
yann@1159
   101
	  done;                                                                 \
yann@1159
   102
	  echo "endchoice";                                                     \
yann@1868
   103
	  for entry in $(6); do                                                 \
yann@1159
   104
	    file="$(4)/$${entry}.in";                                           \
yann@1159
   105
	    _entry=$$(echo "$${entry}" |$(sed) -r -s -e 's/[-.+]/_/g;');        \
yann@1159
   106
	    echo "";                                                            \
yann@1877
   107
	    if [ "$(5)" = "Y" ]; then                                                                           \
yann@1877
   108
	      echo "config $(3)_$${_entry}_AVAILABLE";                                                          \
yann@1877
   109
	      echo "    bool";                                                                                  \
yann@1877
   110
	      echo "    default n if ! ( BACKEND_$(3) = \"$${entry}\" || BACKEND_$(3) = \"\" || ! BACKEND )";   \
yann@1877
   111
	      echo "    default y if BACKEND_$(3) = \"$${entry}\" || BACKEND_$(3) = \"\" || ! BACKEND";         \
yann@1877
   112
	    fi;                                                                                                 \
yann@1159
   113
	    echo "if $(3)_$${_entry}";                                          \
yann@1159
   114
	    echo "config $(3)";                                                 \
yann@1159
   115
	    echo "    default \"$${entry}\" if $(3)_$${_entry}";                \
yann@1870
   116
	    echo "source \"$${file}\"";                                         \
yann@1159
   117
	    echo "endif";                                                       \
yann@1159
   118
	  done;                                                                 \
yann@1178
   119
	  echo "";                                                              \
yann@1178
   120
	  for file in $(wildcard $(4)/*.in-common); do                          \
yann@1870
   121
	    echo "source \"$${file}\"";                                         \
yann@1178
   122
	  done;                                                                 \
yann@912
   123
	 ) >$(1)
yann@1976
   124
	$(SILENT)(echo "# $(2) second part options";                            \
yann@1976
   125
	  echo "# Generated file, do not edit!!!";                              \
yann@1976
   126
	  for entry in $(6); do                                                 \
yann@1976
   127
	    file="$(4)/$${entry}.in";                                           \
yann@1976
   128
	    _entry=$$(echo "$${entry}" |$(sed) -r -s -e 's/[-.+]/_/g;');        \
yann@1976
   129
	    if [ -f "$${file}.2" ]; then                                        \
yann@1976
   130
	      echo "";                                                          \
yann@1976
   131
	      echo "if $(3)_$${_entry}";                                        \
yann@1976
   132
	      echo "comment \"$${entry} other options\"";                       \
yann@1976
   133
	      echo "source \"$${file}.2\"";                                     \
yann@1976
   134
	      echo "endif";                                                     \
yann@1976
   135
	    fi;                                                                 \
yann@1976
   136
	  done;                                                                 \
yann@1976
   137
	 ) >$(1).2
yann@912
   138
endef
yann@628
   139
yann@926
   140
# The function 'build_gen_menu_in' builds a menuconfig for each component in
yann@926
   141
# the given list, source-ing the associated files conditionnaly:
yann@916
   142
# $1 : destination file
yann@916
   143
# $2 : name of entries family (eg. Tools, Debug...)
yann@1854
   144
# $3 : prefix for the menu entries (eg. DEBUG)
yann@916
   145
# $4 : base directory containing config files
yann@1854
   146
# $5 : list of config entries (eg. for debug: "dmalloc duma gdb"...)
yann@1854
   147
# Example to build the generated debug config file:
yann@1854
   148
# $(call build_gen_menu_in,config.gen/debug.in,Debug,DEBUG,config/debug,$(DEBUGS))
yann@916
   149
define build_gen_menu_in
yann@940
   150
	@$(ECHO) '  IN    $(1)'
yann@1159
   151
	$(SILENT)(echo "# $(2) facilities menu";                                \
yann@1159
   152
	  echo "# Generated file, do not edit!!!";                              \
yann@1159
   153
	  echo "";                                                              \
yann@1159
   154
	  for entry in $(5); do                                                 \
yann@1159
   155
	    file="$(4)/$${entry}.in";                                           \
yann@1159
   156
	    _entry=$$(echo "$${entry}" |$(sed) -r -s -e 's/[-.+]/_/g;');        \
yann@1159
   157
	    echo "menuconfig $(3)_$${_entry}";                                  \
yann@1159
   158
	    echo "    bool";                                                    \
yann@1269
   159
	    echo "    prompt \"$${entry}\"";                                    \
yann@1269
   160
	    dep_val=$$($(grep) -E '^# depends on ' $${file} 2>/dev/null);       \
yann@1269
   161
	    if [ -n "$${dep_val}" ]; then                                       \
yann@1269
   162
	      echo "    $${dep_val#\# }";                                       \
yann@1159
   163
	    fi;                                                                 \
yann@1159
   164
	    echo "if $(3)_$${_entry}";                                          \
yann@1870
   165
	    echo "source \"$${file}\"";                                         \
yann@1159
   166
	    echo "endif";                                                       \
yann@1159
   167
	    echo "";                                                            \
yann@1159
   168
	  done;                                                                 \
yann@916
   169
	 ) >$(1)
yann@916
   170
endef
yann@916
   171
yann@926
   172
#-----------------------------------------------------------
yann@926
   173
# The rules for the generated config files
yann@916
   174
yann@1976
   175
# WARNING! If a .in file disapears between two runs, that will NOT be detected!
yann@1976
   176
yann@1976
   177
config.gen/arch.in: $(ARCH_CONFIG_FILES) $(ARCH_CONFIG_FILES_2)
yann@1868
   178
	$(call build_gen_choice_in,$@,Target Architecture,ARCH,config/arch,Y,$(ARCHS))
yann@861
   179
yann@1976
   180
config.gen/kernel.in: $(KERNEL_CONFIG_FILES) $(KERNEL_CONFIG_FILES_2)
yann@1868
   181
	$(call build_gen_choice_in,$@,Target OS,KERNEL,config/kernel,Y,$(KERNELS))
yann@182
   182
yann@1976
   183
config.gen/cc.in: $(CC_CONFIG_FILES) $(CC_CONFIG_FILES_2)
yann@1868
   184
	$(call build_gen_choice_in,$@,C compiler,CC,config/cc,,$(CCS))
yann@926
   185
yann@1976
   186
config.gen/libc.in: $(LIBC_CONFIG_FILES) $(LIBC_CONFIG_FILES_2)
yann@1878
   187
	$(call build_gen_choice_in,$@,C library,LIBC,config/libc,Y,$(LIBCS))
yann@926
   188
yann@926
   189
config.gen/debug.in: $(DEBUG_CONFIG_FILES)
yann@926
   190
	$(call build_gen_menu_in,$@,Debug,DEBUG,config/debug,$(DEBUGS))
yann@926
   191
yann@926
   192
#-----------------------------------------------------------
yann@926
   193
# Cleaning up the mess...
yann@926
   194
yann@1
   195
clean::
yann@940
   196
	@$(ECHO) "  CLEAN config"
yann@940
   197
	$(SILENT)rm -f config 2>/dev/null || true
yann@940
   198
	@$(ECHO) "  CLEAN config.gen"
yann@940
   199
	$(SILENT)rm -rf config.gen