1XEN_ROOT=$(CURDIR)/../../..
2include $(XEN_ROOT)/tools/Rules.mk
3
4ROOT = $(XEN_ROOT)/xen/include/public
5
6architectures := arm32 arm64 x86_32 x86_64
7headers := $(patsubst %, %.h, $(architectures))
8
9.PHONY: all clean distclean check-headers
10all: $(headers) check-headers
11
12clean:
13	rm -f $(headers)
14	rm -f checker checker.c
15	rm -f *.pyc *.o *~
16
17distclean: clean
18
19checker: checker.c $(headers)
20	$(HOSTCC) $(HOSTCFLAGS) -D__XEN_TOOLS__ -o $@ $<
21
22check-headers: checker
23	./checker > tmp.size
24	diff -u reference.size tmp.size
25	rm tmp.size
26
27arm32.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
28	$(PYTHON) $< $* $@.tmp $(filter %.h,$^)
29	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
30	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < $@.tmp > $@.tmp2
31	rm $@.tmp
32	$(call move-if-changed,$@.tmp2,$@)
33
34arm64.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
35	$(PYTHON) $< $* $@.tmp $(filter %.h,$^)
36	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
37	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < $@.tmp > $@.tmp2
38	rm $@.tmp
39	$(call move-if-changed,$@.tmp2,$@)
40
41x86_32.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
42	$(PYTHON) $< $* $@.tmp $(filter %.h,$^)
43	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
44	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < $@.tmp > $@.tmp2
45	rm $@.tmp
46	$(call move-if-changed,$@.tmp2,$@)
47
48x86_64.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_64.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
49	$(PYTHON) $< $* $@.tmp $(filter %.h,$^)
50	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
51	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < $@.tmp > $@.tmp2
52	rm $@.tmp
53	$(call move-if-changed,$@.tmp2,$@)
54
55checker.c: mkchecker.py structs.py
56	$(PYTHON) $< $@ $(architectures)
57