kbuild: migrate all arch to the kconfig mainmenu upgrade
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / scripts / kconfig / Makefile
index 7ea649da19400252ba751bfdb8bea5e7a5dba426..52c34b914fc7a693bf0f874a6a1adf249ed2df6a 100644 (file)
@@ -8,7 +8,7 @@ PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-c
 ifdef KBUILD_KCONFIG
 Kconfig := $(KBUILD_KCONFIG)
 else
-Kconfig := arch/$(SRCARCH)/Kconfig
+Kconfig := Kconfig
 endif
 
 xconfig: $(obj)/qconf
@@ -21,17 +21,17 @@ menuconfig: $(obj)/mconf
        $< $(Kconfig)
 
 config: $(obj)/conf
-       $< $(Kconfig)
+       $< --oldaskconfig $(Kconfig)
 
 nconfig: $(obj)/nconf
        $< $(Kconfig)
 
 oldconfig: $(obj)/conf
-       $< -o $(Kconfig)
+       $< --$@ $(Kconfig)
 
 silentoldconfig: $(obj)/conf
        $(Q)mkdir -p include/generated
-       $< -s $(Kconfig)
+       $< --$@ $(Kconfig)
 
 # if no path is given, then use src directory to find file
 ifdef LSMOD
@@ -44,15 +44,15 @@ endif
 localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
        $(Q)mkdir -p include/generated
        $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
-       $(Q)if [ -f .config ]; then                             \
-                       cmp -s .tmp.config .config ||           \
-                       (mv -f .config .config.old.1;           \
-                        mv -f .tmp.config .config;             \
-                        $(obj)/conf -s $(Kconfig);             \
-                        mv -f .config.old.1 .config.old)       \
-       else                                                    \
-                       mv -f .tmp.config .config;              \
-                       $(obj)/conf -s $(Kconfig);              \
+       $(Q)if [ -f .config ]; then                                     \
+                       cmp -s .tmp.config .config ||                   \
+                       (mv -f .config .config.old.1;                   \
+                        mv -f .tmp.config .config;                     \
+                        $(obj)/conf --silentoldconfig $(Kconfig);      \
+                        mv -f .config.old.1 .config.old)               \
+       else                                                            \
+                       mv -f .tmp.config .config;                      \
+                       $(obj)/conf --silentoldconfig $(Kconfig);       \
        fi
        $(Q)rm -f .tmp.config
 
@@ -60,15 +60,15 @@ localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
        $(Q)mkdir -p include/generated
        $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
        $(Q)sed -i s/=m/=y/ .tmp.config
-       $(Q)if [ -f .config ]; then                             \
-                       cmp -s .tmp.config .config ||           \
-                       (mv -f .config .config.old.1;           \
-                        mv -f .tmp.config .config;             \
-                        $(obj)/conf -s $(Kconfig);             \
-                        mv -f .config.old.1 .config.old)       \
-       else                                                    \
-                       mv -f .tmp.config .config;              \
-                       $(obj)/conf -s $(Kconfig);              \
+       $(Q)if [ -f .config ]; then                                     \
+                       cmp -s .tmp.config .config ||                   \
+                       (mv -f .config .config.old.1;                   \
+                        mv -f .tmp.config .config;                     \
+                        $(obj)/conf --silentoldconfig $(Kconfig);      \
+                        mv -f .config.old.1 .config.old)               \
+       else                                                            \
+                       mv -f .tmp.config .config;                      \
+                       $(obj)/conf --silentoldconfig $(Kconfig);       \
        fi
        $(Q)rm -f .tmp.config
 
@@ -95,30 +95,29 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
        $(Q)rm -f arch/um/Kconfig.arch
        $(Q)rm -f $(obj)/config.pot
 
-PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
+PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig
 
-randconfig: $(obj)/conf
-       $< -r $(Kconfig)
+allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf
+       $< --$@ $(Kconfig)
 
-allyesconfig: $(obj)/conf
-       $< -y $(Kconfig)
+PHONY += listnewconfig oldnoconfig savedefconfig defconfig
 
-allnoconfig: $(obj)/conf
-       $< -n $(Kconfig)
+listnewconfig oldnoconfig: $(obj)/conf
+       $< --$@ $(Kconfig)
 
-allmodconfig: $(obj)/conf
-       $< -m $(Kconfig)
+savedefconfig: $(obj)/conf
+       $< --$@=defconfig $(Kconfig)
 
 defconfig: $(obj)/conf
 ifeq ($(KBUILD_DEFCONFIG),)
-       $< -d $(Kconfig)
+       $< --defconfig $(Kconfig)
 else
        @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
-       $(Q)$< -arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
+       $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
 endif
 
 %_defconfig: $(obj)/conf
-       $(Q)$< -arch/$(SRCARCH)/configs/$@ $(Kconfig)
+       $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
 
 # Help text used by make help
 help:
@@ -131,22 +130,23 @@ help:
        @echo  '  localmodconfig  - Update current config disabling modules not loaded'
        @echo  '  localyesconfig  - Update current config converting local mods to core'
        @echo  '  silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
-       @echo  '  randconfig      - New config with random answer to all options'
-       @echo  '  defconfig       - New config with default answer to all options'
-       @echo  '  allmodconfig    - New config selecting modules when possible'
-       @echo  '  allyesconfig    - New config where all options are accepted with yes'
+       @echo  '  defconfig       - New config with default from ARCH supplied defconfig'
+       @echo  '  savedefconfig   - Save current config as ./defconfig (minimal config)'
        @echo  '  allnoconfig     - New config where all options are answered with no'
+       @echo  '  allyesconfig    - New config where all options are accepted with yes'
+       @echo  '  allmodconfig    - New config selecting modules when possible'
+       @echo  '  alldefconfig    - New config with all symbols set to default'
+       @echo  '  randconfig      - New config with random answer to all options'
+       @echo  '  listnewconfig   - List new options'
+       @echo  '  oldnoconfig     - Same as silentoldconfig but set new symbols to n (unset)'
 
 # lxdialog stuff
 check-lxdialog  := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
 
 # Use recursively expanded variables so we do not call gcc unless
 # we really need to do so. (Do not call gcc as part of make mrproper)
-HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
-HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
-
-HOST_EXTRACFLAGS += -DLOCALE
-
+HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
+                    -DLOCALE
 
 # ===========================================================================
 # Shared Makefile for the various kconfig executables:
@@ -205,7 +205,7 @@ clean-files     += config.pot linux.pot
 PHONY += $(obj)/dochecklxdialog
 $(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
 $(obj)/dochecklxdialog:
-       $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES)
+       $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
 
 always := dochecklxdialog
 
@@ -223,6 +223,8 @@ HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
 HOSTCFLAGS_gconf.o     = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
                           -D LKC_DIRECT_LINK
 
+HOSTLOADLIBES_mconf   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
+
 HOSTLOADLIBES_nconf    = -lmenu -lpanel -lncurses
 $(obj)/qconf.o: $(obj)/.tmp_qtcheck
 
@@ -233,40 +235,50 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
 # QT needs some extra effort...
 $(obj)/.tmp_qtcheck:
        @set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
-       pkg-config --exists qt 2> /dev/null && pkg=qt; \
-       pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
-       if [ -n "$$pkg" ]; then \
-         cflags="\$$(shell pkg-config $$pkg --cflags)"; \
-         libs="\$$(shell pkg-config $$pkg --libs)"; \
-         moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
-         dir="$$(pkg-config $$pkg --variable=prefix)"; \
+       if ! pkg-config --exists QtCore 2> /dev/null; then \
+           echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
+           pkg-config --exists qt 2> /dev/null && pkg=qt; \
+           pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
+           if [ -n "$$pkg" ]; then \
+             cflags="\$$(shell pkg-config $$pkg --cflags)"; \
+             libs="\$$(shell pkg-config $$pkg --libs)"; \
+             moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
+             dir="$$(pkg-config $$pkg --variable=prefix)"; \
+           else \
+             for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
+               if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
+             done; \
+             if [ -z "$$dir" ]; then \
+               echo "*"; \
+               echo "* Unable to find any QT installation. Please make sure that"; \
+               echo "* the QT4 or QT3 development package is correctly installed and"; \
+               echo "* either qmake can be found or install pkg-config or set"; \
+               echo "* the QTDIR environment variable to the correct location."; \
+               echo "*"; \
+               false; \
+             fi; \
+             libpath=$$dir/lib; lib=qt; osdir=""; \
+             $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
+               osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
+             test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
+             test -f $$libpath/libqt-mt.so && lib=qt-mt; \
+             cflags="-I$$dir/include"; \
+             libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
+             moc="$$dir/bin/moc"; \
+           fi; \
+           if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
+             echo "*"; \
+             echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
+             echo "*"; \
+             moc="/usr/bin/moc"; \
+           fi; \
        else \
-         for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
-           if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
-         done; \
-         if [ -z "$$dir" ]; then \
-           echo "*"; \
-           echo "* Unable to find the QT3 installation. Please make sure that"; \
-           echo "* the QT3 development package is correctly installed and"; \
-           echo "* either install pkg-config or set the QTDIR environment"; \
-           echo "* variable to the correct location."; \
-           echo "*"; \
-           false; \
-         fi; \
-         libpath=$$dir/lib; lib=qt; osdir=""; \
-         $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
-           osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
-         test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
-         test -f $$libpath/libqt-mt.so && lib=qt-mt; \
-         cflags="-I$$dir/include"; \
-         libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
-         moc="$$dir/bin/moc"; \
-       fi; \
-       if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
-         echo "*"; \
-         echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
-         echo "*"; \
-         moc="/usr/bin/moc"; \
+         headerpath="\$$(shell qmake -query QT_INSTALL_HEADERS)"; \
+         libpath="\$$(shell qmake -query QT_INSTALL_LIBS)"; \
+         binpath="\$$(shell qmake -query QT_INSTALL_BINS)"; \
+         cflags="-I$$headerpath -I$$headerpath/QtCore -I$$headerpath/QtGui -I$$headerpath/Qt3Support -DQT3_SUPPORT"; \
+         libs="-L$$libpath -Wl,-rpath,$$libpath -lQtCore -lQtGui -lQt3Support"; \
+         moc="$$binpath/moc"; \
        fi; \
        echo "KC_QT_CFLAGS=$$cflags" > $@; \
        echo "KC_QT_LIBS=$$libs" >> $@; \