Advertisement
Guest User

Untitled

a guest
Jan 19th, 2012
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 6.64 KB | None | 0 0
  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       = 4
  4. export XEN_SUBVERSION    = 2
  5. export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION)
  6. export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
  7. -include xen-version
  8.  
  9. export XEN_WHOAMI   ?= $(USER)
  10. export XEN_DOMAIN   ?= $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown]))
  11.  
  12. export BASEDIR := $(CURDIR)
  13. export XEN_ROOT := $(BASEDIR)/..
  14.  
  15. EFI_MOUNTPOINT ?= /boot/efi
  16.  
  17. .PHONY: default
  18. default: build
  19.  
  20. .PHONY: dist
  21. dist: install
  22.  
  23. .PHONY: build install clean distclean cscope TAGS tags MAP
  24. build install debug clean distclean cscope TAGS tags MAP::
  25.     $(MAKE) -f Rules.mk _$@
  26.  
  27. .PHONY: _build
  28. _build: $(TARGET).gz
  29.  
  30. .PHONY: _install
  31. _install: $(TARGET).gz
  32.     [ -d $(DESTDIR)/boot ] || $(INSTALL_DIR) $(DESTDIR)/boot
  33.     $(INSTALL_DATA) $(TARGET).gz $(DESTDIR)/boot/$(notdir $(TARGET))-$(XEN_FULLVERSION).gz
  34.     ln -f -s $(notdir $(TARGET))-$(XEN_FULLVERSION).gz $(DESTDIR)/boot/$(notdir $(TARGET))-$(XEN_VERSION).$(XEN_SUBVERSION).gz
  35.     ln -f -s $(notdir $(TARGET))-$(XEN_FULLVERSION).gz $(DESTDIR)/boot/$(notdir $(TARGET))-$(XEN_VERSION).gz
  36.     ln -f -s $(notdir $(TARGET))-$(XEN_FULLVERSION).gz $(DESTDIR)/boot/$(notdir $(TARGET)).gz
  37.     $(INSTALL_DATA) $(TARGET)-syms $(DESTDIR)/boot/$(notdir $(TARGET))-syms-$(XEN_FULLVERSION)
  38.     if [ -r $(TARGET).efi ]; then \
  39.         [ -d $(DESTDIR)$(LIBDIR)/efi ] || $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/efi; \
  40.         $(INSTALL_DATA) $(TARGET).efi $(DESTDIR)$(LIBDIR)/efi/$(notdir $(TARGET))-$(XEN_FULLVERSION).efi; \
  41.         ln -sf $(notdir $(TARGET))-$(XEN_FULLVERSION).efi $(DESTDIR)$(LIBDIR)/efi/$(notdir $(TARGET))-$(XEN_VERSION).$(XEN_SUBVERSION).efi; \
  42.         ln -sf $(notdir $(TARGET))-$(XEN_FULLVERSION).efi $(DESTDIR)$(LIBDIR)/efi/$(notdir $(TARGET))-$(XEN_VERSION).efi; \
  43.         ln -sf $(notdir $(TARGET))-$(XEN_FULLVERSION).efi $(DESTDIR)$(LIBDIR)/efi/$(notdir $(TARGET)).efi; \
  44.         if [ -n '$(EFI_MOUNTPOINT)' -a -n '$(EFI_VENDOR)' ]; then \
  45.             $(INSTALL_DATA) $(TARGET).efi $(DESTDIR)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR)/$(notdir $(TARGET))-$(XEN_FULLVERSION).efi; \
  46.         elif [ "$(DESTDIR)" = "$(patsubst $(shell cd $(XEN_ROOT) && pwd)/%,%,$(DESTDIR))" ]; then \
  47.             echo 'EFI installation only partially done (EFI_VENDOR not set)' >&2; \
  48.         fi; \
  49.     fi
  50.  
  51. .PHONY: _debug
  52. _debug:
  53.     objdump -D -S $(TARGET)-syms > $(TARGET).s
  54.  
  55. .PHONY: _clean
  56. _clean: delete-unfresh-files
  57.     $(MAKE) -C tools clean
  58.     $(MAKE) -f $(BASEDIR)/Rules.mk -C include clean
  59.     $(MAKE) -f $(BASEDIR)/Rules.mk -C common clean
  60.     $(MAKE) -f $(BASEDIR)/Rules.mk -C drivers clean
  61.     $(MAKE) -f $(BASEDIR)/Rules.mk -C xsm clean
  62.     $(MAKE) -f $(BASEDIR)/Rules.mk -C crypto clean
  63.     $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean
  64.     rm -f include/asm *.o $(TARGET)* *~ core
  65.     rm -f include/asm-*/asm-offsets.h
  66.     [ -d tools/figlet ] && rm -f .banner*
  67.  
  68. .PHONY: _distclean
  69. _distclean: clean
  70.     rm -f tags TAGS cscope.files cscope.in.out cscope.out cscope.po.out
  71.  
  72. $(TARGET).gz: $(TARGET)
  73.     gzip -f -9 < $< > $@.new
  74.     mv $@.new $@
  75.  
  76. $(TARGET): delete-unfresh-files
  77.     $(MAKE) -C tools
  78.     $(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h
  79.     [ -e include/asm ] || ln -sf asm-$(TARGET_ARCH) include/asm
  80.     $(MAKE) -f $(BASEDIR)/Rules.mk -C include
  81.     $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) asm-offsets.s
  82.     $(MAKE) -f $(BASEDIR)/Rules.mk include/asm-$(TARGET_ARCH)/asm-offsets.h
  83.     $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $(TARGET)
  84.  
  85. # drivers/char/console.o contains static banner/compile info. Blow it away.
  86. # Don't refresh these files during e.g., 'sudo make install'
  87. .PHONY: delete-unfresh-files
  88. delete-unfresh-files:
  89.     @if [ ! -r include/xen/compile.h -o -O include/xen/compile.h ]; then \
  90.         rm -f include/xen/compile.h; \
  91.     fi
  92.  
  93. .banner: Makefile
  94.     $(MAKE) -C tools
  95.     @tools/figlet/figlet -d tools/figlet Xen $(XEN_FULLVERSION) 2>$@2 >$@1
  96.     @cat $@1 $@2 >$@
  97.     @rm -f $@1 $@2
  98.  
  99. # compile.h contains dynamic build info. Rebuilt on every 'make' invocation.
  100. include/xen/compile.h: include/xen/compile.h.in .banner
  101.     @sed -e 's/@@date@@/$(shell LC_ALL=C date)/g' \
  102.         -e 's/@@time@@/$(shell LC_ALL=C date +%T)/g' \
  103.         -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
  104.         -e 's/@@domain@@/$(XEN_DOMAIN)/g' \
  105.         -e 's/@@hostname@@/$(shell hostname)/g' \
  106.         -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) -v 2>&1 | grep version | tail -1)!g' \
  107.         -e 's/@@version@@/$(XEN_VERSION)/g' \
  108.         -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
  109.         -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
  110.         -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' \
  111.         < include/xen/compile.h.in > $@.new
  112.     @grep \" .banner >> $@.new
  113.     @grep -v \" .banner
  114.     @mv -f $@.new $@
  115.  
  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") <$< >$@
  131.  
  132. SUBDIRS = xsm 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
  138.  
  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") || true`
  144. endef
  145.  
  146. .PHONY: xenversion
  147. xenversion:
  148.     @echo $(XEN_FULLVERSION)
  149.  
  150. .PHONY: _TAGS
  151. _TAGS:
  152.     set -e; rm -f TAGS; \
  153.     $(call set_exuberant_flags,etags); \
  154.     $(all_sources) | xargs etags $$exuberant_flags -a
  155.  
  156. .PHONY: _tags
  157. _tags:
  158.     set -e; rm -f tags; \
  159.     $(call set_exuberant_flags,ctags); \
  160.     $(all_sources) | xargs ctags $$exuberant_flags -a
  161.  
  162. .PHONY: _cscope
  163. _cscope:
  164.     $(all_sources) > cscope.files
  165.     cscope -k -b -q
  166.  
  167. .PHONY: _MAP
  168. _MAP:
  169.     $(NM) -n $(TARGET)-syms | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map
  170.  
  171. .PHONY: FORCE
  172. FORCE:
  173.  
  174. %.o %.i: %.c FORCE
  175.     $(MAKE) -f $(BASEDIR)/Rules.mk -C $(*D) $(@F)
  176.  
  177. %.o %.s: %.S FORCE
  178.     $(MAKE) -f $(BASEDIR)/Rules.mk -C $(*D) $(@F)
  179.  
  180. %/: FORCE
  181.     $(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o built_in_bin.o
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement