blob: 76bbd45674e7ff81c55efcb6058673bf8f2f87cd [file] [log] [blame]
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +00001sconfigobj :=
2sconfigobj += lex.yy.o
3sconfigobj += sconfig.tab.o
Patrick Georgi114e7b22010-05-05 11:19:50 +00004sconfigobj += main.o
5
6SCONFIGFLAGS += -I$(top)/util/sconfig -I$(objutil)/sconfig
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +00007
Patrick Georgia2acbc72010-04-16 22:48:57 +00008$(objutil)/sconfig:
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +00009 mkdir -p $@
10
Patrick Georgid935f032013-12-05 20:17:36 +010011$(objutil)/sconfig/.generated: $(objutil)/sconfig
12 touch $@
13
14$(objutil)/sconfig/%.o: util/sconfig/%.c | $(objutil)/sconfig/.generated
Patrick Georgi114e7b22010-05-05 11:19:50 +000015 printf " HOSTCC $(subst $(obj)/,,$(@))\n"
16 $(HOSTCC) $(SCONFIGFLAGS) $(HOSTCFLAGS) -c -o $@ $<
17
Patrick Georgia2acbc72010-04-16 22:48:57 +000018$(objutil)/sconfig/%.o: $(objutil)/sconfig/%.c
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +000019 printf " HOSTCC $(subst $(obj)/,,$(@))\n"
20 $(HOSTCC) $(SCONFIGFLAGS) $(HOSTCFLAGS) -c -o $@ $<
21
Martin Rothf411b702017-04-09 19:12:42 -060022ifeq ($(CONFIG_UTIL_GENPARSER),y)
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +000023$(top)/util/sconfig/lex.yy.c_shipped: $(top)/util/sconfig/sconfig.l
Stefan Reinauer9bf78102010-08-09 13:28:18 +000024 printf " FLEX $(subst $(top)/,,$(@))\n"
Patrick Georgi05245ec2010-04-08 12:59:41 +000025 flex -L -o $@ $<
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +000026
27# the .c rule also creates .h
28$(top)/util/sconfig/sconfig.tab.h_shipped: $(top)/util/sconfig/sconfig.tab.c_shipped
29$(top)/util/sconfig/sconfig.tab.c_shipped: $(top)/util/sconfig/sconfig.y
Stefan Reinauer9bf78102010-08-09 13:28:18 +000030 printf " BISON $(subst $(top)/,,$(@))\n"
Patrick Georgi05245ec2010-04-08 12:59:41 +000031 bison -l --defines=$(top)/util/sconfig/sconfig.tab.h_shipped -o $@ $<
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +000032
33endif
34
Patrick Georgia2acbc72010-04-16 22:48:57 +000035$(objutil)/sconfig/lex.yy.o: $(objutil)/sconfig/sconfig.tab.h
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +000036
Patrick Georgia2acbc72010-04-16 22:48:57 +000037$(objutil)/sconfig/%: $(top)/util/sconfig/%_shipped
Patrick Georgi109a1de2010-04-08 12:00:35 +000038 mkdir -p $(dir $@)
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +000039 cp $< $@
40
Patrick Georgid935f032013-12-05 20:17:36 +010041$(objutil)/sconfig/sconfig: $(addprefix $(objutil)/sconfig/,$(sconfigobj))
Stefan Reinauere705f9c2010-04-08 13:16:32 +000042 printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n"
Patrick Georgia2acbc72010-04-16 22:48:57 +000043 $(HOSTCC) $(SCONFIGFLAGS) -o $@ $(addprefix $(objutil)/sconfig/,$(sconfigobj))
Patrick Georgiaeeafc02014-04-15 20:14:21 +020044
45$(addprefix $(objutil)/sconfig/,$(sconfigobj)) : $(objutil)/sconfig/sconfig.tab.h $(objutil)/sconfig/sconfig.tab.c $(objutil)/sconfig/lex.yy.c