aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/config/Makefile
diff options
context:
space:
mode:
authorEneas U de Queiroz <cotequeiroz@gmail.com>2020-04-19 20:12:50 -0300
committerPetr Štetiar <ynezz@true.cz>2020-05-20 17:03:45 +0200
commit9f843b1d43ec9e4989f86d8936a70f51940072e5 (patch)
tree9ed5c352e31d12d27a878f76d4d4f2a83074798a /scripts/config/Makefile
parent94e27d62ab01059efb9b4a968ff61acd5308b062 (diff)
downloadupstream-9f843b1d43ec9e4989f86d8936a70f51940072e5.tar.gz
upstream-9f843b1d43ec9e4989f86d8936a70f51940072e5.tar.bz2
upstream-9f843b1d43ec9e4989f86d8936a70f51940072e5.zip
build: scripts/config - update to kconfig-v5.6
Major changes include: - Much more readable reverse dependencies separated in groups - Improved recursive dependency report - More readable .config files: add comments to signal end of menus - More warnings for incorrect Config.in entries, such as a 'choice' default not contained in the 'choice' - Hability to properly display pseudographics with non-latin locales - Recursive dependencies can optionally be treated as errors Changes from failed dcf3e63a35d05e7e5103819c0f17195bfafe9baa attempt: - Recursive dependencies are treated as warnings by default - The option to treat them as errors is implemented as a command-line flag to scripts/config/conf instead of a compile-time definition - fixed handling of select with umnet dependencies Cc: Petr Štetiar <ynezz@true.cz> Cc: Jo-Philip Wich <jow@mein.io> Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Diffstat (limited to 'scripts/config/Makefile')
-rw-r--r--scripts/config/Makefile174
1 files changed, 98 insertions, 76 deletions
diff --git a/scripts/config/Makefile b/scripts/config/Makefile
index 1f9184e3aa..eb55b759a8 100644
--- a/scripts/config/Makefile
+++ b/scripts/config/Makefile
@@ -1,102 +1,124 @@
+# SPDX-License-Identifier: GPL-2.0
# ===========================================================================
# OpenWrt configuration targets
-# These targets are used from top-level makefile
+
+.PHONY: clean all
+all: conf mconf
+clean:
+ rm -f *.o lxdialog/*.o *.moc $(clean-files) conf mconf qconf
+
+clean-files :=
# ===========================================================================
-# Shared Makefile for the various kconfig executables:
-# conf: Used for defconfig, oldconfig and related targets
-# mconf: Used for the mconfig target.
-# Utilizes the lxdialog package
-# qconf: Used for the xconfig target
-# Based on Qt which needs to be installed to compile it
+# Variables needed by the upstream Makefile
+
+# Avoids displaying 'UPD mconf-cfg' in an otherwise quiet make menuconfig
+kecho:=true
+
+CONFIG_SHELL:=$(SHELL)
+srctree:=.
+src:=.
+obj:=.
+Q:=$(if $V,,@)
+cmd = $(cmd_$(1))
+dot-target = $(dir $@).$(notdir $@)
+
+# taken from ../Kbuild.include
+define filechk
+ $(Q)set -e; \
+ mkdir -p $(dir $@); \
+ trap "rm -f $(dot-target).tmp" EXIT; \
+ { $(filechk_$(1)); } > $(dot-target).tmp; \
+ if [ ! -r $@ ] || ! cmp -s $@ $(dot-target).tmp; then \
+ $(kecho) ' UPD $@'; \
+ mv -f $(dot-target).tmp $@; \
+ fi
+endef
+
+### Stripped down upstream Makefile follows:
+# ===========================================================================
# object files used by all kconfig flavours
+common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \
+ symbol.o util.o
+
+$(obj)/lexer.lex.o: $(obj)/parser.tab.h
+HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src)
+HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src)
+# conf: Used for defconfig, oldconfig and related targets
+hostprogs-y += conf
+conf-objs := conf.o $(common-objs)
-# Platform specific fixes
-#
-# FreeBSD
+# mconf: Used for the menuconfig target based on lxdialog
+hostprogs-y += mconf
+lxdialog := $(addprefix lxdialog/, \
+ checklist.o inputbox.o menubox.o textbox.o util.o yesno.o)
+mconf-objs := mconf.o $(lxdialog) $(common-objs)
-check_lxdialog = $(shell $(SHELL) $(CURDIR)/lxdialog/check-lxdialog.sh -$(1))
-export CFLAGS += -DKBUILD_NO_NLS -I. $(call check_lxdialog,ccflags)
-export CXXFLAGS += -DKBUILD_NO_NLS
+HOSTLDLIBS_mconf = $(shell . $(obj)/mconf-cfg && echo $$libs)
+$(foreach f, mconf.o $(lxdialog), \
+ $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/mconf-cfg && echo $$$$cflags)))
-conf-objs := conf.o zconf.tab.o
-mconf-objs := mconf.o zconf.tab.o
+$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg
+
+# qconf: Used for the xconfig target based on Qt
+hostprogs-y += qconf
qconf-cxxobjs := qconf.o
-qconf-objs := zconf.tab.o
+qconf-objs := images.o $(common-objs)
-lxdialog-objs := \
- lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o \
- lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
+HOSTLDLIBS_qconf = $(shell . $(obj)/qconf-cfg && echo $$libs)
+HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/qconf-cfg && echo $$cflags)
-clean-files := zconf.tab.c zconf.lex.c zconf.hash.c
-# Remove qconf junk files
-clean-files += $(qconf-cxxobjs) qconf.moc .tmp_qtcheck qconf
+$(obj)/qconf.o: $(obj)/qconf-cfg $(obj)/qconf.moc
-all: conf mconf
+quiet_cmd_moc = MOC $@
+ cmd_moc = $(shell . $(obj)/qconf-cfg && echo $$moc) -i $< -o $@
-conf: $(conf-objs)
-mconf: $(mconf-objs) $(lxdialog-objs)
- $(CC) -o $@ $^ $(call check_lxdialog,ldflags $(CC))
-qconf: $(qconf-cxxobjs) $(qconf-objs)
- $(CXX) -o $@ $^ $(HOSTLOADLIBES_qconf)
+$(obj)/%.moc: $(src)/%.h $(obj)/qconf-cfg
+ $(call cmd,moc)
-clean:
- rm -f *.o lxdialog/*.o $(clean-files) conf mconf
+# check if necessary packages are available, and configure build flags
+filechk_conf_cfg = $(CONFIG_SHELL) $<
+
+$(obj)/%conf-cfg: $(src)/%conf-cfg.sh FORCE
+ $(call filechk,conf_cfg)
+
+clean-files += *conf-cfg
-zconf.tab.o: zconf.lex.c zconf.hash.c confdata.c
+# ===========================================================================
+# OpenWrt rules and final adjustments that need to be made after reading the
+# full upstream Makefile
+
+FORCE:
-kconfig_load.o: lkc_defs.h
+ifdef BUILD_SHIPPED_FILES
+shipped-files := lexer.lex.c parser.tab.c parser.tab.h
+clean-files += $(shipped-files)
-zconf.tab.c: zconf.y $(wildcard zconf.tab.c_shipped)
-zconf.lex.c: zconf.l $(wildcard zconf.lex.c_shipped)
-zconf.hash.c: zconf.gperf $(wildcard zconf.hash.c_shipped)
+.SECONDARY: $(shipped-files)
-%.tab.c: %.y
- cp $@_shipped $@ || bison -l -b $* -p $(notdir $*) $<
+%.tab.c %.tab.h: %.y
+ bison -l -d -b $* $<
%.lex.c: %.l
- cp $@_shipped $@ || flex -L -P$(notdir $*) -o$@ $<
-
-%.hash.c: %.gperf
- cp $@_shipped $@ || gperf < $< > $@
-
-ifeq ($(MAKECMDGOALS),qconf)
-qconf.o: .tmp_qtcheck
-.tmp_qtcheck: Makefile
--include .tmp_qtcheck
-
-# Qt needs some extra effort...
-.tmp_qtcheck:
- @set -e; echo " CHECK qt"; \
- if pkg-config --exists Qt5Core; then \
- cflags="-std=c++11 -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets`"; \
- libs=`pkg-config --libs Qt5Core Qt5Gui Qt5Widgets`; \
- moc=`pkg-config --variable=host_bins Qt5Core`/moc; \
- elif pkg-config --exists QtCore; then \
- cflags=`pkg-config --cflags QtCore QtGui`; \
- libs=`pkg-config --libs QtCore QtGui`; \
- moc=`pkg-config --variable=moc_location QtCore`; \
- else \
- echo >&2 "*"; \
- echo >&2 "* Could not find Qt via pkg-config."; \
- echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \
- echo >&2 "*"; \
- exit 1; \
- fi; \
- echo "KC_QT_CFLAGS=$$cflags" > $@; \
- echo "KC_QT_LIBS=$$libs" >> $@; \
- echo "KC_QT_MOC=$$moc" >> $@
+ flex -L -o$@ $<
endif
-#Define compiler flags to build qconf
-HOSTLOADLIBES_qconf = $(KC_QT_LIBS)
-HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS)
+$(foreach f, mconf.o $(lxdialog), \
+ $(eval $f: CFLAGS+=$$(HOSTCFLAGS_$f)))
-qconf.o: qconf.moc
-qconf.o: CXXFLAGS+=$(HOSTCXXFLAGS_qconf.o)
+$(obj)/lexer.lex.o: CFLAGS += $(HOSTCFLAGS_lexer.lex.o)
+$(obj)/parser.tab.o: CFLAGS += $(HOSTCFLAGS_parser.tab.o)
+$(obj)/qconf.o: CXXFLAGS+=$(HOSTCXXFLAGS_qconf.o)
+
+conf: $(conf-objs)
-moc = $(KC_QT_MOC) -i $< -o $@
+# The *conf-cfg file is used (then filtered out) as the first prerequisite to
+# avoid sourcing it before the script is built, when trying to compute CFLAGS
+# for the actual first prerequisite. This avoids errors like:
+# '/bin/sh: ./mconf-cfg: No such file or directory'
+mconf: mconf-cfg $(mconf-objs)
+ $(CC) -o $@ $(filter-out mconf-cfg,$^) $(HOSTLDLIBS_mconf)
-%.moc: %.h .tmp_qtcheck
- $(call moc)
+qconf: qconf-cfg $(qconf-cxxobjs) $(qconf-objs)
+ $(CXX) -o $@ $(filter-out qconf-cfg,$^) $(HOSTLDLIBS_qconf)