• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/busybox/scripts/kconfig/
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
7xconfig: $(obj)/qconf
8	$< Config.in
9
10gconfig: $(obj)/gconf
11	$< Config.in
12
13menuconfig: $(obj)/mconf
14	$(Q)$(MAKE) $(build)=scripts/kconfig/lxdialog
15	$< Config.in
16
17config: $(obj)/conf
18	$< Config.in
19
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
33MTIME_IS_COARSE:=@true
34
35oldconfig: $(obj)/conf
36	$< -o Config.in
37	$(MTIME_IS_COARSE) && sleep 1
38
39silentoldconfig: $(obj)/conf
40	$< -s Config.in
41	$(MTIME_IS_COARSE) && sleep 1
42
43update-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
62PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
63
64randconfig: $(obj)/conf
65	$< -r Config.in
66	$(MTIME_IS_COARSE) && sleep 1
67
68allyesconfig: $(obj)/conf
69	$< -y Config.in
70	$(MTIME_IS_COARSE) && sleep 1
71
72allnoconfig: $(obj)/conf
73	$< -n Config.in
74	$(MTIME_IS_COARSE) && sleep 1
75
76allmodconfig: $(obj)/conf
77	$< -m Config.in
78	$(MTIME_IS_COARSE) && sleep 1
79
80defconfig: $(obj)/conf
81ifeq ($(KBUILD_DEFCONFIG),)
82	$< -d Config.in
83else
84	@echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)'
85	$(Q)$< -D $(KBUILD_DEFCONFIG) Config.in
86endif
87	$(MTIME_IS_COARSE) && sleep 1
88
89%_defconfig: $(obj)/conf
90	$(Q)$< -D $@ Config.in
91	$(MTIME_IS_COARSE) && sleep 1
92
93# Help text used by make help
94help:
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
117hostprogs-y	:= conf mconf qconf gconf kxgettext
118conf-objs	:= conf.o  zconf.tab.o
119mconf-objs	:= mconf.o zconf.tab.o
120kxgettext-objs	:= kxgettext.o zconf.tab.o
121
122ifeq ($(MAKECMDGOALS),xconfig)
123	qconf-target := 1
124endif
125ifeq ($(MAKECMDGOALS),gconfig)
126	gconf-target := 1
127endif
128
129
130ifeq ($(qconf-target),1)
131qconf-cxxobjs	:= qconf.o
132qconf-objs	:= kconfig_load.o zconf.tab.o
133endif
134
135ifeq ($(gconf-target),1)
136gconf-objs	:= gconf.o kconfig_load.o zconf.tab.o
137endif
138
139clean-files	:= lkc_defs.h qconf.moc .tmp_qtcheck \
140		   .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
141subdir- += lxdialog
142
143# Add environment specific flags
144HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
145
146# generated files seem to need this to find local include files
147HOSTCFLAGS_lex.zconf.o	:= -I$(src)
148HOSTCFLAGS_zconf.tab.o	:= -I$(src)
149
150HOSTLOADLIBES_qconf	= $(KC_QT_LIBS) -ldl
151HOSTCXXFLAGS_qconf.o	= $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
152
153HOSTLOADLIBES_gconf	= `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
154HOSTCFLAGS_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
159ifeq ($(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" >> $@
204endif
205
206$(obj)/gconf.o: $(obj)/.tmp_gtkcheck
207
208ifeq ($(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
230endif
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
253ifdef 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
263lex.%.c: %.l
264	flex -L -P$(notdir $*) -o$@ $<
265	cp $@ $@_shipped
266
267%.hash.c: %.gperf
268	gperf < $< > $@
269	cp $@ $@_shipped
270
271endif
272