1# =========================================================================== 2# Kernel configuration targets 3# These targets are used from top-level makefile 4 5PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \ 6 localmodconfig localyesconfig 7 8ifdef KBUILD_KCONFIG 9Kconfig := $(KBUILD_KCONFIG) 10else 11Kconfig := Kconfig 12endif 13 14xconfig: $(obj)/qconf 15 $< $(Kconfig) 16 17gconfig: $(obj)/gconf 18 $< $(Kconfig) 19 20menuconfig: $(obj)/mconf 21 $< $(Kconfig) 22 23config: $(obj)/conf 24 $< --oldaskconfig $(Kconfig) 25 26nconfig: $(obj)/nconf 27 $< $(Kconfig) 28 29oldconfig: $(obj)/conf 30 $< --$@ $(Kconfig) 31 32silentoldconfig: $(obj)/conf 33 $(Q)mkdir -p include/generated 34 $< --$@ $(Kconfig) 35 36# if no path is given, then use src directory to find file 37ifdef LSMOD 38LSMOD_F := $(LSMOD) 39ifeq ($(findstring /,$(LSMOD)),) 40 LSMOD_F := $(objtree)/$(LSMOD) 41endif 42endif 43 44localmodconfig: $(obj)/streamline_config.pl $(obj)/conf 45 $(Q)mkdir -p include/generated 46 $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config 47 $(Q)if [ -f .config ]; then \ 48 cmp -s .tmp.config .config || \ 49 (mv -f .config .config.old.1; \ 50 mv -f .tmp.config .config; \ 51 $(obj)/conf --silentoldconfig $(Kconfig); \ 52 mv -f .config.old.1 .config.old) \ 53 else \ 54 mv -f .tmp.config .config; \ 55 $(obj)/conf --silentoldconfig $(Kconfig); \ 56 fi 57 $(Q)rm -f .tmp.config 58 59localyesconfig: $(obj)/streamline_config.pl $(obj)/conf 60 $(Q)mkdir -p include/generated 61 $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config 62 $(Q)sed -i s/=m/=y/ .tmp.config 63 $(Q)if [ -f .config ]; then \ 64 cmp -s .tmp.config .config || \ 65 (mv -f .config .config.old.1; \ 66 mv -f .tmp.config .config; \ 67 $(obj)/conf --silentoldconfig $(Kconfig); \ 68 mv -f .config.old.1 .config.old) \ 69 else \ 70 mv -f .tmp.config .config; \ 71 $(obj)/conf --silentoldconfig $(Kconfig); \ 72 fi 73 $(Q)rm -f .tmp.config 74 75# Create new linux.pot file 76# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files 77# The symlink is used to repair a deficiency in arch/um 78update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h 79 $(Q)echo " GEN config" 80 $(Q)xgettext --default-domain=linux \ 81 --add-comments --keyword=_ --keyword=N_ \ 82 --from-code=UTF-8 \ 83 --files-from=$(srctree)/scripts/kconfig/POTFILES.in \ 84 --directory=$(srctree) --directory=$(objtree) \ 85 --output $(obj)/config.pot 86 $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot 87 $(Q)ln -fs Kconfig.x86 arch/um/Kconfig 88 $(Q)(for i in `ls $(srctree)/arch/*/Kconfig`; \ 89 do \ 90 echo " GEN $$i"; \ 91 $(obj)/kxgettext $$i \ 92 >> $(obj)/config.pot; \ 93 done ) 94 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ 95 --output $(obj)/linux.pot 96 $(Q)rm -f $(srctree)/arch/um/Kconfig 97 $(Q)rm -f $(obj)/config.pot 98 99PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig 100 101allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf 102 $< --$@ $(Kconfig) 103 104PHONY += listnewconfig oldnoconfig savedefconfig defconfig 105 106listnewconfig oldnoconfig: $(obj)/conf 107 $< --$@ $(Kconfig) 108 109savedefconfig: $(obj)/conf 110 $< --$@=defconfig $(Kconfig) 111 112defconfig: $(obj)/conf 113 @echo "*** Default configuration is based on '$(PROJ)/.config'" 114 $(Q)$< --defconfig=$(PROJ)/.config $(Kconfig) 115 116%_defconfig: $(obj)/conf 117 $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) 118 119# Help text used by make help 120help: 121 @echo ' config - Update current config utilising a line-oriented program' 122 @echo ' nconfig - Update current config utilising a ncurses menu based program' 123 @echo ' menuconfig - Update current config utilising a menu based program' 124 @echo ' xconfig - Update current config utilising a QT based front-end' 125 @echo ' gconfig - Update current config utilising a GTK based front-end' 126 @echo ' oldconfig - Update current config utilising a provided .config as base' 127 @echo ' localmodconfig - Update current config disabling modules not loaded' 128 @echo ' localyesconfig - Update current config converting local mods to core' 129 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' 130 @echo ' defconfig - New config with default from ARCH supplied defconfig' 131 @echo ' savedefconfig - Save current config as ./defconfig (minimal config)' 132 @echo ' allnoconfig - New config where all options are answered with no' 133 @echo ' allyesconfig - New config where all options are accepted with yes' 134 @echo ' allmodconfig - New config selecting modules when possible' 135 @echo ' alldefconfig - New config with all symbols set to default' 136 @echo ' randconfig - New config with random answer to all options' 137 @echo ' listnewconfig - List new options' 138 @echo ' oldnoconfig - Same as silentoldconfig but set new symbols to n (unset)' 139 140# lxdialog stuff 141check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh 142 143# Use recursively expanded variables so we do not call gcc unless 144# we really need to do so. (Do not call gcc as part of make mrproper) 145HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ 146 -DLOCALE 147 148# =========================================================================== 149# Shared Makefile for the various kconfig executables: 150# conf: Used for defconfig, oldconfig and related targets 151# nconf: Used for the nconfig target. 152# Utilizes ncurses 153# mconf: Used for the menuconfig target 154# Utilizes the lxdialog package 155# qconf: Used for the xconfig target 156# Based on QT which needs to be installed to compile it 157# gconf: Used for the gconfig target 158# Based on GTK which needs to be installed to compile it 159# object files used by all kconfig flavours 160 161lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o 162lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o 163 164conf-objs := conf.o zconf.tab.o 165mconf-objs := mconf.o zconf.tab.o $(lxdialog) 166nconf-objs := nconf.o zconf.tab.o nconf.gui.o 167kxgettext-objs := kxgettext.o zconf.tab.o 168qconf-cxxobjs := qconf.o 169qconf-objs := kconfig_load.o zconf.tab.o 170gconf-objs := gconf.o kconfig_load.o zconf.tab.o 171 172hostprogs-y := conf 173 174ifeq ($(MAKECMDGOALS),nconfig) 175 hostprogs-y += nconf 176endif 177 178ifeq ($(MAKECMDGOALS),menuconfig) 179 hostprogs-y += mconf 180endif 181 182ifeq ($(MAKECMDGOALS),update-po-config) 183 hostprogs-y += kxgettext 184endif 185 186ifeq ($(MAKECMDGOALS),xconfig) 187 qconf-target := 1 188endif 189ifeq ($(MAKECMDGOALS),gconfig) 190 gconf-target := 1 191endif 192 193 194ifeq ($(qconf-target),1) 195 hostprogs-y += qconf 196endif 197 198ifeq ($(gconf-target),1) 199 hostprogs-y += gconf 200endif 201 202clean-files := lkc_defs.h qconf.moc .tmp_qtcheck .tmp_gtkcheck 203clean-files += zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h 204clean-files += mconf qconf gconf nconf 205clean-files += config.pot linux.pot 206 207# Check that we have the required ncurses stuff installed for lxdialog (menuconfig) 208PHONY += $(obj)/dochecklxdialog 209$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog 210$(obj)/dochecklxdialog: 211 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf) 212 213always := dochecklxdialog 214 215# Add environment specific flags 216HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) 217 218# generated files seem to need this to find local include files 219HOSTCFLAGS_lex.zconf.o := -I$(src) 220HOSTCFLAGS_zconf.tab.o := -I$(src) 221 222HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl 223HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK 224 225HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl 226HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ 227 -D LKC_DIRECT_LINK 228 229HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) 230 231HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses 232$(obj)/qconf.o: $(obj)/.tmp_qtcheck 233 234ifeq ($(qconf-target),1) 235$(obj)/.tmp_qtcheck: $(src)/Makefile 236-include $(obj)/.tmp_qtcheck 237 238# QT needs some extra effort... 239$(obj)/.tmp_qtcheck: 240 @set -e; echo " CHECK qt"; dir=""; pkg=""; \ 241 if ! pkg-config --exists QtCore 2> /dev/null; then \ 242 echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \ 243 pkg-config --exists qt 2> /dev/null && pkg=qt; \ 244 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ 245 if [ -n "$$pkg" ]; then \ 246 cflags="\$$(shell pkg-config $$pkg --cflags)"; \ 247 libs="\$$(shell pkg-config $$pkg --libs)"; \ 248 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ 249 dir="$$(pkg-config $$pkg --variable=prefix)"; \ 250 else \ 251 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ 252 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ 253 done; \ 254 if [ -z "$$dir" ]; then \ 255 echo "*"; \ 256 echo "* Unable to find any QT installation. Please make sure that"; \ 257 echo "* the QT4 or QT3 development package is correctly installed and"; \ 258 echo "* either qmake can be found or install pkg-config or set"; \ 259 echo "* the QTDIR environment variable to the correct location."; \ 260 echo "*"; \ 261 false; \ 262 fi; \ 263 libpath=$$dir/lib; lib=qt; osdir=""; \ 264 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \ 265 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \ 266 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \ 267 test -f $$libpath/libqt-mt.so && lib=qt-mt; \ 268 cflags="-I$$dir/include"; \ 269 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \ 270 moc="$$dir/bin/moc"; \ 271 fi; \ 272 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \ 273 echo "*"; \ 274 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \ 275 echo "*"; \ 276 moc="/usr/bin/moc"; \ 277 fi; \ 278 else \ 279 cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \ 280 libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \ 281 binpath="\$$(shell pkg-config QtCore --variable=prefix)"; \ 282 moc="$$binpath/bin/moc"; \ 283 fi; \ 284 echo "KC_QT_CFLAGS=$$cflags" > $@; \ 285 echo "KC_QT_LIBS=$$libs" >> $@; \ 286 echo "KC_QT_MOC=$$moc" >> $@ 287endif 288 289$(obj)/gconf.o: $(obj)/.tmp_gtkcheck 290 291ifeq ($(gconf-target),1) 292-include $(obj)/.tmp_gtkcheck 293 294# GTK needs some extra effort, too... 295$(obj)/.tmp_gtkcheck: 296 @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \ 297 if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ 298 touch $@; \ 299 else \ 300 echo "*"; \ 301 echo "* GTK+ is present but version >= 2.0.0 is required."; \ 302 echo "*"; \ 303 false; \ 304 fi \ 305 else \ 306 echo "*"; \ 307 echo "* Unable to find the GTK+ installation. Please make sure that"; \ 308 echo "* the GTK+ 2.0 development package is correctly installed..."; \ 309 echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ 310 echo "*"; \ 311 false; \ 312 fi 313endif 314 315$(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c 316 317$(obj)/kconfig_load.o: $(obj)/lkc_defs.h 318 319$(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h 320 321$(obj)/gconf.o: $(obj)/lkc_defs.h 322 323$(obj)/%.moc: $(src)/%.h 324 $(KC_QT_MOC) -i $< -o $@ 325 326$(obj)/lkc_defs.h: $(src)/lkc_proto.h 327 $(Q)sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' 328 329# Extract gconf menu items for I18N support 330$(obj)/gconf.glade.h: $(obj)/gconf.glade 331 $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ 332 $(obj)/gconf.glade 333 334### 335# The following requires flex/bison/gperf 336# By default we use the _shipped versions, uncomment the following line if 337# you are modifying the flex/bison src. 338# LKC_GENPARSER := 1 339 340ifdef LKC_GENPARSER 341 342$(obj)/zconf.tab.c: $(src)/zconf.y 343$(obj)/lex.zconf.c: $(src)/zconf.l 344$(obj)/zconf.hash.c: $(src)/zconf.gperf 345 346%.tab.c: %.y 347 bison -l -b $* -p $(notdir $*) $< 348 cp $@ $@_shipped 349 350lex.%.c: %.l 351 flex -L -P$(notdir $*) -o$@ $< 352 cp $@ $@_shipped 353 354%.hash.c: %.gperf 355 gperf < $< > $@ 356 cp $@ $@_shipped 357 358endif 359