Merge branch 'for-torvalds' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[firefly-linux-kernel-4.4.55.git] / scripts / kconfig / Makefile
index de934def410f0d2563a41105b8e02400b7f4cb44..368ae306aee45a42fbcee26274b491af512afbf0 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
@@ -145,11 +145,8 @@ 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:
@@ -208,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
 
@@ -226,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
 
@@ -236,40 +235,48 @@ $(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"; \
+         cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \
+         libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \
+         binpath="\$$(shell pkg-config QtCore --variable=prefix)"; \
+         moc="$$binpath/bin/moc"; \
        fi; \
        echo "KC_QT_CFLAGS=$$cflags" > $@; \
        echo "KC_QT_LIBS=$$libs" >> $@; \