OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 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 | # qconf: Used for the xconfig target |
||
11 | # Based on Qt which needs to be installed to compile it |
||
12 | # object files used by all kconfig flavours |
||
13 | |||
14 | |||
15 | # Platform specific fixes |
||
16 | # |
||
17 | # FreeBSD |
||
18 | |||
19 | check_lxdialog = $(shell $(SHELL) $(CURDIR)/lxdialog/check-lxdialog.sh -$(1)) |
||
20 | export CFLAGS += -DKBUILD_NO_NLS -I. $(call check_lxdialog,ccflags) |
||
21 | export CXXFLAGS += -DKBUILD_NO_NLS |
||
22 | |||
23 | DISTRO-PKG-CONFIG := $(shell which -a pkg-config | grep -E '\/usr' | head -n 1) |
||
24 | |||
25 | conf-objs := conf.o zconf.tab.o |
||
26 | mconf-objs := mconf.o zconf.tab.o |
||
27 | qconf-cxxobjs := qconf.o |
||
28 | qconf-objs := zconf.tab.o |
||
29 | |||
30 | lxdialog-objs := \ |
||
31 | lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o \ |
||
32 | lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o |
||
33 | |||
34 | clean-files := zconf.tab.c lex.zconf.c zconf.hash.c |
||
35 | # Remove qconf junk files |
||
36 | clean-files += $(qconf-cxxobjs) qconf.moc .tmp_qtcheck qconf |
||
37 | |||
38 | all: conf mconf |
||
39 | |||
40 | conf: $(conf-objs) |
||
41 | mconf: $(mconf-objs) $(lxdialog-objs) |
||
42 | $(CC) -o $@ $^ $(call check_lxdialog,ldflags $(CC)) |
||
43 | qconf: $(qconf-cxxobjs) $(qconf-objs) |
||
44 | ifneq ($(DISTRO-PKG-CONFIG),) |
||
45 | $(CXX) $(HOSTLOADLIBES_qconf) -o $@ $^ |
||
46 | else |
||
47 | echo "You don't have 'pkg-config' installed. Cannot continue" |
||
48 | echo "For now, you may use 'make menuconfig' instead of 'make xconfig'" |
||
49 | endif |
||
50 | |||
51 | clean: |
||
52 | rm -f *.o lxdialog/*.o $(clean-files) conf mconf |
||
53 | |||
54 | zconf.tab.o: zconf.lex.c zconf.hash.c confdata.c |
||
55 | |||
56 | kconfig_load.o: lkc_defs.h |
||
57 | |||
58 | zconf.tab.c: zconf.y |
||
59 | zconf.lex.c: zconf.l |
||
60 | zconf.hash.c: zconf.gperf |
||
61 | |||
62 | %.tab.c: %.y |
||
63 | cp $@_shipped $@ || bison -l -b $* -p $(notdir $*) $< |
||
64 | |||
65 | %.lex.c: %.l |
||
66 | cp $@_shipped $@ || flex -L -P$(notdir $*) -o$@ $< |
||
67 | |||
68 | %.hash.c: %.gperf |
||
69 | cp $@_shipped $@ || gperf < $< > $@ |
||
70 | |||
71 | ifeq ($(MAKECMDGOALS),qconf) |
||
72 | qconf.o: .tmp_qtcheck |
||
73 | .tmp_qtcheck: Makefile |
||
74 | -include .tmp_qtcheck |
||
75 | |||
76 | # Qt needs some extra effort... |
||
77 | .tmp_qtcheck: |
||
78 | @set -e; echo " CHECK qt"; \ |
||
79 | if $(DISTRO-PKG-CONFIG) --exists Qt5Core; then \ |
||
80 | cflags="-std=c++11 -fPIC `$(DISTRO-PKG-CONFIG) --cflags Qt5Core Qt5Gui Qt5Widgets`"; \ |
||
81 | libs=`$(DISTRO-PKG-CONFIG) --libs Qt5Core Qt5Gui Qt5Widgets`; \ |
||
82 | moc=`$(DISTRO-PKG-CONFIG) --variable=host_bins Qt5Core`/moc; \ |
||
83 | elif $(DISTRO-PKG-CONFIG) --exists QtCore; then \ |
||
84 | cflags=`$(DISTRO-PKG-CONFIG) --cflags QtCore QtGui`; \ |
||
85 | libs=`$(DISTRO-PKG-CONFIG) --libs QtCore QtGui`; \ |
||
86 | moc=`$(DISTRO-PKG-CONFIG) --variable=moc_location QtCore`; \ |
||
87 | else \ |
||
88 | echo >&2 "*"; \ |
||
89 | echo >&2 "* Could not find Qt via $(DISTRO-PKG-CONFIG)."; \ |
||
90 | echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \ |
||
91 | echo >&2 "*"; \ |
||
92 | exit 1; \ |
||
93 | fi; \ |
||
94 | echo "KC_QT_CFLAGS=$$cflags" > $@; \ |
||
95 | echo "KC_QT_LIBS=$$libs" >> $@; \ |
||
96 | echo "KC_QT_MOC=$$moc" >> $@ |
||
97 | endif |
||
98 | |||
99 | #Define compiler flags to build qconf |
||
100 | HOSTLOADLIBES_qconf = $(KC_QT_LIBS) |
||
101 | HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) |
||
102 | |||
103 | qconf.o: qconf.moc |
||
104 | qconf.o: CXXFLAGS+=$(HOSTCXXFLAGS_qconf.o) |
||
105 | |||
106 | moc = $(KC_QT_MOC) -i $< -o $@ |
||
107 | |||
108 | %.moc: %.h .tmp_qtcheck |
||
109 | $(call moc) |