add kconfig from linux 2.6 to scripts/config
[openwrt.git] / scripts / config / Makefile
1 # ===========================================================================
2 # Kernel configuration targets
3 # These targets are used from top-level makefile
4
5 # ===========================================================================
6 # Shared Makefile for the various kconfig executables:
7 # conf:   Used for defconfig, oldconfig and related targets
8 # mconf:  Used for the mconfig target.
9 #         Utilizes the lxdialog package
10 # object files used by all kconfig flavours
11
12 conf-objs       := conf.o zconf.tab.o
13 mconf-objs      := mconf.o zconf.tab.o
14
15 clean-files     := lkc_defs.h qconf.moc .tmp_qtcheck \
16                    .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
17
18 all: conf mconf lxdialog
19
20 .PHONY: lxdialog
21 lxdialog:
22         $(MAKE) -C lxdialog
23
24 conf: $(conf-objs)
25 mconf: $(mconf-objs)
26
27 clean:
28         rm -f *.o $(clean-files) conf mconf
29         $(MAKE) -C lxdialog clean
30
31 zconf.tab.o: lex.zconf.c zconf.hash.c
32
33 kconfig_load.o: lkc_defs.h
34
35 lkc_defs.h: $(src)/lkc_proto.h
36         sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
37
38 zconf.tab.c: zconf.y
39 lex.zconf.c: zconf.l
40 zconf.hash.c: zconf.gperf
41
42 %.tab.c: %.y
43         bison -l -b $* -p $(notdir $*) $< && cp $@ $@_shipped || cp $@_shipped $@
44
45 lex.%.c: %.l
46         flex -L -P$(notdir $*) -o$@ $< && cp $@ $@_shipped || cp $@_shipped $@
47
48 %.hash.c: %.gperf
49         gperf < $< > $@ && cp $@ $@_shipped || cp $@_shipped $@