Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 1 | # =========================================================================== |
| 2 | # Kernel configuration targets |
| 3 | # These targets are used from top-level makefile |
| 4 | |
| 5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config |
| 6 | |
| 7 | xconfig: $(obj)/qconf |
| 8 | $< Config.in |
| 9 | |
| 10 | gconfig: $(obj)/gconf |
| 11 | $< Config.in |
| 12 | |
| 13 | menuconfig: $(obj)/mconf |
| 14 | $(Q)$(MAKE) $(build)=scripts/kconfig/lxdialog |
| 15 | $< Config.in |
| 16 | |
| 17 | config: $(obj)/conf |
| 18 | $< Config.in |
| 19 | |
Denys Vlasenko | fa1e717 | 2009-11-26 05:25:24 +0100 | [diff] [blame] | 20 | # Mtime granularity problem. |
| 21 | # It was observed that these commands: |
| 22 | # make allnoconfig; sed -i -e '/CONFIG_TRUE/s/.*/CONFIG_TRUE=y/' .config; make |
| 23 | # sometimes produce busybox with "true" applet still disabled. |
| 24 | # This is caused by .config updated by sed having mtime which is still |
| 25 | # equal to (not bigger than) include/autoconf.h's mtime, |
| 26 | # and thus 2nd make does not regenerate include/autoconf.h. |
| 27 | # Waiting for 1 second after non-interactive "make XXXXconfig" |
| 28 | # prevents this from happening. |
| 29 | # |
| 30 | # We'd like to detect whether filesystem we are on has coarse mtimes, |
| 31 | # but can't do it yet, bbox ls hasn't got --full-time. |
| 32 | #MTIME_IS_COARSE:=@ls --full-time -ld | grep -F .000 >/dev/null |
| 33 | MTIME_IS_COARSE:=@true |
| 34 | |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 35 | oldconfig: $(obj)/conf |
| 36 | $< -o Config.in |
Denys Vlasenko | fa1e717 | 2009-11-26 05:25:24 +0100 | [diff] [blame] | 37 | $(MTIME_IS_COARSE) && sleep 1 |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 38 | |
| 39 | silentoldconfig: $(obj)/conf |
| 40 | $< -s Config.in |
Denys Vlasenko | fa1e717 | 2009-11-26 05:25:24 +0100 | [diff] [blame] | 41 | $(MTIME_IS_COARSE) && sleep 1 |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 42 | |
| 43 | update-po-config: $(obj)/kxgettext |
| 44 | xgettext --default-domain=linux \ |
| 45 | --add-comments --keyword=_ --keyword=N_ \ |
| 46 | --files-from=scripts/kconfig/POTFILES.in \ |
| 47 | --output scripts/kconfig/config.pot |
| 48 | $(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch |
| 49 | $(Q)for i in `ls arch/`; \ |
| 50 | do \ |
| 51 | scripts/kconfig/kxgettext arch/$$i/Kconfig \ |
| 52 | | msguniq -o scripts/kconfig/linux_$${i}.pot; \ |
| 53 | done |
| 54 | $(Q)msgcat scripts/kconfig/config.pot \ |
| 55 | `find scripts/kconfig/ -type f -name linux_*.pot` \ |
| 56 | --output scripts/kconfig/linux_raw.pot |
| 57 | $(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \ |
| 58 | --output scripts/kconfig/linux.pot |
| 59 | $(Q)rm -f arch/um/Kconfig_arch |
| 60 | $(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot |
| 61 | |
| 62 | PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig |
| 63 | |
| 64 | randconfig: $(obj)/conf |
| 65 | $< -r Config.in |
Denys Vlasenko | fa1e717 | 2009-11-26 05:25:24 +0100 | [diff] [blame] | 66 | $(MTIME_IS_COARSE) && sleep 1 |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 67 | |
| 68 | allyesconfig: $(obj)/conf |
| 69 | $< -y Config.in |
Denys Vlasenko | fa1e717 | 2009-11-26 05:25:24 +0100 | [diff] [blame] | 70 | $(MTIME_IS_COARSE) && sleep 1 |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 71 | |
| 72 | allnoconfig: $(obj)/conf |
| 73 | $< -n Config.in |
Denys Vlasenko | fa1e717 | 2009-11-26 05:25:24 +0100 | [diff] [blame] | 74 | $(MTIME_IS_COARSE) && sleep 1 |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 75 | |
| 76 | allmodconfig: $(obj)/conf |
| 77 | $< -m Config.in |
Denys Vlasenko | fa1e717 | 2009-11-26 05:25:24 +0100 | [diff] [blame] | 78 | $(MTIME_IS_COARSE) && sleep 1 |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 79 | |
| 80 | defconfig: $(obj)/conf |
| 81 | ifeq ($(KBUILD_DEFCONFIG),) |
| 82 | $< -d Config.in |
| 83 | else |
| 84 | @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)' |
| 85 | $(Q)$< -D $(KBUILD_DEFCONFIG) Config.in |
| 86 | endif |
Denys Vlasenko | fa1e717 | 2009-11-26 05:25:24 +0100 | [diff] [blame] | 87 | $(MTIME_IS_COARSE) && sleep 1 |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 88 | |
| 89 | %_defconfig: $(obj)/conf |
| 90 | $(Q)$< -D $@ Config.in |
Denys Vlasenko | fa1e717 | 2009-11-26 05:25:24 +0100 | [diff] [blame] | 91 | $(MTIME_IS_COARSE) && sleep 1 |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 92 | |
| 93 | # Help text used by make help |
| 94 | help: |
| 95 | @echo ' config - Update current config utilising a line-oriented program' |
| 96 | @echo ' menuconfig - Update current config utilising a menu based program' |
| 97 | @echo ' xconfig - Update current config utilising a QT based front-end' |
| 98 | @echo ' gconfig - Update current config utilising a GTK based front-end' |
| 99 | @echo ' oldconfig - Update current config utilising a provided .config as base' |
| 100 | @echo ' randconfig - New config with random answer to all options' |
| 101 | @echo ' defconfig - New config with default answer to all options' |
| 102 | @echo ' allmodconfig - New config selecting modules when possible' |
| 103 | @echo ' allyesconfig - New config where all options are accepted with yes' |
| 104 | @echo ' allnoconfig - New config where all options are answered with no' |
| 105 | |
| 106 | # =========================================================================== |
| 107 | # Shared Makefile for the various kconfig executables: |
| 108 | # conf: Used for defconfig, oldconfig and related targets |
| 109 | # mconf: Used for the mconfig target. |
| 110 | # Utilizes the lxdialog package |
| 111 | # qconf: Used for the xconfig target |
| 112 | # Based on QT which needs to be installed to compile it |
| 113 | # gconf: Used for the gconfig target |
| 114 | # Based on GTK which needs to be installed to compile it |
| 115 | # object files used by all kconfig flavours |
| 116 | |
| 117 | hostprogs-y := conf mconf qconf gconf kxgettext |
| 118 | conf-objs := conf.o zconf.tab.o |
| 119 | mconf-objs := mconf.o zconf.tab.o |
| 120 | kxgettext-objs := kxgettext.o zconf.tab.o |
| 121 | |
| 122 | ifeq ($(MAKECMDGOALS),xconfig) |
| 123 | qconf-target := 1 |
| 124 | endif |
| 125 | ifeq ($(MAKECMDGOALS),gconfig) |
| 126 | gconf-target := 1 |
| 127 | endif |
| 128 | |
| 129 | |
| 130 | ifeq ($(qconf-target),1) |
| 131 | qconf-cxxobjs := qconf.o |
| 132 | qconf-objs := kconfig_load.o zconf.tab.o |
| 133 | endif |
| 134 | |
| 135 | ifeq ($(gconf-target),1) |
| 136 | gconf-objs := gconf.o kconfig_load.o zconf.tab.o |
| 137 | endif |
| 138 | |
| 139 | clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ |
| 140 | .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c |
| 141 | subdir- += lxdialog |
| 142 | |
Mike Frysinger | e13bd36 | 2007-11-18 06:17:52 +0000 | [diff] [blame] | 143 | # Add environment specific flags |
| 144 | HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 145 | |
| 146 | # generated files seem to need this to find local include files |
| 147 | HOSTCFLAGS_lex.zconf.o := -I$(src) |
| 148 | HOSTCFLAGS_zconf.tab.o := -I$(src) |
| 149 | |
| 150 | HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl |
| 151 | HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK |
| 152 | |
| 153 | HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` |
| 154 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ |
| 155 | -D LKC_DIRECT_LINK |
| 156 | |
| 157 | $(obj)/qconf.o: $(obj)/.tmp_qtcheck |
| 158 | |
| 159 | ifeq ($(qconf-target),1) |
| 160 | $(obj)/.tmp_qtcheck: $(src)/Makefile |
| 161 | -include $(obj)/.tmp_qtcheck |
| 162 | |
| 163 | # QT needs some extra effort... |
| 164 | $(obj)/.tmp_qtcheck: |
| 165 | @set -e; echo " CHECK qt"; dir=""; pkg=""; \ |
| 166 | pkg-config --exists qt 2> /dev/null && pkg=qt; \ |
| 167 | pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ |
| 168 | if [ -n "$$pkg" ]; then \ |
| 169 | cflags="\$$(shell pkg-config $$pkg --cflags)"; \ |
| 170 | libs="\$$(shell pkg-config $$pkg --libs)"; \ |
| 171 | moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ |
| 172 | dir="$$(pkg-config $$pkg --variable=prefix)"; \ |
| 173 | else \ |
| 174 | for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ |
| 175 | if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ |
| 176 | done; \ |
| 177 | if [ -z "$$dir" ]; then \ |
| 178 | echo "*"; \ |
| 179 | echo "* Unable to find the QT installation. Please make sure that"; \ |
| 180 | echo "* the QT development package is correctly installed and"; \ |
| 181 | echo "* either install pkg-config or set the QTDIR environment"; \ |
| 182 | echo "* variable to the correct location."; \ |
| 183 | echo "*"; \ |
| 184 | false; \ |
| 185 | fi; \ |
| 186 | libpath=$$dir/lib; lib=qt; osdir=""; \ |
| 187 | $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \ |
| 188 | osdir=x$$($(HOSTCXX) -print-multi-os-directory); \ |
| 189 | test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \ |
| 190 | test -f $$libpath/libqt-mt.so && lib=qt-mt; \ |
| 191 | cflags="-I$$dir/include"; \ |
| 192 | libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \ |
| 193 | moc="$$dir/bin/moc"; \ |
| 194 | fi; \ |
| 195 | if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \ |
| 196 | echo "*"; \ |
| 197 | echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \ |
| 198 | echo "*"; \ |
| 199 | moc="/usr/bin/moc"; \ |
| 200 | fi; \ |
| 201 | echo "KC_QT_CFLAGS=$$cflags" > $@; \ |
| 202 | echo "KC_QT_LIBS=$$libs" >> $@; \ |
| 203 | echo "KC_QT_MOC=$$moc" >> $@ |
| 204 | endif |
| 205 | |
| 206 | $(obj)/gconf.o: $(obj)/.tmp_gtkcheck |
| 207 | |
| 208 | ifeq ($(gconf-target),1) |
| 209 | -include $(obj)/.tmp_gtkcheck |
| 210 | |
| 211 | # GTK needs some extra effort, too... |
| 212 | $(obj)/.tmp_gtkcheck: |
| 213 | @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \ |
| 214 | if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ |
| 215 | touch $@; \ |
| 216 | else \ |
| 217 | echo "*"; \ |
| 218 | echo "* GTK+ is present but version >= 2.0.0 is required."; \ |
| 219 | echo "*"; \ |
| 220 | false; \ |
| 221 | fi \ |
| 222 | else \ |
| 223 | echo "*"; \ |
| 224 | echo "* Unable to find the GTK+ installation. Please make sure that"; \ |
| 225 | echo "* the GTK+ 2.0 development package is correctly installed..."; \ |
| 226 | echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ |
| 227 | echo "*"; \ |
| 228 | false; \ |
| 229 | fi |
| 230 | endif |
| 231 | |
| 232 | $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c |
| 233 | |
| 234 | $(obj)/kconfig_load.o: $(obj)/lkc_defs.h |
| 235 | |
| 236 | $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h |
| 237 | |
| 238 | $(obj)/gconf.o: $(obj)/lkc_defs.h |
| 239 | |
| 240 | $(obj)/%.moc: $(src)/%.h |
| 241 | $(KC_QT_MOC) -i $< -o $@ |
| 242 | |
| 243 | $(obj)/lkc_defs.h: $(src)/lkc_proto.h |
| 244 | sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' |
| 245 | |
| 246 | |
| 247 | ### |
| 248 | # The following requires flex/bison/gperf |
| 249 | # By default we use the _shipped versions, uncomment the following line if |
| 250 | # you are modifying the flex/bison src. |
| 251 | # LKC_GENPARSER := 1 |
| 252 | |
| 253 | ifdef LKC_GENPARSER |
| 254 | |
| 255 | $(obj)/zconf.tab.c: $(src)/zconf.y |
| 256 | $(obj)/lex.zconf.c: $(src)/zconf.l |
| 257 | $(obj)/zconf.hash.c: $(src)/zconf.gperf |
| 258 | |
| 259 | %.tab.c: %.y |
| 260 | bison -l -b $* -p $(notdir $*) $< |
| 261 | cp $@ $@_shipped |
| 262 | |
| 263 | lex.%.c: %.l |
| 264 | flex -L -P$(notdir $*) -o$@ $< |
| 265 | cp $@ $@_shipped |
| 266 | |
| 267 | %.hash.c: %.gperf |
| 268 | gperf < $< > $@ |
| 269 | cp $@ $@_shipped |
| 270 | |
| 271 | endif |