ia64/xen-unstable

view xen/Makefile @ 12938:b58670602d35

[POWERPC][XEN] Builtin cmdline dependency rule
Rebuild cmdline.o when the user changes the CMDLINE=X argument passed to
the make invocation. I couldn't find an example of another project that
handles this case properly, so I came up with this.
Signed-off-by: Amos Waterland <apw@us.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Hollis Blanchard <hollisb@us.ibm.com>
date Thu Oct 05 15:48:26 2006 -0500 (2006-10-05)
parents bd207697f0c7
children 9c028b3cdb55
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
18 build install debug clean distclean cscope TAGS tags::
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/io ] || \
33 $(INSTALL_DIR) $(DESTDIR)/usr/include/xen/io
34 $(INSTALL_DATA) include/public/*.h $(DESTDIR)/usr/include/xen
35 $(INSTALL_DATA) include/public/io/*.h $(DESTDIR)/usr/include/xen/io
36 $(INSTALL_DATA) include/public/COPYING $(DESTDIR)/usr/include/xen
38 .PHONY: _debug
39 _debug:
40 objdump -D -S $(TARGET)-syms > $(TARGET).s
42 .PHONY: _clean
43 _clean: delete-unfresh-files
44 $(MAKE) -C tools clean
45 $(MAKE) -f $(BASEDIR)/Rules.mk -C common clean
46 $(MAKE) -f $(BASEDIR)/Rules.mk -C drivers clean
47 $(MAKE) -f $(BASEDIR)/Rules.mk -C acm clean
48 $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean
49 rm -f include/asm *.o $(TARGET)* *~ core
50 rm -f include/asm-*/asm-offsets.h
51 rm -f include/xen/acm_policy.h
53 .PHONY: _distclean
54 _distclean: clean
55 rm -f tags TAGS cscope.files cscope.in.out cscope.out cscope.po.out
57 $(TARGET).gz: $(TARGET)
58 gzip -f -9 < $< > $@.new
59 mv $@.new $@
61 $(TARGET): delete-unfresh-files
62 $(MAKE) -C tools
63 $(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h
64 $(MAKE) -f $(BASEDIR)/Rules.mk include/xen/acm_policy.h
65 [ -e include/asm ] || ln -sf asm-$(TARGET_ARCH) include/asm
66 $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) asm-offsets.s
67 $(MAKE) -f $(BASEDIR)/Rules.mk include/asm-$(TARGET_ARCH)/asm-offsets.h
68 $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $(TARGET)
70 # drivers/char/console.o contains static banner/compile info. Blow it away.
71 # Don't refresh these files during e.g., 'sudo make install'
72 .PHONY: delete-unfresh-files
73 delete-unfresh-files:
74 @if [ ! -r include/xen/compile.h -o -O include/xen/compile.h ]; then \
75 rm -f include/xen/compile.h; \
76 fi
78 # acm_policy.h contains security policy for Xen
79 include/xen/acm_policy.h:
80 @(set -e; \
81 echo "/*"; \
82 echo " * DO NOT MODIFY."; \
83 echo " *"; \
84 echo " * This file was auto-generated by xen/Makefile $<"; \
85 echo " *"; \
86 echo " */"; \
87 echo ""; \
88 echo "#ifndef ACM_DEFAULT_SECURITY_POLICY"; \
89 echo "#define ACM_DEFAULT_SECURITY_POLICY $(ACM_DEFAULT_SECURITY_POLICY)"; \
90 echo "#endif") >$@
92 # compile.h contains dynamic build info. Rebuilt on every 'make' invocation.
93 include/xen/compile.h: include/xen/compile.h.in
94 @sed -e 's/@@date@@/$(shell LC_ALL=C date)/g' \
95 -e 's/@@time@@/$(shell LC_ALL=C date +%T)/g' \
96 -e 's/@@whoami@@/$(USER)/g' \
97 -e 's/@@domain@@/$(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown]))/g' \
98 -e 's/@@hostname@@/$(shell hostname)/g' \
99 -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) -v 2>&1 | grep -i "gcc.*version")!g' \
100 -e 's/@@version@@/$(XEN_VERSION)/g' \
101 -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
102 -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
103 -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' \
104 < include/xen/compile.h.in > $@.new
105 tools/figlet/figlet -d tools/figlet Xen $(XEN_FULLVERSION) >> $@.new
106 @mv -f $@.new $@
108 include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
109 @(set -e; \
110 echo "/*"; \
111 echo " * DO NOT MODIFY."; \
112 echo " *"; \
113 echo " * This file was auto-generated from $<"; \
114 echo " *"; \
115 echo " */"; \
116 echo ""; \
117 echo "#ifndef __ASM_OFFSETS_H__"; \
118 echo "#define __ASM_OFFSETS_H__"; \
119 echo ""; \
120 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
121 echo ""; \
122 echo "#endif") <$< >$@
124 SUBDIRS = acm arch/$(TARGET_ARCH) common drivers
125 define all_sources
126 ( find include/asm-$(TARGET_ARCH) -name '*.h' -print; \
127 find include -name 'asm-*' -prune -o -name '*.h' -print; \
128 find $(SUBDIRS) -name '*.[chS]' -print )
129 endef
131 define set_exuberant_flags
132 exuberant_flags=`$1 --version 2>/dev/null | grep -iq exuberant && \
133 echo "-I __initdata,__exitdata,__acquires,__releases \
134 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
135 --extra=+f --c-kinds=+px"`
136 endef
138 .PHONY: _TAGS
139 _TAGS:
140 rm -f TAGS; \
141 $(call set_exuberant_flags,etags); \
142 $(all_sources) | xargs etags $$exuberant_flags -a
144 .PHONY: _tags
145 _tags:
146 rm -f tags; \
147 $(call set_exuberant_flags,ctags); \
148 $(all_sources) | xargs ctags $$exuberant_flags -a
150 .PHONY: _cscope
151 _cscope:
152 $(all_sources) > cscope.files
153 cscope -k -b -q
155 .PHONY: MAP
156 MAP:
157 $(NM) -n $(TARGET) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map
159 .PHONY: FORCE
160 FORCE:
162 %.o %.i: %.c FORCE
163 $(MAKE) -f $(BASEDIR)/Rules.mk -C $(*D) $(@F)
165 %.o %.s: %.S FORCE
166 $(MAKE) -f $(BASEDIR)/Rules.mk -C $(*D) $(@F)
168 %/: FORCE
169 $(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o