aboutsummaryrefslogtreecommitdiffstats
path: root/xen/Makefile
blob: e47e2ea8a64092fc7edae73630e3c4bdf7138024 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# This is the correct place to edit the build version.
# All other places this is stored (eg. compile.h) should be autogenerated.
export XEN_VERSION       = 2
export XEN_SUBVERSION    = 0
export XEN_EXTRAVERSION  = "-rc"

export BASEDIR          := $(shell pwd)

include Rules.mk

GENERATED_FILES := include/xen/compile.h

default: $(TARGET)
	gzip -f -9 < $(TARGET) > $(TARGET).gz

debug:	
	objdump -D -S $(TARGET)-syms > $(TARGET).s

install: $(TARGET)
	gzip -f -9 < $(TARGET) > $(TARGET).gz
	mkdir -p $(prefix)/boot
	install -m0644 $(TARGET).gz $(prefix)/boot
	install -m0644 $(TARGET)-syms $(prefix)/boot
	mkdir -p $(prefix)/usr/include/xen/io
	install -m0644 include/public/*.h $(prefix)/usr/include/xen
	install -m0644 include/public/io/*.h $(prefix)/usr/include/xen/io
	install -m0644 include/public/COPYING $(prefix)/usr/include/xen

dist: $(TARGET)
	$(MAKE) prefix=`pwd`/../install dist=yes install

clean: delete-links
	$(MAKE) -C figlet clean
	$(MAKE) -C common clean
	$(MAKE) -C drivers clean
	$(MAKE) -C arch/$(TARGET_ARCH) clean
	rm -f *.o $(TARGET)* *~ core $(GENERATED_FILES)

$(TARGET): delete-unfresh-files make-links $(GENERATED_FILES)
	$(MAKE) -C common
	$(MAKE) -C drivers
	$(MAKE) -C arch/$(TARGET_ARCH)

make-links: delete-links
	ln -sf asm-$(TARGET_ARCH) include/asm

delete-links:
	rm -f include/asm

# Blow away kernel.o because build info is stored statically within it.
delete-unfresh-files:
	rm -f $(GENERATED_FILES) common/kernel.o

# compile.h contains dynamic build info. Rebuilt on every 'make' invocation.
include/xen/compile.h:
	@LANG=C echo /\* Autogenerated by root Makefile. Do not edit. \*/ > $@
	@LANG=C echo >> $@
	@LANG=C echo \#define XEN_COMPILE_DATE \"`date`\" >> $@
	@LANG=C echo \#define XEN_COMPILE_TIME \"`date +%T`\" >> $@
	@LANG=C echo \#define XEN_COMPILE_BY \"`whoami`\" >> $@
	@LANG=C echo \#define XEN_COMPILE_DOMAIN \"`([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown])`\" >> $@
	@LANG=C echo \#define XEN_COMPILE_HOST \"`hostname`\" >> $@
	@LANG=C echo \#define XEN_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> $@
	@LANG=C echo >> $@
	@LANG=C echo \#define XEN_VERSION\ \ \ \ \ \ $(XEN_VERSION) >> $@
	@LANG=C echo \#define XEN_SUBVERSION\ \ \ $(XEN_SUBVERSION) >> $@
	@LANG=C echo \#define XEN_EXTRAVERSION \"$(XEN_EXTRAVERSION)\" >> $@
	@LANG=C echo >> $@
	@LANG=C echo \#define XEN_BANNER \\ >> $@
	cd ./figlet && make && ./figlet Xen $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION) 1>>../$@ && cd ..
	@LANG=C echo >> $@

.PHONY: $(GENERATED_FILES) make-links delete-links default 
.PHONY: debug install clean delete-unfresh-files TAGS

SUBDIRS = arch common drivers 
TAGS: 
	( find include/asm-$(TARGET_ARCH) -name '*.h'; \
	  find include -type d \( -name "asm-*" -o -name config \) -prune -o \
		-name '*.h' -print; \
	  find $(SUBDIRS) -name '*.[ch]' ) | grep -v /SCCS/ | etags -
MAP:
	nm $(TARGET) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map