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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
|
#!/usr/bin/make -f
include /usr/share/dpatch/dpatch.make
# debug
#export DH_VERBOSE=y
#export TO_NULL=&>/dev/null
#TO_NULL=&>/dev/null
#MAKEFLAGS+=-s --no-print-directory
# used by debian/config-for-lwng that is sourced by ./Configure
# in this way no modules are built and no errors are reported if there are no
# kenrel headers
ENV=BUILD_MODULES=n BUILD_UTILS=y
#export DH_OPTIONS
# some shortcuts
PWD=$(shell pwd)
LWNTMP=.modules
LWNS=linux-wlan-ng
WARN_MSG="hex files found! please remove them from the source package"
SRC_TBALL_MSG="building source tarball"
INDEP_DEB_MSG="building deb for -source and doc"
UTILS_DEB_MSG="building deb for utilities"
UTILS_BUILD_MSG="building utilities"
FIRMWARE_DEB_MSG="building deb firmware"
NO_DEB_MSG="no debs id dir "
#if not set it may be 'cc' and on hppa the cross compiler is named
# blablabla-gcc, not blablabla-cc
CC := gcc
###################### CONFIGURATION ###################################
configure-stamp:
@echo detected flavours for current arch are: $(flavours)
# to make the configure script happy we have to provide a real
# kernel source tree.
$(ENV) CC="$(CC)" ./Configure -d debian/config-for-lwng $(TO_NULL)
touch configure-stamp
###################### INDEP PART ######################################
# creates the files for the tarball
build-stamp-indep: patch-stamp configure-stamp
printf "\n\n\n***** $(SRC_TBALL_MSG) *****\n\n\n"
mkdir -p $(LWNTMP)/modules/$(LWNS)
cp -ra * $(LWNTMP)/modules/$(LWNS)
make -C $(LWNTMP)/modules/$(LWNS) clean
rm -rf $(LWNTMP)/modules/$(LWNS)/debian
rm -rf $(LWNTMP)/modules/$(LWNS)/*-stamp
mkdir -p $(LWNTMP)/modules/$(LWNS)/debian/
cp debian/changelog debian/compat debian/copyright debian/config-for-lwng \
$(LWNTMP)/modules/$(LWNS)/debian
cp debian/*.modules.in \
$(LWNTMP)/modules/$(LWNS)/debian
install -m755 debian/rules.modules \
$(LWNTMP)/modules/$(LWNS)/debian/rules
# fail if firmware files found: THEY SHOULD NOT BE THERE!!!!
if [ -n "`find -name '*.hex'`" ]; then \
printf "\n\n\n***** $(WARN_MSG) *****\n\n\n"; \
exit 1; \
fi
# rm -f $(LWNTMP)/modules/$(LWNS)/src/prism2/*.hex
touch build-stamp-indep
# creates the tarball
install-stamp-indep: build-stamp-indep
cd $(LWNTMP);\
tar cjf ../$(LWNS).tar.bz2 modules
# install the firmware stuff
TGT=debian/tmp/usr/share/linux-wlan-ng-firmware/debian/;\
mkdir -p $$TGT;\
mkdir -p debian/tmp/usr/bin/;\
mkdir -p debian/tmp/usr/share/doc/linux-wlan-ng-firmware/;\
cp debian/firmware.install.in \
$$TGT/linux-wlan-ng-firmware-files.install;\
cp debian/firmware.dirs.in \
$$TGT/linux-wlan-ng-firmware-files.dirs;\
cp debian/changelog \
$$TGT;\
cp debian/control.firmware \
$$TGT/control;\
cp debian/rules.firmware \
$$TGT/rules;\
chmod +x $$TGT/rules; \
cp debian/config-for-lwng \
$$TGT;\
echo 4 > $$TGT/compat;\
V=`dpkg-parsechangelog | grep ^Version | cut -f 2 -d : | tr -d " "`;\
sed s/@@VERSION@@/$$V/ debian/linux-wlan-ng-build-firmware-deb >\
debian/tmp/usr/bin/linux-wlan-ng-build-firmware-deb; \
sed s/@@VERSION@@/$$V/ debian/linux-wlan-ng-build-firmware-deb.1 >\
debian/tmp/usr/bin/linux-wlan-ng-build-firmware-deb.1;
chmod 0755 debian/tmp/usr/bin/linux-wlan-ng-build-firmware-deb
cp debian/linux-wlan-ng-firmware.copyright \
debian/tmp/usr/share/doc/linux-wlan-ng-firmware/
touch install-stamp-indep
binary-indep: DH_OPTIONS=-i
binary-indep: install-stamp-indep
printf "\n\n\n***** $(INDEP_DEB_MSG) *****\n\n\n"
dh_install $(DH_OPTIONS) -Xrc.d
dh_installchangelogs $(DH_OPTIONS) CHANGES
dh_installdocs $(DH_OPTIONS)
dh_installexamples $(DH_OPTIONS)
dh_link $(DH_OPTIONS)
dh_fixperms $(DH_OPTIONS)
dh_installdeb $(DH_OPTIONS)
dh_gencontrol $(DH_OPTIONS)
dh_compress $(DH_OPTIONS)
dh_md5sums $(DH_OPTIONS)
dh_builddeb $(DH_OPTIONS)
####################### ARCH PART ######################################
# install stuff that is arch dependent
install-stamp: DH_OPTIONS=-plinux-wlan-ng -pprism2-usb-firmware-installer
install-stamp: build-stamp
printf "\n\n\n***** $(UTILS_DEB_MSG) *****\n\n\n"
chmod +x debian/linux-wlan-ng-post-down debian/linux-wlan-ng-pre-up \
debian/linux-wlan-ng-resume debian/linux-wlan-ng-suspend
dh_testdir $(DH_OPTIONS)
dh_testroot $(DH_OPTIONS)
dh_prep $(DH_OPTIONS)
dh_installdirs $(DH_OPTIONS)
# install utils and docs
mkdir -p debian/tmp/etc/hotplug/
$(MAKE) install $(TO_NULL)
cp src/prism2/*pda debian/tmp/etc/wlan/
mkdir -p debian/tmp/usr/bin
cp srec2fw debian/tmp/usr/bin/srec2fw
touch install-stamp
# build utils and modules (all arch stuff)
build-stamp: patch-stamp configure-stamp
dh_testdir
printf "\n\n\n***** $(UTILS_BUILD_MSG) *****\n\n\n"
$(MAKE) all $(TO_NULL)
$(CC) -o srec2fw debian/srec2fw.c
touch build-stamp
# package all arch dependent stuff
binary-arch: DH_OPTIONS=-plinux-wlan-ng -pprism2-usb-firmware-installer
binary-arch: install-stamp
dh_install $(DH_OPTIONS)
dh_installchangelogs $(DH_OPTIONS) CHANGES
dh_installdocs $(DH_OPTIONS)
dh_installexamples $(DH_OPTIONS)
dh_strip $(DH_OPTIONS)
dh_link $(DH_OPTIONS)
dh_fixperms $(DH_OPTIONS)
dh_shlibdeps $(DH_OPTIONS)
dh_installdeb $(DH_OPTIONS)
chmod a-x debian/linux-wlan-ng/etc/pcmcia/wlan-ng.*
chmod a-x debian/linux-wlan-ng/etc/wlan/wlancfg-DEFAULT
chmod a+x debian/linux-wlan-ng/etc/wlan/shared
dh_installman $(DH_OPTIONS) man/*.1
dh_installman -pprism2-usb-firmware-installer debian/srec2fw.1
dh_gencontrol $(DH_OPTIONS)
dh_compress $(DH_OPTIONS)
dh_md5sums $(DH_OPTIONS)
dh_builddeb $(DH_OPTIONS)
build: build-stamp
############################ CLEAN ################################
clean: patch-stamp configure-stamp clean1 unpatch
clean1:
dh_testdir
dh_testroot
$(MAKE) mrproper $(TO_NULL)
$(MAKE) -C src/prism2/download clean $(TO_NULL)
$(MAKE) -C debian/control-generator clean $(TO_NULL)
dh_clean debian/postinst
# stamps
$(RM) configure-stamp build-stamp install-stamp \
build-stamp-indep install-stamp-indep \
install-firmware-stamp
# temporary stuff
rm -rf $(LWNTMP) $(LWNS).tar.bz2
# firmware
rm -rf .firmware
########################## MAIN ##################################
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary
|