OSDN Git Service

383dee551ab9798d08ea871e000dc47a7d817e37
[uclinux-h8/uClibc.git] / extra / config / Makefile
1 # Makefile for uClibc
2 #
3 # Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
4 #
5 # This program is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Library General Public License as published by the Free
7 # Software Foundation; either version 2 of the License, or (at your option) any
8 # later version.
9 #
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
13 # details.
14 #
15 # You should have received a copy of the GNU Library General Public License
16 # along with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 TOPDIR=../../
20 include $(TOPDIR)Rules.mak
21
22
23 all: conf mconf
24
25 NATIVE_CFLAGS=-Wall -g -O0
26
27
28 CONF_SRC  =conf.c zconf.tab.c
29 MCONF_SRC =mconf.c zconf.tab.c
30 CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC))
31 MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
32
33 conf: $(CONF_OBJS) 
34         $(NATIVE_CC) $(NATIVE_CFLAGS) $(NATIVE_LDFLAGS) $^ -o $@
35
36 mconf: $(MCONF_OBJS)
37         $(NATIVE_CC) $(NATIVE_CFLAGS) $(NATIVE_LDFLAGS) $^ -o $@
38
39 lkc_deps:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
40
41 conf.o: conf.c $(lkc_deps)
42
43 mconf.o: mconf.c $(lkc_deps)
44
45 zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(lkc_deps)
46
47 lex.zconf.o: lex.zconf.c $(lkc_deps)
48
49 %.o : %.c
50         $(NATIVE_CC) $(NATIVE_CFLAGS) -I. -c $< -o $@
51
52 lkc_defs.h: lkc_proto.h
53         @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
54
55 ###
56 # The following requires flex/bison
57 # By default we use the _shipped versions, uncomment the 
58 # following line if you are modifying the flex/bison src.
59 #LKC_GENPARSER := 1
60
61 ifdef LKC_GENPARSER
62
63 %.tab.c %.tab.h: %.y
64         bison -t -d -v -b $* -p $(notdir $*) $<
65
66 lex.%.c: %.l
67         flex -P$(notdir $*) -o$@ $<
68 else
69
70 lex.zconf.c: lex.zconf.c_shipped
71         cp lex.zconf.c_shipped lex.zconf.c
72
73 zconf.tab.c: zconf.tab.c_shipped
74         cp zconf.tab.c_shipped zconf.tab.c
75
76 zconf.tab.h: zconf.tab.h_shipped
77         cp zconf.tab.h_shipped zconf.tab.h
78 endif
79
80 clean:
81         rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
82                 conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h
83         $(MAKE) -C lxdialog clean
84