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
17check_lxdialog = $(shell $(SHELL) $(CURDIR)/lxdialog/check-lxdialog.sh -$(1))
18export CFLAGS += -DKBUILD_NO_NLS -I. $(call check_lxdialog,ccflags)
19
20conf-objs	:= conf.o zconf.tab.o
21mconf-objs	:= mconf.o zconf.tab.o
22lxdialog-objs := \
23	lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o \
24	lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
25
26clean-files	:= zconf.tab.c lex.zconf.c zconf.hash.c
27
28all: conf mconf
29
30conf: $(conf-objs)
31mconf: $(mconf-objs) $(lxdialog-objs)
32	$(CC) -o $@ $^ $(call check_lxdialog,ldflags $(CC))
33
34clean:
35	rm -f *.o lxdialog/*.o $(clean-files) conf mconf
36
37zconf.tab.o: zconf.lex.c zconf.hash.c confdata.c
38
39kconfig_load.o: lkc_defs.h
40
41zconf.tab.c: zconf.y
42zconf.lex.c: zconf.l
43zconf.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 < $< > $@
53