Makefile 1.16 KB
Newer Older
1
2
3
4
5
6
7
8

include config.mak

DESTDIR := $(PREFIX)/share/qemu/tests

.PHONY: arch_clean clean

#make sure env CFLAGS variable is not used
Andrew Jones's avatar
Andrew Jones committed
9
CFLAGS =
10
11
12
13
14

libgcc := $(shell $(CC) --print-libgcc-file-name)

libcflat := lib/libcflat.a
cflatobjs := \
Andrew Jones's avatar
Andrew Jones committed
15
	lib/argv.o \
16
	lib/printf.o \
17
18
	lib/string.o \
	lib/report.o
19
20

#include architecure specific make rules
Andrew Jones's avatar
Andrew Jones committed
21
include config/config-$(ARCH).mak
22
23
24
25
26
27
28

# cc-option
# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)

cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
              > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)

Andrew Jones's avatar
Andrew Jones committed
29
30
31
CFLAGS += -g
CFLAGS += $(autodepend-flags) -Wall
CFLAGS += $(call cc-option, -fomit-frame-pointer, "")
32
33
34
CFLAGS += $(call cc-option, -fno-stack-protector, "")
CFLAGS += $(call cc-option, -fno-stack-protector-all, "")

Avi Kivity's avatar
Avi Kivity committed
35
CXXFLAGS += $(CFLAGS)
36
37
38

autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d

Avi Kivity's avatar
Avi Kivity committed
39
LDFLAGS += $(CFLAGS)
40
41
42
43
44
45
46
47
LDFLAGS += -pthread -lrt

$(libcflat): $(cflatobjs)
	$(AR) rcs $@ $^

%.o: %.S
	$(CC) $(CFLAGS) -c -nostdlib -o $@ $<

Andrew Jones's avatar
Andrew Jones committed
48
-include */.*.d */*/.*.d
49
50
51
52
53
54

install:
	mkdir -p $(DESTDIR)
	install $(tests_and_config) $(DESTDIR)

clean: arch_clean
Andrew Jones's avatar
Andrew Jones committed
55
	$(RM) lib/.*.d $(libcflat) $(cflatobjs)