ia64/xen-unstable

view xen/Makefile @ 13348:761f695043ff

merge
author Ian Campbell <ian.campbell@xensource.com>
date Tue Jan 09 17:17:05 2007 +0000 (2007-01-09)
parents dbb387175f1b
children 583441e296a1
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 = 0
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)
32 [ -d $(DESTDIR)/usr/include/xen/arch-x86 ] || \
33 $(INSTALL_DIR) $(DESTDIR)/usr/include/xen/arch-x86
34 [ -d $(DESTDIR)/usr/include/xen/hvm ] || \
35 $(INSTALL_DIR) $(DESTDIR)/usr/include/xen/hvm
36 [ -d $(DESTDIR)/usr/include/xen/io ] || \
37 $(INSTALL_DIR) $(DESTDIR)/usr/include/xen/io
38 $(INSTALL_DATA) include/public/*.h $(DESTDIR)/usr/include/xen
39 $(INSTALL_DATA) include/public/arch-x86/*.h $(DESTDIR)/usr/include/xen/arch-x86
40 $(INSTALL_DATA) include/public/hvm/*.h $(DESTDIR)/usr/include/xen/hvm
41 $(INSTALL_DATA) include/public/io/*.h $(DESTDIR)/usr/include/xen/io
42 $(INSTALL_DATA) include/public/COPYING $(DESTDIR)/usr/include/xen
44 .PHONY: _debug
45 _debug:
46 objdump -D -S $(TARGET)-syms > $(TARGET).s
48 .PHONY: _clean
49 _clean: delete-unfresh-files
50 $(MAKE) -C tools clean
51 $(MAKE) -f $(BASEDIR)/Rules.mk -C include clean
52 $(MAKE) -f $(BASEDIR)/Rules.mk -C common clean
53 $(MAKE) -f $(BASEDIR)/Rules.mk -C drivers clean
54 $(MAKE) -f $(BASEDIR)/Rules.mk -C acm clean
55 $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean
56 rm -f include/asm *.o $(TARGET)* *~ core
57 rm -f include/asm-*/asm-offsets.h
58 rm -f include/xen/acm_policy.h
60 .PHONY: _distclean
61 _distclean: clean
62 rm -f tags TAGS cscope.files cscope.in.out cscope.out cscope.po.out
64 $(TARGET).gz: $(TARGET)
65 gzip -f -9 < $< > $@.new
66 mv $@.new $@
68 $(TARGET): delete-unfresh-files
69 $(MAKE) -C tools
70 $(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h
71 $(MAKE) -f $(BASEDIR)/Rules.mk include/xen/acm_policy.h
72 [ -e include/asm ] || ln -sf asm-$(TARGET_ARCH) include/asm
73 $(MAKE) -f $(BASEDIR)/Rules.mk -C include
74 $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) asm-offsets.s
75 $(MAKE) -f $(BASEDIR)/Rules.mk include/asm-$(TARGET_ARCH)/asm-offsets.h
76 $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $(TARGET)
78 # drivers/char/console.o contains static banner/compile info. Blow it away.
79 # Don't refresh these files during e.g., 'sudo make install'
80 .PHONY: delete-unfresh-files
81 delete-unfresh-files:
82 @if [ ! -r include/xen/compile.h -o -O include/xen/compile.h ]; then \
83 rm -f include/xen/compile.h; \
84 fi
86 # acm_policy.h contains security policy for Xen
87 include/xen/acm_policy.h:
88 @(set -e; \
89 echo "/*"; \
90 echo " * DO NOT MODIFY."; \
91 echo " *"; \
92 echo " * This file was auto-generated by xen/Makefile $<"; \
93 echo " *"; \
94 echo " */"; \
95 echo ""; \
96 echo "#ifndef ACM_DEFAULT_SECURITY_POLICY"; \
97 echo "#define ACM_DEFAULT_SECURITY_POLICY $(ACM_DEFAULT_SECURITY_POLICY)"; \
98 echo "#endif") >$@
100 # compile.h contains dynamic build info. Rebuilt on every 'make' invocation.
101 include/xen/compile.h: include/xen/compile.h.in
102 @sed -e 's/@@date@@/$(shell LC_ALL=C date)/g' \
103 -e 's/@@time@@/$(shell LC_ALL=C date +%T)/g' \
104 -e 's/@@whoami@@/$(USER)/g' \
105 -e 's/@@domain@@/$(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown]))/g' \
106 -e 's/@@hostname@@/$(shell hostname)/g' \
107 -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) -v 2>&1 | grep -i "gcc.*version")!g' \
108 -e 's/@@version@@/$(XEN_VERSION)/g' \
109 -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
110 -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
111 -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' \
112 < include/xen/compile.h.in > $@.new
113 tools/figlet/figlet -d tools/figlet Xen $(XEN_FULLVERSION) >> $@.new
114 @mv -f $@.new $@
116 include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
117 @(set -e; \
118 echo "/*"; \
119 echo " * DO NOT MODIFY."; \
120 echo " *"; \
121 echo " * This file was auto-generated from $<"; \
122 echo " *"; \
123 echo " */"; \
124 echo ""; \
125 echo "#ifndef __ASM_OFFSETS_H__"; \
126 echo "#define __ASM_OFFSETS_H__"; \
127 echo ""; \
128 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
129 echo ""; \
130 echo "#endif") <$< >$@
132 SUBDIRS = acm arch/$(TARGET_ARCH) common drivers
133 define all_sources
134 ( find include/asm-$(TARGET_ARCH) -name '*.h' -print; \
135 find include -name 'asm-*' -prune -o -name '*.h' -print; \
136 find $(SUBDIRS) -name '*.[chS]' -print )
137 endef
139 define set_exuberant_flags
140 exuberant_flags=`$1 --version 2>/dev/null | grep -iq exuberant && \
141 echo "-I __initdata,__exitdata,__acquires,__releases \
142 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
143 --extra=+f --c-kinds=+px"`
144 endef
146 .PHONY: _TAGS
147 _TAGS:
148 rm -f TAGS; \
149 $(call set_exuberant_flags,etags); \
150 $(all_sources) | xargs etags $$exuberant_flags -a
152 .PHONY: _tags
153 _tags:
154 rm -f tags; \
155 $(call set_exuberant_flags,ctags); \
156 $(all_sources) | xargs ctags $$exuberant_flags -a
158 .PHONY: _cscope
159 _cscope:
160 $(all_sources) > cscope.files
161 cscope -k -b -q
163 .PHONY: _MAP
164 _MAP:
165 $(NM) -n $(TARGET)-syms | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map
167 .PHONY: FORCE
168 FORCE:
170 %.o %.i: %.c FORCE
171 $(MAKE) -f $(BASEDIR)/Rules.mk -C $(*D) $(@F)
173 %.o %.s: %.S FORCE
174 $(MAKE) -f $(BASEDIR)/Rules.mk -C $(*D) $(@F)
176 %/: FORCE
177 $(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o