|
|
1.1 root 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: localmodconfig localyesconfig
7:
8: ifdef KBUILD_KCONFIG
9: Kconfig := $(KBUILD_KCONFIG)
10: else
11: Kconfig := Kconfig
12: endif
13:
14: xconfig: $(obj)/qconf
15: $< $(Kconfig)
16:
17: gconfig: $(obj)/gconf
18: $< $(Kconfig)
19:
20: menuconfig: $(obj)/mconf
21: $< $(Kconfig)
22:
23: config: $(obj)/conf
24: $< --oldaskconfig $(Kconfig)
25:
26: nconfig: $(obj)/nconf
27: $< $(Kconfig)
28:
29: oldconfig: $(obj)/conf
30: $< --$@ $(Kconfig)
31:
32: silentoldconfig: $(obj)/conf
33: @echo " Build Kconfig config file"
34: $(Q)mkdir -p include/generated
35: $(Q)$< --$@ $(Kconfig)
36:
37: # if no path is given, then use src directory to find file
38: ifdef LSMOD
39: LSMOD_F := $(LSMOD)
40: ifeq ($(findstring /,$(LSMOD)),)
41: LSMOD_F := $(objtree)/$(LSMOD)
42: endif
43: endif
44:
45: localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
46: $(Q)mkdir -p include/generated
47: $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
48: $(Q)if [ -f .config ]; then \
49: cmp -s .tmp.config .config || \
50: (mv -f .config .config.old.1; \
51: mv -f .tmp.config .config; \
52: $(obj)/conf --silentoldconfig $(Kconfig); \
53: mv -f .config.old.1 .config.old) \
54: else \
55: mv -f .tmp.config .config; \
56: $(obj)/conf --silentoldconfig $(Kconfig); \
57: fi
58: $(Q)rm -f .tmp.config
59:
60: localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
61: $(Q)mkdir -p include/generated
62: $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
63: $(Q)sed -i s/=m/=y/ .tmp.config
64: $(Q)if [ -f .config ]; then \
65: cmp -s .tmp.config .config || \
66: (mv -f .config .config.old.1; \
67: mv -f .tmp.config .config; \
68: $(obj)/conf --silentoldconfig $(Kconfig); \
69: mv -f .config.old.1 .config.old) \
70: else \
71: mv -f .tmp.config .config; \
72: $(obj)/conf --silentoldconfig $(Kconfig); \
73: fi
74: $(Q)rm -f .tmp.config
75:
76: # Create new linux.pot file
77: # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
78: # The symlink is used to repair a deficiency in arch/um
79: update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
80: $(Q)echo " GEN config"
81: $(Q)xgettext --default-domain=linux \
82: --add-comments --keyword=_ --keyword=N_ \
83: --from-code=UTF-8 \
84: --files-from=tools/kconfig/POTFILES.in \
85: --output $(obj)/config.pot
86: $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
87: $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch
88: $(Q)(for i in `ls arch/*/Kconfig`; \
89: do \
90: echo " GEN $$i"; \
91: $(obj)/kxgettext $$i \
92: >> $(obj)/config.pot; \
93: done )
94: $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
95: --output $(obj)/linux.pot
96: $(Q)rm -f arch/um/Kconfig.arch
97: $(Q)rm -f $(obj)/config.pot
98:
99: PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig
100:
101: allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf
102: $< --$@ $(Kconfig)
103:
104: PHONY += listnewconfig oldnoconfig savedefconfig defconfig
105:
106: listnewconfig oldnoconfig: $(obj)/conf
107: $< --$@ $(Kconfig)
108:
109: savedefconfig: $(obj)/conf
110: $< --$@=defconfig $(Kconfig)
111:
112: defconfig: $(obj)/conf
113: @echo " Build default config"
114: $(Q)$< --defconfig=/dev/null $(Kconfig)
115:
116: # Help text used by make help
117: help:
118: @echo ' config - Update current config utilising a line-oriented program'
119: @echo ' nconfig - Update current config utilising a ncurses menu based program'
120: @echo ' menuconfig - Update current config utilising a menu based program'
121: @echo ' xconfig - Update current config utilising a QT based front-end'
122: @echo ' gconfig - Update current config utilising a GTK based front-end'
123: @echo ' oldconfig - Update current config utilising a provided .config as base'
124: @echo ' localmodconfig - Update current config disabling modules not loaded'
125: @echo ' localyesconfig - Update current config converting local mods to core'
126: @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
127: @echo ' defconfig - New config with default from ARCH supplied defconfig'
128: @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
129: @echo ' allnoconfig - New config where all options are answered with no'
130: @echo ' allyesconfig - New config where all options are accepted with yes'
131: @echo ' allmodconfig - New config selecting modules when possible'
132: @echo ' alldefconfig - New config with all symbols set to default'
133: @echo ' randconfig - New config with random answer to all options'
134: @echo ' listnewconfig - List new options'
135: @echo ' oldnoconfig - Same as silentoldconfig but set new symbols to n (unset)'
136:
137: # lxdialog stuff
138: check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
139:
140: # Use recursively expanded variables so we do not call gcc unless
141: # we really need to do so. (Do not call gcc as part of make mrproper)
142: HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
143: -DLOCALE
144:
145: # ===========================================================================
146: # Shared Makefile for the various kconfig executables:
147: # conf: Used for defconfig, oldconfig and related targets
148: # nconf: Used for the nconfig target.
149: # Utilizes ncurses
150: # mconf: Used for the menuconfig target
151: # Utilizes the lxdialog package
152: # qconf: Used for the xconfig target
153: # Based on QT which needs to be installed to compile it
154: # gconf: Used for the gconfig target
155: # Based on GTK which needs to be installed to compile it
156: # object files used by all kconfig flavours
157:
158: lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
159: lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
160:
161: conf-objs := conf.o zconf.tab.o
162: mconf-objs := mconf.o zconf.tab.o $(lxdialog)
163: nconf-objs := nconf.o zconf.tab.o nconf.gui.o
164: kxgettext-objs := kxgettext.o zconf.tab.o
165:
166: hostprogs-y := conf qconf gconf kxgettext
167:
168: ifeq ($(MAKECMDGOALS),nconfig)
169: hostprogs-y += nconf
170: endif
171:
172: ifeq ($(MAKECMDGOALS),menuconfig)
173: hostprogs-y += mconf
174: endif
175:
176: ifeq ($(MAKECMDGOALS),xconfig)
177: qconf-target := 1
178: endif
179: ifeq ($(MAKECMDGOALS),gconfig)
180: gconf-target := 1
181: endif
182:
183:
184: ifeq ($(qconf-target),1)
185: qconf-cxxobjs := qconf.o
186: qconf-objs := kconfig_load.o zconf.tab.o
187: endif
188:
189: ifeq ($(gconf-target),1)
190: gconf-objs := gconf.o kconfig_load.o zconf.tab.o
191: endif
192:
193: clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
194: .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
195: clean-files += mconf qconf gconf nconf
196: clean-files += config.pot linux.pot
197:
198: # Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
199: PHONY += $(obj)/dochecklxdialog
200: $(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
201: $(obj)/dochecklxdialog:
202: $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
203:
204: always := dochecklxdialog
205:
206: # Add environment specific flags
207: HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
208:
209: # generated files seem to need this to find local include files
210: HOSTCFLAGS_lex.zconf.o := -I$(src)
211: HOSTCFLAGS_zconf.tab.o := -I$(src)
212:
213: HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
214: HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
215:
216: HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
217: HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
218: -D LKC_DIRECT_LINK
219:
220: HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
221:
222: HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses
223: $(obj)/qconf.o: $(obj)/.tmp_qtcheck
224:
225: ifeq ($(qconf-target),1)
226: $(obj)/.tmp_qtcheck: $(src)/Makefile
227: -include $(obj)/.tmp_qtcheck
228:
229: # QT needs some extra effort...
230: $(obj)/.tmp_qtcheck:
231: @set -e; echo " CHECK qt"; dir=""; pkg=""; \
232: if ! pkg-config --exists QtCore 2> /dev/null; then \
233: echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
234: pkg-config --exists qt 2> /dev/null && pkg=qt; \
235: pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
236: if [ -n "$$pkg" ]; then \
237: cflags="\$$(shell pkg-config $$pkg --cflags)"; \
238: libs="\$$(shell pkg-config $$pkg --libs)"; \
239: moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
240: dir="$$(pkg-config $$pkg --variable=prefix)"; \
241: else \
242: for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
243: if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
244: done; \
245: if [ -z "$$dir" ]; then \
246: echo "*"; \
247: echo "* Unable to find any QT installation. Please make sure that"; \
248: echo "* the QT4 or QT3 development package is correctly installed and"; \
249: echo "* either qmake can be found or install pkg-config or set"; \
250: echo "* the QTDIR environment variable to the correct location."; \
251: echo "*"; \
252: false; \
253: fi; \
254: libpath=$$dir/lib; lib=qt; osdir=""; \
255: $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
256: osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
257: test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
258: test -f $$libpath/libqt-mt.so && lib=qt-mt; \
259: cflags="-I$$dir/include"; \
260: libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
261: moc="$$dir/bin/moc"; \
262: fi; \
263: if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
264: echo "*"; \
265: echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
266: echo "*"; \
267: moc="/usr/bin/moc"; \
268: fi; \
269: else \
270: cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \
271: libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \
272: binpath="\$$(shell pkg-config QtCore --variable=prefix)"; \
273: moc="$$binpath/bin/moc"; \
274: fi; \
275: echo "KC_QT_CFLAGS=$$cflags" > $@; \
276: echo "KC_QT_LIBS=$$libs" >> $@; \
277: echo "KC_QT_MOC=$$moc" >> $@
278: endif
279:
280: $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
281:
282: ifeq ($(gconf-target),1)
283: -include $(obj)/.tmp_gtkcheck
284:
285: # GTK needs some extra effort, too...
286: $(obj)/.tmp_gtkcheck:
287: @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \
288: if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
289: touch $@; \
290: else \
291: echo "*"; \
292: echo "* GTK+ is present but version >= 2.0.0 is required."; \
293: echo "*"; \
294: false; \
295: fi \
296: else \
297: echo "*"; \
298: echo "* Unable to find the GTK+ installation. Please make sure that"; \
299: echo "* the GTK+ 2.0 development package is correctly installed..."; \
300: echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
301: echo "*"; \
302: false; \
303: fi
304: endif
305:
306: $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
307:
308: $(obj)/kconfig_load.o: $(obj)/lkc_defs.h
309:
310: $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
311:
312: $(obj)/gconf.o: $(obj)/lkc_defs.h
313:
314: $(obj)/%.moc: $(src)/%.h
315: $(KC_QT_MOC) -i $< -o $@
316:
317: $(obj)/lkc_defs.h: $(src)/lkc_proto.h
318: sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
319:
320: # Extract gconf menu items for I18N support
321: $(obj)/gconf.glade.h: $(obj)/gconf.glade
322: intltool-extract --type=gettext/glade $(obj)/gconf.glade
323:
324: ###
325: # The following requires flex/bison/gperf
326: # By default we use the _shipped versions, uncomment the following line if
327: # you are modifying the flex/bison src.
328: # LKC_GENPARSER := 1
329:
330: ifdef LKC_GENPARSER
331:
332: $(obj)/zconf.tab.c: $(src)/zconf.y
333: $(obj)/lex.zconf.c: $(src)/zconf.l
334: $(obj)/zconf.hash.c: $(src)/zconf.gperf
335:
336: %.tab.c: %.y
337: bison -l -b $* -p $(notdir $*) $<
338: cp $@ $@_shipped
339:
340: lex.%.c: %.l
341: flex -L -P$(notdir $*) -o$@ $<
342: cp $@ $@_shipped
343:
344: %.hash.c: %.gperf
345: gperf < $< > $@
346: cp $@ $@_shipped
347:
348: endif
349:
350: VPATH := $(srctree)
351:
352: $(obj)/%:: $(src)/%_shipped
353: $(Q)cat $< > $@
354:
355: host-cobjs := $(sort $(foreach m,$(hostprogs-y),$($(m)-objs)))
356: host-cobjs := $(addprefix $(obj)/,$(host-cobjs))
357: hostprogs-y := $(addprefix $(obj)/,$(hostprogs-y))
358: $(host-cobjs) : $(obj)/%.o : $(src)/%.c
359: $(Q)$(HOSTCC) -I$(obj) -I$(srctree)/$(src) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) $(HOST_EXTRACFLAGS) -c -o $@ $<
360: $(hostprogs-y) : $(obj)/% : $(host-cobjs)
361: $(Q)$(HOSTCC) $(HOSTLDFLAGS) -o $@ $(addprefix $(obj)/,$($(@F)-objs)) $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.