ia64/xen-unstable

view xen/Makefile @ 17493:b2e28707ecbb

Cache figlet output across builds, and provide src-tarball target
which creates figlet output and then deletes figlet itself (which is
not licensed under GPL).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Apr 21 20:08:29 2008 +0100 (2008-04-21)
parents b9004e222fde
children acdc1814d29b
line source
1 # This is the correct place to edit the build version.
2 # All other places this is stored (eg. compile.h) should be autogenerated.
3 export XEN_VERSION = 3
4 export XEN_SUBVERSION = 3
5 export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION)
6 export XEN_FULLVERSION = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
7 -include xen-version
9 export BASEDIR := $(CURDIR)
11 .PHONY: default
12 default: build
14 .PHONY: dist
15 dist: install
17 .PHONY: build install clean distclean cscope TAGS tags MAP
18 build install debug clean distclean cscope TAGS tags MAP::
19 $(MAKE) -f Rules.mk _$@
21 .PHONY: _build
22 _build: $(TARGET).gz
24 .PHONY: _install
25 _install: $(TARGET).gz
26 [ -d $(DESTDIR)/boot ] || $(INSTALL_DIR) $(DESTDIR)/boot
27 $(INSTALL_DATA) $(TARGET).gz $(DESTDIR)/boot/$(notdir $(TARGET))-$(XEN_FULLVERSION).gz
28 ln -f -s $(notdir $(TARGET))-$(XEN_FULLVERSION).gz $(DESTDIR)/boot/$(notdir $(TARGET))-$(XEN_VERSION).$(XEN_SUBVERSION).gz
29 ln -f -s $(notdir $(TARGET))-$(XEN_FULLVERSION).gz $(DESTDIR)/boot/$(notdir $(TARGET))-$(XEN_VERSION).gz
30 ln -f -s $(notdir $(TARGET))-$(XEN_FULLVERSION).gz $(DESTDIR)/boot/$(notdir $(TARGET)).gz
31 $(INSTALL_DATA) $(TARGET)-syms $(DESTDIR)/boot/$(notdir $(TARGET))-syms-$(XEN_FULLVERSION)
33 .PHONY: _debug
34 _debug:
35 objdump -D -S $(TARGET)-syms > $(TARGET).s
37 .PHONY: _clean
38 _clean: delete-unfresh-files
39 $(MAKE) -C tools clean
40 $(MAKE) -f $(BASEDIR)/Rules.mk -C include clean
41 $(MAKE) -f $(BASEDIR)/Rules.mk -C common clean
42 $(MAKE) -f $(BASEDIR)/Rules.mk -C drivers clean
43 $(MAKE) -f $(BASEDIR)/Rules.mk -C xsm clean
44 $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean
45 rm -f include/asm *.o $(TARGET)* *~ core
46 rm -f include/asm-*/asm-offsets.h
47 [ -d tools/figlet ] && rm -f .banner*
49 .PHONY: _distclean
50 _distclean: clean
51 rm -f tags TAGS cscope.files cscope.in.out cscope.out cscope.po.out
53 $(TARGET).gz: $(TARGET)
54 gzip -f -9 < $< > $@.new
55 mv $@.new $@
57 $(TARGET): delete-unfresh-files
58 $(MAKE) -C tools
59 $(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h
60 [ -e include/asm ] || ln -sf asm-$(TARGET_ARCH) include/asm
61 $(MAKE) -f $(BASEDIR)/Rules.mk -C include
62 $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) asm-offsets.s
63 $(MAKE) -f $(BASEDIR)/Rules.mk include/asm-$(TARGET_ARCH)/asm-offsets.h
64 $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $(TARGET)
66 # drivers/char/console.o contains static banner/compile info. Blow it away.
67 # Don't refresh these files during e.g., 'sudo make install'
68 .PHONY: delete-unfresh-files
69 delete-unfresh-files:
70 @if [ ! -r include/xen/compile.h -o -O include/xen/compile.h ]; then \
71 rm -f include/xen/compile.h; \
72 fi
74 .banner: Makefile
75 $(MAKE) -C tools
76 @tools/figlet/figlet -d tools/figlet Xen $(XEN_FULLVERSION) 2>$@2 >$@1
77 @cat $@1 $@2 >$@
78 @rm -f $@1 $@2
80 # compile.h contains dynamic build info. Rebuilt on every 'make' invocation.
81 include/xen/compile.h: include/xen/compile.h.in .banner
82 @sed -e 's/@@date@@/$(shell LC_ALL=C date)/g' \
83 -e 's/@@time@@/$(shell LC_ALL=C date +%T)/g' \
84 -e 's/@@whoami@@/$(USER)/g' \
85 -e 's/@@domain@@/$(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown]))/g' \
86 -e 's/@@hostname@@/$(shell hostname)/g' \
87 -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) -v 2>&1 | grep -i "gcc.*version")!g' \
88 -e 's/@@version@@/$(XEN_VERSION)/g' \
89 -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
90 -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
91 -e 's!@@changeset@@!$(shell ((hg parents --template "{date|date} {rev}:{node|short}" >/dev/null && hg parents --template "{date|date} {rev}:{node|short}") || echo "unavailable") 2>/dev/null)!g' \
92 < include/xen/compile.h.in > $@.new
93 @grep \" .banner >> $@.new
94 @grep -v \" .banner
95 @mv -f $@.new $@
97 include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
98 @(set -e; \
99 echo "/*"; \
100 echo " * DO NOT MODIFY."; \
101 echo " *"; \
102 echo " * This file was auto-generated from $<"; \
103 echo " *"; \
104 echo " */"; \
105 echo ""; \
106 echo "#ifndef __ASM_OFFSETS_H__"; \
107 echo "#define __ASM_OFFSETS_H__"; \
108 echo ""; \
109 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
110 echo ""; \
111 echo "#endif") <$< >$@
113 SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers
114 define all_sources
115 ( find include/asm-$(TARGET_ARCH) -name '*.h' -print; \
116 find include -name 'asm-*' -prune -o -name '*.h' -print; \
117 find $(SUBDIRS) -name '*.[chS]' -print )
118 endef
120 define set_exuberant_flags
121 exuberant_flags=`$1 --version 2>/dev/null | grep -iq exuberant && \
122 echo "-I __initdata,__exitdata,__acquires,__releases \
123 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
124 --extra=+f --c-kinds=+px"`
125 endef
127 .PHONY: _TAGS
128 _TAGS:
129 set -e; rm -f TAGS; \
130 $(call set_exuberant_flags,etags); \
131 $(all_sources) | xargs etags $$exuberant_flags -a
133 .PHONY: _tags
134 _tags:
135 set -e; rm -f tags; \
136 $(call set_exuberant_flags,ctags); \
137 $(all_sources) | xargs ctags $$exuberant_flags -a
139 .PHONY: _cscope
140 _cscope:
141 $(all_sources) > cscope.files
142 cscope -k -b -q
144 .PHONY: _MAP
145 _MAP:
146 $(NM) -n $(TARGET)-syms | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map
148 .PHONY: FORCE
149 FORCE:
151 %.o %.i: %.c FORCE
152 $(MAKE) -f $(BASEDIR)/Rules.mk -C $(*D) $(@F)
154 %.o %.s: %.S FORCE
155 $(MAKE) -f $(BASEDIR)/Rules.mk -C $(*D) $(@F)
157 %/: FORCE
158 $(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o