1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
VERSION=1.4
CC=$(CCACHE) gcc
CXX=$(CCACHE) g++
CFLAGS=-O0 -Wall -g -fPIC
CXXFLAGS=$(CFLAGS) -I$(QTDIR)/include
LDFLAGS=
LXXFLAGS=$(LDFLAGS) -L$(QTDIR)/lib -Wl,-rpath,$(QTDIR)/lib
LEX=flex
LFLAGS=-L
YACC=bison
YFLAGS=-l
#YFLAGS=-t -v -l
ifndef QTDIR
QTDIR=/usr/share/qt3
endif
MOC=$(wildcard $(QTDIR)/bin/moc)
GTKCFLAGS=`pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags`
GTKLDFLAGS=`pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs`
parse_SRC=zconf.y
conf_SRC=conf.c $(parse_SRC)
mconf_SRC=mconf.c $(parse_SRC)
qconf_SRC=qconf.cc
gconf_SRC=gconf.c kconfig_load.c
HDR=expr.h lkc.h lkc_proto.h qconf.h
OTHER=README lkc-language.txt Makefile.kernel \
kconfig.i extconf.rb example
INST=zconf.y zconf.l confdata.c expr.c symbol.c menu.c \
conf.c mconf.c qconf.cc gconf.c gconf.glade kconfig_load.c images.c $(HDR)
INSTGEN=lex.zconf.c zconf.tab.c
#DEBUG=1
ifdef DEBUG
CFLAGS+=-DLKC_DIRECT_LINK
qconf_SRC+=$(parse_SRC)
else
qconf_SRC+=kconfig_load.c
endif
SRC=$(conf_SRC) $(mconf_SRC) $(qconf_SRC)
CSRC=$(filter %.c, $(SRC))
YSRC=$(filter %.y, $(SRC))
LSRC=$(filter %.l, $(SRC))
parse_OBJ=$(filter %.o, \
$(patsubst %.c,%.o, \
$(patsubst %.y,%.tab.o, \
$(patsubst %.l,lex.%.o, \
$(parse_SRC)))))
conf_OBJ=$(filter %.o, \
$(patsubst %.c,%.o, \
$(patsubst %.y,%.tab.o, \
$(patsubst %.l,lex.%.o, \
$(conf_SRC)))))
mconf_OBJ=$(filter %.o, \
$(patsubst %.c,%.o, \
$(patsubst %.y,%.tab.o, \
$(patsubst %.l,lex.%.o, \
$(mconf_SRC)))))
qconf_OBJ=$(filter %.o, \
$(patsubst %.c,%.o, \
$(patsubst %.cc,%.o, \
$(patsubst %.y,%.tab.o, \
$(patsubst %.l,lex.%.o, \
$(qconf_SRC))))))
gconf_OBJ=$(filter %.o, \
$(patsubst %.c,%.o, \
$(patsubst %.y,%.tab.o, \
$(patsubst %.l,lex.%.o, \
$(gconf_SRC)))))
OBJ=$(conf_OBJ) $(mconf_OBJ) $(qconf_OBJ)
ifeq ($(MOC),)
all: conf mconf
else
all: conf mconf qconf libkconfig.so
endif
lkc_deps := lkc.h lkc_proto.h lkc_defs.h expr.h
zconf.tab.c: zconf.y
zconf.tab.h: zconf.y
lex.zconf.c: zconf.l
zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(lkc_deps)
#lex.zconf.o: lex.zconf.c zconf.tab.h $(lkc_deps)
#confdata.o: confdata.c $(lkc_deps)
#expr.o: expr.c $(lkc_deps)
#symbol.o: symbol.c $(lkc_deps)
#menu.o: menu.c $(lkc_deps)
kconfig_load.o: kconfig_load.c $(lkc_deps)
conf.o: conf.c $(lkc_deps)
mconf.o: mconf.c $(lkc_deps)
qconf.moc: qconf.h
qconf.o: qconf.cc qconf.moc images.c $(lkc_deps)
gconf.o: gconf.c $(lkc_deps)
mconf: $(mconf_OBJ)
$(CC) $(LDFLAGS) $^ -o $@
conf: $(conf_OBJ)
$(CC) $(LDFLAGS) $^ -o $@
ifeq ($(MOC),)
qconf:
@echo Unable to find the QT installation. Please make sure that the
@echo QT development package is correctly installed and the QTDIR
@echo environment variable is set to the correct location.
@false
else
qconf: $(qconf_OBJ)
$(CXX) $(LXXFLAGS) $^ -lqt-mt -o $@
endif
gconf.o: gconf.c
$(CC) $(CFLAGS) $(GTKCFLAGS) -c $< -o $@
gconf: $(gconf_OBJ)
$(CC) $(LDFLAGS) $(GTKLDFLAGS) $^ -o $@
libkconfig.so: $(parse_OBJ)
$(CC) -shared $^ -o $@
lkc_defs.h: lkc_proto.h
sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
clean:
rm -f $(OBJ) conf qconf mconf *.moc lex.* *.tab.? *.output
rm -rf .ruby .python
tgz:
mkdir tmp
mkdir tmp/lkc-$(VERSION)
cp -ra Makefile $(sort $(SRC) $(HDR) $(OTHER) $(INST)) tmp/lkc-$(VERSION)
tar -cpvz -C tmp --exclude CVS -f lkc-$(VERSION).tar.gz lkc-$(VERSION)
rm -rf tmp
%.tab.c %.tab.h: %.y
$(YACC) $(YFLAGS) -b $* -p $* $<
lex.%.c: %.l
$(LEX) $(LFLAGS) -P$* $<
%.moc: %.h
$(QTDIR)/bin/moc -i $< -o $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.cc
$(CXX) $(CXXFLAGS) -c $< -o $@
ifdef KERNELSRC
install: $(INSTGEN)
set -x; cp --remove-destination $(sort $(INST)) $(KERNELSRC)/scripts/kconfig; \
for f in $(INSTGEN); do cp --remove-destination $$f $(KERNELSRC)/scripts/kconfig/$${f}_shipped; done; \
cp --remove-destination Makefile.kernel $(KERNELSRC)/scripts/kconfig/Makefile; \
cp --remove-destination lkc-language.txt $(KERNELSRC)/Documentation/kbuild/kconfig-language.txt
diff: $(INSTGEN)
for f in $(sort $(INST)); do diff -Nu $(KERNELSRC)/scripts/kconfig/$$f $$f; done; \
for f in $(INSTGEN); do diff -Nu $(KERNELSRC)/scripts/kconfig/$${f}_shipped $$f; done; \
diff -Nu $(KERNELSRC)/scripts/kconfig/Makefile Makefile.kernel; \
diff -Nu lkc-language.txt $(KERNELSRC)/Documentation/kbuild/kconfig-language.txt
else
install:
@echo "Please use KERNELSRC=<path/to/linux-kernel> to install"
endif
ruby: .ruby libkconfig.so .ruby/kconfig.so
.ruby:
mkdir .ruby
.ruby/kconfig_wrap.c: kconfig.i kconfig_load.c expr.h lkc_proto.h
swig -ruby -o $@ $<
.ruby/Makefile: extconf.rb
cd .ruby; ruby ../extconf.rb
.ruby/kconfig.so: .ruby/kconfig_wrap.c .ruby/Makefile
$(MAKE) -C .ruby
PYTHON_INCLUDE=$(shell python -c "import sys; print '-I'+sys.prefix+'/include/python'+sys.version[:3]")
python: .python .python/kconfig.py .python/_kconfig.so
.python:
mkdir .python
.python/kconfig_wrap.c .python/kconfig.py: kconfig.i kconfig_load.c expr.h lkc_proto.h
swig -python -o .python/kconfig_wrap.c kconfig.i
.python/_kconfig.so: .python/kconfig_wrap.c
cd .python; $(CC) $(CFLAGS) -shared kconfig_wrap.c -o _kconfig.so -I.. $(PYTHON_INCLUDE)
.PHONY: all tgz clean ruby python
|