summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--scripts/kconfig/Makefile22
1 files changed, 21 insertions, 1 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 7553311..caad231 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -1,189 +1,209 @@
1VERSION=1.2 1VERSION=1.2
2CC=gcc 2CC=gcc
3CXX=g++ 3CXX=g++
4CFLAGS=-O2 -Wall -g -fPIC 4CFLAGS=-O2 -Wall -g -fPIC
5CXXFLAGS=$(CFLAGS) -I$(HOSTQTDIR)/include 5CXXFLAGS=$(CFLAGS) -I$(HOSTQTDIR)/include
6LDFLAGS= 6LDFLAGS=
7LXXFLAGS=$(LDFLAGS) -L$(HOSTQTDIR)/lib -Wl,-rpath,$(HOSTQTDIR)/lib 7LXXFLAGS=$(LDFLAGS) -L$(HOSTQTDIR)/lib -Wl,-rpath,$(HOSTQTDIR)/lib
8LEX=flex 8LEX=flex
9YACC=bison 9YACC=bison
10YFLAGS=-d -t -v 10YFLAGS=-d -t -v
11ifndef HOSTQTDIR 11ifndef HOSTQTDIR
12ifeq ($(shell if [ -e /usr/share/qt ]; then echo foundit; fi),foundit)
12HOSTQTDIR=/usr/share/qt 13HOSTQTDIR=/usr/share/qt
14else
15ifeq ($(shell if [ -e /usr/lib/qt ]; then echo foundit; fi),foundit)
16HOSTQTDIR=/usr/lib/qt
17endif
18endif
19endif
20
21ifndef QTLIB
22ifeq ($(shell if [ -e $(HOSTQTDIR)/lib/libqt.so ]; then echo foundit; fi),foundit)
23QTLIB=-lqt
24else
25ifeq ($(shell if [ -e $(HOSTQTDIR)/lib/libqt-mt.so ]; then echo foundit; fi),foundit)
26QTLIB=-lqt-mt
27else
28QTLIB=-lqt
29$(warning Unable to locate libqt.so!)
30endif
13endif 31endif
32endif
33
14MOC=$(wildcard $(HOSTQTDIR)/bin/moc) 34MOC=$(wildcard $(HOSTQTDIR)/bin/moc)
15 35
16parse_SRC=zconf.y 36parse_SRC=zconf.y
17conf_SRC=conf.c $(parse_SRC) 37conf_SRC=conf.c $(parse_SRC)
18mconf_SRC=mconf.c $(parse_SRC) 38mconf_SRC=mconf.c $(parse_SRC)
19qconf_SRC=qconf.cc 39qconf_SRC=qconf.cc
20lkcc_SRC=cml1.y cml1.l help.l cml1.h expr1.c 40lkcc_SRC=cml1.y cml1.l help.l cml1.h expr1.c
21HDR=expr.h lkc.h lkc_proto.h qconf.h 41HDR=expr.h lkc.h lkc_proto.h qconf.h
22OTHER=README lkc_spec lkc_overview Makefile.kernel convert-all prepare-all.diff fixup-all.diff \ 42OTHER=README lkc_spec lkc_overview Makefile.kernel convert-all prepare-all.diff fixup-all.diff \
23 kconfig.i extconf.rb example 43 kconfig.i extconf.rb example
24INST=zconf.y zconf.l confdata.c expr.c symbol.c menu.c conf.c mconf.c qconf.cc kconfig_load.c images.c $(parse_SRC) $(HDR) 44INST=zconf.y zconf.l confdata.c expr.c symbol.c menu.c conf.c mconf.c qconf.cc kconfig_load.c images.c $(parse_SRC) $(HDR)
25INSTGEN=lex.zconf.c zconf.tab.c zconf.tab.h 45INSTGEN=lex.zconf.c zconf.tab.c zconf.tab.h
26 46
27#DEBUG=1 47#DEBUG=1
28ifdef DEBUG 48ifdef DEBUG
29CFLAGS+=-DLKC_DIRECT_LINK 49CFLAGS+=-DLKC_DIRECT_LINK
30qconf_SRC+=$(parse_SRC) 50qconf_SRC+=$(parse_SRC)
31else 51else
32qconf_SRC+=kconfig_load.c 52qconf_SRC+=kconfig_load.c
33endif 53endif
34 54
35SRC=$(conf_SRC) $(mconf_SRC) $(qconf_SRC) $(lkcc_SRC) 55SRC=$(conf_SRC) $(mconf_SRC) $(qconf_SRC) $(lkcc_SRC)
36CSRC=$(filter %.c, $(SRC)) 56CSRC=$(filter %.c, $(SRC))
37YSRC=$(filter %.y, $(SRC)) 57YSRC=$(filter %.y, $(SRC))
38LSRC=$(filter %.l, $(SRC)) 58LSRC=$(filter %.l, $(SRC))
39 59
40parse_OBJ=$(filter %.o, \ 60parse_OBJ=$(filter %.o, \
41 $(patsubst %.c,%.o, \ 61 $(patsubst %.c,%.o, \
42 $(patsubst %.y,%.tab.o, \ 62 $(patsubst %.y,%.tab.o, \
43 $(patsubst %.l,lex.%.o, \ 63 $(patsubst %.l,lex.%.o, \
44 $(parse_SRC))))) 64 $(parse_SRC)))))
45conf_OBJ=$(filter %.o, \ 65conf_OBJ=$(filter %.o, \
46 $(patsubst %.c,%.o, \ 66 $(patsubst %.c,%.o, \
47 $(patsubst %.y,%.tab.o, \ 67 $(patsubst %.y,%.tab.o, \
48 $(patsubst %.l,lex.%.o, \ 68 $(patsubst %.l,lex.%.o, \
49 $(conf_SRC))))) 69 $(conf_SRC)))))
50mconf_OBJ=$(filter %.o, \ 70mconf_OBJ=$(filter %.o, \
51 $(patsubst %.c,%.o, \ 71 $(patsubst %.c,%.o, \
52 $(patsubst %.y,%.tab.o, \ 72 $(patsubst %.y,%.tab.o, \
53 $(patsubst %.l,lex.%.o, \ 73 $(patsubst %.l,lex.%.o, \
54 $(mconf_SRC))))) 74 $(mconf_SRC)))))
55qconf_OBJ=$(filter %.o, \ 75qconf_OBJ=$(filter %.o, \
56 $(patsubst %.c,%.o, \ 76 $(patsubst %.c,%.o, \
57 $(patsubst %.cc,%.o, \ 77 $(patsubst %.cc,%.o, \
58 $(patsubst %.y,%.tab.o, \ 78 $(patsubst %.y,%.tab.o, \
59 $(patsubst %.l,lex.%.o, \ 79 $(patsubst %.l,lex.%.o, \
60 $(qconf_SRC)))))) 80 $(qconf_SRC))))))
61lkcc_OBJ=$(filter %.o, \ 81lkcc_OBJ=$(filter %.o, \
62 $(patsubst %.c,%.o, \ 82 $(patsubst %.c,%.o, \
63 $(patsubst %.y,%.tab.o, \ 83 $(patsubst %.y,%.tab.o, \
64 $(patsubst %.l,lex.%.o, \ 84 $(patsubst %.l,lex.%.o, \
65 $(lkcc_SRC))))) 85 $(lkcc_SRC)))))
66OBJ=$(conf_OBJ) $(mconf_OBJ) $(qconf_OBJ) $(lkcc_OBJ) 86OBJ=$(conf_OBJ) $(mconf_OBJ) $(qconf_OBJ) $(lkcc_OBJ)
67 87
68ifeq ($(MOC),) 88ifeq ($(MOC),)
69all: lkcc conf mconf 89all: lkcc conf mconf
70else 90else
71all: lkcc conf mconf qconf libkconfig.so 91all: lkcc conf mconf qconf libkconfig.so
72endif 92endif
73 93
74lex.help.c: help.l 94lex.help.c: help.l
75lex.help.o: lex.help.c cml1.h expr.h 95lex.help.o: lex.help.c cml1.h expr.h
76lex.cml1.c: cml1.l 96lex.cml1.c: cml1.l
77lex.cml1.o: lex.cml1.c cml1.tab.h cml1.h expr.h 97lex.cml1.o: lex.cml1.c cml1.tab.h cml1.h expr.h
78cml1.tab.c: cml1.y 98cml1.tab.c: cml1.y
79cml1.tab.h: cml1.y 99cml1.tab.h: cml1.y
80cml1.tab.o: cml1.tab.c cml1.h expr.h 100cml1.tab.o: cml1.tab.c cml1.h expr.h
81expr1.o: expr1.c expr.h 101expr1.o: expr1.c expr.h
82 102
83lkc_deps := lkc.h lkc_proto.h lkc_defs.h expr.h 103lkc_deps := lkc.h lkc_proto.h lkc_defs.h expr.h
84 104
85zconf.tab.c: zconf.y 105zconf.tab.c: zconf.y
86zconf.tab.h: zconf.y 106zconf.tab.h: zconf.y
87lex.zconf.c: zconf.l 107lex.zconf.c: zconf.l
88zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(lkc_deps) 108zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(lkc_deps)
89#lex.zconf.o: lex.zconf.c zconf.tab.h $(lkc_deps) 109#lex.zconf.o: lex.zconf.c zconf.tab.h $(lkc_deps)
90#confdata.o: confdata.c $(lkc_deps) 110#confdata.o: confdata.c $(lkc_deps)
91#expr.o: expr.c $(lkc_deps) 111#expr.o: expr.c $(lkc_deps)
92#symbol.o: symbol.c $(lkc_deps) 112#symbol.o: symbol.c $(lkc_deps)
93#menu.o: menu.c $(lkc_deps) 113#menu.o: menu.c $(lkc_deps)
94kconfig_load.o: kconfig_load.c $(lkc_deps) 114kconfig_load.o: kconfig_load.c $(lkc_deps)
95conf.o: conf.c $(lkc_deps) 115conf.o: conf.c $(lkc_deps)
96mconf.o: mconf.c $(lkc_deps) 116mconf.o: mconf.c $(lkc_deps)
97qconf.moc: qconf.h 117qconf.moc: qconf.h
98qconf.o: qconf.cc qconf.moc images.c $(lkc_deps) 118qconf.o: qconf.cc qconf.moc images.c $(lkc_deps)
99 119
100mconf: $(mconf_OBJ) 120mconf: $(mconf_OBJ)
101 $(CC) $(LDFLAGS) $^ -o $@ 121 $(CC) $(LDFLAGS) $^ -o $@
102 122
103conf: $(conf_OBJ) 123conf: $(conf_OBJ)
104 $(CC) $(LDFLAGS) $^ -o $@ 124 $(CC) $(LDFLAGS) $^ -o $@
105 125
106ifeq ($(MOC),) 126ifeq ($(MOC),)
107qconf: 127qconf:
108 @echo Unable to find the QT installation. Please make sure that the 128 @echo Unable to find the QT installation. Please make sure that the
109 @echo QT development package is correctly installed and the HOSTQTDIR 129 @echo QT development package is correctly installed and the HOSTQTDIR
110 @echo environment variable is set to the correct location. 130 @echo environment variable is set to the correct location.
111 @false 131 @false
112else 132else
113qconf: $(qconf_OBJ) libkconfig.so 133qconf: $(qconf_OBJ) libkconfig.so
114 $(CXX) $(LXXFLAGS) $^ -lqt -o $@ 134 $(CXX) $(LXXFLAGS) $^ $(QTLIB) -o $@
115endif 135endif
116 136
117lkcc: $(lkcc_OBJ) 137lkcc: $(lkcc_OBJ)
118 $(CC) $(LDFLAGS) $^ -o $@ 138 $(CC) $(LDFLAGS) $^ -o $@
119 139
120libkconfig.so: $(parse_OBJ) 140libkconfig.so: $(parse_OBJ)
121 $(CC) -shared $^ -o $@ 141 $(CC) -shared $^ -o $@
122 142
123lkc_defs.h: lkc_proto.h 143lkc_defs.h: lkc_proto.h
124 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' 144 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
125 145
126clean: 146clean:
127 rm -f $(OBJ) lkcc conf qconf mconf *.moc lex.* *.tab.? *.output 147 rm -f $(OBJ) lkcc conf qconf mconf *.moc lex.* *.tab.? *.output
128 148
129tgz: 149tgz:
130 mkdir tmp 150 mkdir tmp
131 mkdir tmp/lkc-$(VERSION) 151 mkdir tmp/lkc-$(VERSION)
132 cp -ra Makefile $(sort $(SRC) $(HDR) $(OTHER) $(INST)) tmp/lkc-$(VERSION) 152 cp -ra Makefile $(sort $(SRC) $(HDR) $(OTHER) $(INST)) tmp/lkc-$(VERSION)
133 tar -cpvz -C tmp -f lkc-$(VERSION).tar.gz lkc-$(VERSION) 153 tar -cpvz -C tmp -f lkc-$(VERSION).tar.gz lkc-$(VERSION)
134 rm -rf tmp 154 rm -rf tmp
135 155
136%.tab.c %.tab.h: %.y 156%.tab.c %.tab.h: %.y
137 $(YACC) $(YFLAGS) -b $* -p $* $< 157 $(YACC) $(YFLAGS) -b $* -p $* $<
138 158
139lex.%.c: %.l 159lex.%.c: %.l
140 $(LEX) $(LFLAGS) -P$* $< 160 $(LEX) $(LFLAGS) -P$* $<
141 161
142%.moc: %.h 162%.moc: %.h
143 $(HOSTQTDIR)/bin/moc -i $< -o $@ 163 $(HOSTQTDIR)/bin/moc -i $< -o $@
144 164
145%.o: %.c 165%.o: %.c
146 $(CC) $(CFLAGS) -c $< -o $@ 166 $(CC) $(CFLAGS) -c $< -o $@
147 167
148%.o: %.cc 168%.o: %.cc
149 $(CXX) $(CXXFLAGS) -c $< -o $@ 169 $(CXX) $(CXXFLAGS) -c $< -o $@
150 170
151ifdef KERNELSRC 171ifdef KERNELSRC
152install: lkcc $(INSTGEN) 172install: lkcc $(INSTGEN)
153 set -x; mkdir $(KERNELSRC)/scripts/kconfig; \ 173 set -x; mkdir $(KERNELSRC)/scripts/kconfig; \
154 cp $(sort $(INST)) $(KERNELSRC)/scripts/kconfig; \ 174 cp $(sort $(INST)) $(KERNELSRC)/scripts/kconfig; \
155 for f in $(INSTGEN); do cp $$f $(KERNELSRC)/scripts/kconfig/$${f}_shipped; done; \ 175 for f in $(INSTGEN); do cp $$f $(KERNELSRC)/scripts/kconfig/$${f}_shipped; done; \
156 cp Makefile.kernel $(KERNELSRC)/scripts/kconfig/Makefile; \ 176 cp Makefile.kernel $(KERNELSRC)/scripts/kconfig/Makefile; \
157 LKCSRC=$$PWD; export LKCSRC; \ 177 LKCSRC=$$PWD; export LKCSRC; \
158 cd $(KERNELSRC); \ 178 cd $(KERNELSRC); \
159 patch -p0 -N < $$LKCSRC/prepare-all.diff; \ 179 patch -p0 -N < $$LKCSRC/prepare-all.diff; \
160 sh $$LKCSRC/convert-all; \ 180 sh $$LKCSRC/convert-all; \
161 patch -p0 -N < $$LKCSRC/fixup-all.diff 181 patch -p0 -N < $$LKCSRC/fixup-all.diff
162 182
163 #cp Makefile $(KERNELSRC)/scripts/kconfig/Makefile; \ 183 #cp Makefile $(KERNELSRC)/scripts/kconfig/Makefile; \
164 184
165uninstall: 185uninstall:
166 patch -p0 -N -R -d $(KERNELSRC) < prepare-all.diff; \ 186 patch -p0 -N -R -d $(KERNELSRC) < prepare-all.diff; \
167 cd $(KERNELSRC); \ 187 cd $(KERNELSRC); \
168 find -name "Kconfig*" | xargs rm; \ 188 find -name "Kconfig*" | xargs rm; \
169 rm -rf scripts/kconfig log.* 189 rm -rf scripts/kconfig log.*
170else 190else
171install: 191install:
172 @echo "Please use KERNELSRC=<path/to/linux-kernel> to install" 192 @echo "Please use KERNELSRC=<path/to/linux-kernel> to install"
173endif 193endif
174 194
175ruby: .ruby libkconfig.so .ruby/kconfig.so 195ruby: .ruby libkconfig.so .ruby/kconfig.so
176 196
177.ruby: 197.ruby:
178 mkdir .ruby 198 mkdir .ruby
179 199
180.ruby/kconfig_wrap.c: kconfig.i kconfig_load.c expr.h lkc_proto.h 200.ruby/kconfig_wrap.c: kconfig.i kconfig_load.c expr.h lkc_proto.h
181 swig -ruby -o $@ $< 201 swig -ruby -o $@ $<
182 202
183.ruby/Makefile: extconf.rb 203.ruby/Makefile: extconf.rb
184 cd .ruby; ruby ../extconf.rb 204 cd .ruby; ruby ../extconf.rb
185 205
186.ruby/kconfig.so: .ruby/kconfig_wrap.c .ruby/Makefile 206.ruby/kconfig.so: .ruby/kconfig_wrap.c .ruby/Makefile
187 make -C .ruby 207 make -C .ruby
188 208
189.PHONY: all tgz clean ruby 209.PHONY: all tgz clean ruby