aboutsummaryrefslogtreecommitdiffstats
path: root/xen/Makefile
blob: b24ad891745776e3fda5dcbd0d0f20a10c6af5cb (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
# 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       = 1
export XEN_SUBVERSION    = 0
export XEN_EXTRAVERSION  = "-rc1"

export BASEDIR          := $(shell pwd)

include Rules.mk

GENERATED_FILES := include/xeno/compile.h

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

debug:	
	objdump -D -S image >image.s

install: $(TARGET)
	gzip -f -9 < $(TARGET) > $(TARGET).gz
	mkdir -p ../../install/boot
	cp -a $(TARGET).gz ../../install/boot/

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

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

make-links: delete-links
	ln -sf xeno include/linux
	ln -sf asm-$(ARCH) include/asm

delete-links:
	rm -f include/linux 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/xeno/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 tools/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

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