File: rules

package info (click to toggle)
user-mode-linux 2.6.26-1um-2%2B29
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 192 kB
  • ctags: 10
  • sloc: makefile: 92; sh: 29
file content (141 lines) | stat: -rwxr-xr-x 3,346 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

config_target:=oldconfig
kernel_version:=2.6.26
kernel_dir:=linux-source-$(kernel_version)
debian:=$(CURDIR)/debian
tmp:=$(debian)/user-mode-linux
tmpmodules:=$(debian)/uml-modules
DEB_HOST_ARCH:=$(shell dpkg-architecture -qDEB_HOST_ARCH)

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
KBUILDVARS := CFLAGS_KERNEL=-O1
endif

# development only targets
#
copy-config:
	cp config.$(DEB_HOST_ARCH) $(kernel_dir)/.config

oldconfig: unpack copy-config
	make -C $(kernel_dir) oldconfig ARCH=um
	cp config.$(DEB_HOST_ARCH) config.$(DEB_HOST_ARCH).oldconfig.old
	cp $(kernel_dir)/.config config.$(DEB_HOST_ARCH)

menuconfig: unpack copy-config
	make -C $(kernel_dir)  menuconfig ARCH=um
	cp config.$(DEB_HOST_ARCH) config.$(DEB_HOST_ARCH).menuconfig.old
	cp $(kernel_dir)/.config config.$(DEB_HOST_ARCH)

# 
# end development only targets


unpack: unpack-stamp
unpack-stamp:
	tar -x --bzip2 -f /usr/src/linux-source-$(kernel_version).tar.bz2
	touch $@

patch: patch-stamp
patch-stamp: unpack-stamp
	(cd $(kernel_dir) && QUILT_PATCHES=$(debian)/patches quilt push -a)
	touch $@

$(kernel_dir)/.config: config.$(DEB_HOST_ARCH) unpack
	cp $< $@

configure: configure-stamp
configure-stamp: patch-stamp $(kernel_dir)/.config
	dh_testdir

	$(MAKE) -C $(kernel_dir) $(config_target) ARCH=um

	touch $@

build: build-stamp
build-stamp: configure
	dh_testdir

	$(MAKE) -C $(kernel_dir) $(KBUILDVARS) linux modules ARCH=um
	docbook-to-man linux.sgml > linux.uml.1

	touch $@

clean: clean-unpatched
clean-unpatched: unpatch
	dh_testdir
	dh_testroot
	rm -f unpack-stamp build-stamp configure-stamp

	rm -rf $(kernel_dir) linux.uml.1 $(tmpmodules) changelog

	dh_clean

unpatch:
	(cd $(kernel_dir) && QUILT_PATCHES=$(debian)/patches quilt pop -a || /bin/true)
	rm -rf patch-stamp $(kernel_dir)/.pc

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs usr/bin usr/lib/uml usr/share/doc/user-mode-linux

	install $(kernel_dir)/linux $(tmp)/usr/bin/linux.uml
	$(MAKE) -C $(kernel_dir) modules_install ARCH=um \
		INSTALL_MOD_PATH=$(tmpmodules)
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	find $(tmpmodules) -name '*.ko' \
		| xargs --no-run-if-empty strip --strip-debug
endif
	-rm $(tmpmodules)/lib/modules/*/build
	-rm $(tmpmodules)/lib/modules/*/source
	mv $(tmpmodules)/lib/modules \
		$(tmp)/usr/lib/uml/modules
	rm -rf $(tmpmodules)

	install -m 644 $(kernel_dir)/.config \
		$(tmp)/usr/share/doc/user-mode-linux/config


# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
#	dh_installdebconf	
	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
	dh_installcron
	dh_installman linux.uml.1
	dh_installinfo
#	dh_undocumented
	dh_installchangelogs $(CURDIR)/debian/changelog
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_makeshlibs
	dh_installdeb
#	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure