~ubuntu-branches/ubuntu/wily/qemu-kvm-spice/wily

« back to all changes in this revision

Viewing changes to rules.mak

  • Committer: Bazaar Package Importer
  • Author(s): Serge Hallyn
  • Date: 2011-10-19 10:44:56 UTC
  • Revision ID: james.westby@ubuntu.com-20111019104456-xgvskumk3sxi97f4
Tags: upstream-0.15.0+noroms
ImportĀ upstreamĀ versionĀ 0.15.0+noroms

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
# Flags for dependency generation
 
15
QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
 
16
 
 
17
%.o: %.c
 
18
        $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
 
19
 
 
20
ifeq ($(LIBTOOL),)
 
21
%.lo: %.c
 
22
        @echo "missing libtool. please install and rerun configure"; exit 1
 
23
else
 
24
%.lo: %.c
 
25
        $(call quiet-command,libtool --mode=compile --quiet --tag=CC $(CC) $(QEMU_CFLAGS) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  lt CC $@")
 
26
endif
 
27
 
 
28
%.o: %.S
 
29
        $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  AS    $(TARGET_DIR)$@")
 
30
 
 
31
%.o: %.m
 
32
        $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
 
33
 
 
34
LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(LIBS),"  LINK  $(TARGET_DIR)$@")
 
35
 
 
36
%$(EXESUF): %.o
 
37
        $(call LINK,$^)
 
38
 
 
39
%.a:
 
40
        $(call quiet-command,rm -f $@ && $(AR) rcs $@ $^,"  AR    $(TARGET_DIR)$@")
 
41
 
 
42
quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
 
43
 
 
44
# cc-option
 
45
# Usage: CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
 
46
 
 
47
cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
 
48
              >/dev/null 2>&1 && echo OK), $2, $3)
 
49
 
 
50
VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.texi
 
51
set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
 
52
 
 
53
# find-in-path
 
54
# Usage: $(call find-in-path, prog)
 
55
# Looks in the PATH if the argument contains no slash, else only considers one
 
56
# specific directory.  Returns an # empty string if the program doesn't exist
 
57
# there.
 
58
find-in-path = $(if $(find-string /, $1), \
 
59
        $(wildcard $1), \
 
60
        $(wildcard $(patsubst %, %/$1, $(subst :, ,$(PATH)))))
 
61
 
 
62
# Generate timestamp files for .h include files
 
63
 
 
64
%.h: %.h-timestamp
 
65
        @test -f $@ || cp $< $@
 
66
 
 
67
%.h-timestamp: %.mak
 
68
        $(call quiet-command, sh $(SRC_PATH)/scripts/create_config < $< > $@, "  GEN   $*.h")
 
69
        @cmp $@ $*.h >/dev/null 2>&1 || cp $@ $*.h
 
70
 
 
71
# will delete the target of a rule if commands exit with a nonzero exit status
 
72
.DELETE_ON_ERROR: