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