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