root / rules.mak @ 3e21ffc9
History | View | Annotate | Download (1.3 kB)
1 |
|
---|---|
2 |
# Don't use implicit rules or variables |
3 |
# we have explicit rules for everything |
4 |
MAKEFLAGS += -rR |
5 |
|
6 |
# Files with this suffixes are final, don't try to generate them |
7 |
# using implicit rules |
8 |
%.d: |
9 |
%.h: |
10 |
%.c: |
11 |
%.m: |
12 |
%.mak: |
13 |
|
14 |
QEMU_CFLAGS += -MMD -MP -MT $@ |
15 |
|
16 |
%.o: %.c $(GENERATED_HEADERS) |
17 |
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@") |
18 |
|
19 |
%.o: %.S |
20 |
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<," AS $(TARGET_DIR)$@") |
21 |
|
22 |
%.o: %.m |
23 |
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@") |
24 |
|
25 |
LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(ARLIBS_BEGIN) $(ARLIBS) $(ARLIBS_END) $(LIBS)," LINK $(TARGET_DIR)$@") |
26 |
|
27 |
%$(EXESUF): %.o |
28 |
$(call LINK,$^) |
29 |
|
30 |
%.a: |
31 |
$(call quiet-command,rm -f $@ && $(AR) rcs $@ $^," AR $(TARGET_DIR)$@") |
32 |
|
33 |
quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) |
34 |
|
35 |
# cc-option |
36 |
# Usage: CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0) |
37 |
|
38 |
cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \ |
39 |
>/dev/null 2>&1 && echo OK), $2, $3) |
40 |
|
41 |
# Generate timestamp files for .h include files |
42 |
|
43 |
%.h: %.h-timestamp |
44 |
@test -f $@ || cp $< $@ |
45 |
|
46 |
%.h-timestamp: %.mak |
47 |
$(call quiet-command, sh $(SRC_PATH)/create_config < $< > $@, " GEN $*.h") |
48 |
@cmp $@ $*.h >/dev/null 2>&1 || cp $@ $*.h |