3
# Uncomment this to turn on verbose mode.
6
DATE=$(shell date +%Y%m%d)
2
DATE := $(shell date +%Y%m%d)
5
# Include dpatch (don't fail, because we do not need it for m-a)
6
-include /usr/share/dpatch/dpatch.make
9
9
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
16
CONFIG_AUFS_FAKE_DM = y
17
CONFIG_AUFS_BRANCH_MAX_127 = y
18
ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
22
AUFS_DEF_CONFIG += -DCONFIG_AUFS_SYSAUFS
25
AUFS_DEF_CONFIG += -DCONFIG_AUFS_BRANCH_MAX_127 -DCONFIG_AUFS_FAKE_DM
26
AUFS_DEF_CONFIG += -DCONFIG_AUFS_MODULE -UCONFIG_AUFS
30
EXTRA_CFLAGS += -I ${CURDIR}/include
31
EXTRA_CFLAGS += ${AUFS_DEF_CONFIG}
32
EXTRA_CFLAGS += -DLKTRHidePrePath=\"${CURDIR}/fs/aufs\"
33
export EXTRA_CFLAGS AUFS_DEF_CONFIG CONFIG_AUFS CONFIG_AUFS_FAKE_DM CONFIG_AUFS_BRANCH_MAX_127 CONFIG_AUFS_SYSAUFS
35
# some default definitions, important!
37
16
# Name of the source package
38
17
psource:=aufs-source
40
18
# The short upstream name, used for the module source directory
44
### Setup the stuff needed for making kernel module packages
45
### taken from /usr/share/kernel-package/sample.module.rules
47
22
# prefix of the target package name
49
# modifieable for experiments or debugging m-a
23
PACKAGE = aufs-modules
50
24
MA_DIR ?= /usr/share/modass
51
# load generic variable handling
52
25
-include $(MA_DIR)/include/generic.make
53
# load default rules, including kdist, kdist_image, ...
54
26
-include $(MA_DIR)/include/common-rules.make
56
# module assistant calculates all needed things for us and sets
57
# following variables:
58
# KSRC (kernel source directory), KVERS (kernel version string), KDREV
59
# (revision of the Debian kernel-image package), CC (the correct
60
# compiler), VERSION (the final package version string), PKGNAME (full
61
# package name with KVERS included), DEB_DESTDIR (path to store DEBs)
63
# The kdist_configure target is called by make-kpkg modules_config and
64
# by kdist* rules by dependency. It should configure the module so it is
65
# ready for compilation (mostly useful for calling configure).
66
# prep-deb-files from module-assistant creates the neccessary debian/ files
67
27
kdist_config: prep-deb-files
69
# the kdist_clean target is called by make-kpkg modules_clean and from
70
# kdist* rules. It is responsible for cleaning up any changes that have
71
# been made by the other kdist_commands (except for the .deb files created)
73
$(MAKE) -C $(KSRC) M=$(CURDIR)/fs/aufs clean
30
$(MAKE) -C $(KSRC) M=$(CURDIR) clean
75
32
# Create the directories to
84
# Add here command to compile/build the package.
89
#k = $(shell echo $(KVERS) | grep -q ^2.6 && echo k)
91
# the binary-modules rule is invoked by module-assistant while processing the
92
# kdist* targets. It is called by module-assistant or make-kpkg and *not*
93
# during a normal build
99
$(MAKE) -C $(KSRC) M=$(CURDIR)/fs/aufs modules
47
$(MAKE) -C $(KSRC) M=$(CURDIR) modules
100
48
# Install the module
101
install -D -m 0644 fs/aufs/aufs.ko debian/$(PKGNAME)/lib/modules/$(KVERS)/kernel/fs/aufs/aufs.ko
49
install -D -m 0644 aufs.ko debian/$(PKGNAME)/lib/modules/$(KVERS)/kernel/fs/aufs/aufs.ko
104
52
dh_installchangelogs
133
79
# Create the directories to install the source into
134
dh_installdirs -p$(psource) usr/src/modules/$(sname)/debian usr/src/modules/$(sname)/fs usr/src/modules/$(sname)/include
80
dh_installdirs -p$(psource) usr/src/modules/$(sname)/debian \
81
usr/src/modules/$(sname)/fs \
82
usr/src/modules/$(sname)/include
135
83
dh_installdirs -A -paufs-tools usr/sbin
137
85
# Copy only the driver source to the proper location
138
cp -r fs/* debian/$(psource)/usr/src/modules/$(sname)/fs
139
cp -r include/* debian/$(psource)/usr/src/modules/$(sname)/include
140
# Copy the needed debian/ pieces to the proper location
141
cp debian/*modules.in* \
142
debian/$(psource)/usr/src/modules/$(sname)/debian
143
cp debian/rules debian/changelog debian/copyright \
144
debian/compat debian/$(psource)/usr/src/modules/$(sname)/debian/
86
cp -r fs/aufs/* debian/$(psource)/usr/src/modules/$(sname)/
87
cp -r include/* debian/$(psource)/usr/src/modules/$(sname)/include
88
cd debian/$(psource)/usr/src/modules/$(sname)/ && mv Makefile Makefile.upstream
89
cp debian/modules.mk debian/$(psource)/usr/src/modules/$(sname)/Makefile
90
cp debian/*modules.in* debian/$(psource)/usr/src/modules/$(sname)/debian
91
cp debian/rules debian/changelog debian/copyright debian/compat debian/conf.mk \
92
debian/$(psource)/usr/src/modules/$(sname)/debian/
145
93
cd debian/$(psource)/usr/src && tar c modules | bzip2 -9 > $(sname).tar.bz2 && rm -rf modules
147
# Add here commands to install the package into debian/aufs.
148
95
for i in mount.aufs umount.aufs auplink aulchown; do \
149
96
install -m 755 -p $(CURDIR)/util/$$i debian/aufs-tools/usr/sbin || exit 1; \