3de98082b5793187fd30a8c5fb9df7b58e8368d8
[openwrt/openwrt.git] / scripts / config / Makefile
1 # ===========================================================================
2 # OpenWrt 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
13 # Platform specific fixes
14 #
15 # FreeBSD
16
17 check_lxdialog = $(shell $(SHELL) $(CURDIR)/lxdialog/check-lxdialog.sh -$(1))
18 export CFLAGS += -DKBUILD_NO_NLS -I. $(call check_lxdialog,ccflags)
19
20 conf-objs := conf.o zconf.tab.o
21 mconf-objs := mconf.o zconf.tab.o
22 lxdialog-objs := \
23 lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o \
24 lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
25
26 clean-files := zconf.tab.c lex.zconf.c zconf.hash.c
27
28 all: conf mconf
29
30 conf: $(conf-objs)
31 mconf: $(mconf-objs) $(lxdialog-objs)
32 $(CC) -o $@ $^ $(call check_lxdialog,ldflags $(CC))
33
34 clean:
35 rm -f *.o lxdialog/*.o $(clean-files) conf mconf
36
37 zconf.tab.o: zconf.lex.c zconf.hash.c confdata.c
38
39 kconfig_load.o: lkc_defs.h
40
41 zconf.tab.c: zconf.y
42 zconf.lex.c: zconf.l
43 zconf.hash.c: zconf.gperf
44
45 %.tab.c: %.y
46 cp $@_shipped $@ || bison -l -b $* -p $(notdir $*) $<
47
48 %.lex.c: %.l
49 cp $@_shipped $@ || flex -L -P$(notdir $*) -o$@ $<
50
51 %.hash.c: %.gperf
52 cp $@_shipped $@ || gperf < $< > $@