Statistics
| Branch: | Revision:

root / rules.mak @ 1215c6e7

History | View | Annotate | Download (1.2 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
%.o: %.c
15
	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
16

    
17
%.o: %.S
18
	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CLAGS) -c -o $@ $<,"  AS    $(TARGET_DIR)$@")
19

    
20
%.o: %.m
21
	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
22

    
23
LINK = $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(1) $(ARLIBS_BEGIN) $(ARLIBS) $(ARLIBS_END) $(LIBS),"  LINK  $(TARGET_DIR)$@")
24

    
25
%$(EXESUF): %.o
26
	$(call LINK,$^)
27

    
28
%.a:
29
	$(call quiet-command,rm -f $@ && $(AR) rcs $@ $^,"  AR    $(TARGET_DIR)$@")
30

    
31
quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
32

    
33
# cc-option
34
# Usage: CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
35

    
36
cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
37
              >/dev/null 2>&1 && echo OK), $2, $3)
38

    
39
# Generate timestamp files for .h include files
40

    
41
%.h: %.h-timestamp
42
	@test -f $@ || cp $< $@
43

    
44
%.h-timestamp: %.mak
45
	$(call quiet-command, $(SRC_PATH)/create_config < $< > $@, "  GEN   $*.h")
46
	@cmp $@ $*.h >/dev/null 2>&1 || cp $@ $*.h