1XEN_ROOT = $(CURDIR)/../../..
2include $(XEN_ROOT)/tools/Rules.mk
3
4TARGETS :=
5
6# For brevity, these tests make extensive use of designated initialisers in
7# anonymous unions, but GCCs older than 4.6 can't cope.  Ignore the test in
8# this case.
9ifneq ($(gcc)$(call cc-ver,$(CC),lt,0x040600),yy)
10TARGETS += test-cpu-policy
11else
12$(warning Test harness not built, use newer compiler than "$(CC)" (version $(shell $(CC) -dumpversion)))
13endif
14
15.PHONY: all
16all: $(TARGETS)
17
18.PHONY: run
19run: $(TARGETS)
20	./$<
21
22.PHONY: clean
23clean:
24	$(RM) -- *.o $(TARGETS) $(DEPS_RM)
25
26.PHONY: distclean
27distclean: clean
28	$(RM) -- *~
29
30.PHONY: install
31install: all
32	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests
33	$(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC)/tests)
34
35.PHONY: uninstall
36uninstall:
37	$(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGETS))
38
39CFLAGS += -D__XEN_TOOLS__
40CFLAGS += $(CFLAGS_xeninclude)
41CFLAGS += $(APPEND_CFLAGS)
42
43LDFLAGS += $(APPEND_LDFLAGS)
44
45vpath %.c ../../../xen/lib/x86
46
47%.o: Makefile
48
49test-cpu-policy: test-cpu-policy.o msr.o cpuid.o policy.o
50	$(CC) $^ -o $@ $(LDFLAGS)
51
52-include $(DEPS_INCLUDE)
53