blob: f3e8bdab1063b10ff6fbc329851b87e465ee6263 (
plain)
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
|
sconfigobj :=
sconfigobj += lex.yy.o
sconfigobj += sconfig.tab.o
sconfigobj += main.o
SCONFIGFLAGS += -I$(top)/util/sconfig -I$(objutil)/sconfig
$(objutil)/sconfig:
mkdir -p $@
$(objutil)/sconfig/.generated: $(objutil)/sconfig
touch $@
$(objutil)/sconfig/%.o: util/sconfig/%.c | $(objutil)/sconfig/.generated
printf " HOSTCC $(subst $(obj)/,,$(@))\n"
$(HOSTCC) $(SCONFIGFLAGS) $(HOSTCFLAGS) -c -o $@ $<
$(objutil)/sconfig/%.o: $(objutil)/sconfig/%.c
printf " HOSTCC $(subst $(obj)/,,$(@))\n"
$(HOSTCC) $(SCONFIGFLAGS) $(HOSTCFLAGS) -c -o $@ $<
ifdef CONFIG_SCONFIG_GENPARSER
$(top)/util/sconfig/lex.yy.c_shipped: $(top)/util/sconfig/sconfig.l
printf " FLEX $(subst $(top)/,,$(@))\n"
flex -L -o $@ $<
# the .c rule also creates .h
$(top)/util/sconfig/sconfig.tab.h_shipped: $(top)/util/sconfig/sconfig.tab.c_shipped
$(top)/util/sconfig/sconfig.tab.c_shipped: $(top)/util/sconfig/sconfig.y
printf " BISON $(subst $(top)/,,$(@))\n"
bison -l --defines=$(top)/util/sconfig/sconfig.tab.h_shipped -o $@ $<
endif
$(objutil)/sconfig/lex.yy.o: $(objutil)/sconfig/sconfig.tab.h
$(objutil)/sconfig/%: $(top)/util/sconfig/%_shipped
mkdir -p $(dir $@)
cp $< $@
$(objutil)/sconfig/sconfig: $(addprefix $(objutil)/sconfig/,$(sconfigobj))
printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n"
$(HOSTCC) $(SCONFIGFLAGS) -o $@ $(addprefix $(objutil)/sconfig/,$(sconfigobj))
|