INSTALL_PROGRAM=install
CC = gcc
LDFLAGS =
-CFLAGS = -O2 -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS = -g -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
-CFLAGS += -g
+ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
endif
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-INSTALL_PROGRAM += -s
-LDFLAGS += -s
+ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
+ INSTALL_PROGRAM += -s
+ LDFLAGS += -s
+ STRIP = true
+endif
+
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+ NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+ MAKEFLAGS += -j$(NUMJOBS)
endif
build:
# Builds the binary package.
$(checkdir)
- make CC="$(CC)" LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)"
+ $(MAKE) CC="$(CC)" LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)"
touch build
clean:
# Undoes the effect of `make -f debian/rules build'.
$(checkdir)
- -make clean
+ [ ! -f Makefile ] || $(MAKE) clean
-rm -f debian/files* debian/substvars* debian/*~ core */core *~
rm -rf debian/tmp
-rm build
binary-arch: build
$(checkdir)
- test -f build || make -f debian/rules build
+ test -f build || $(MAKE) -f debian/rules build
# Makes a binary package.
/bin/rm -rf debian/tmp
- test -f stamp-build || make -f debian/rules build
+ test -f stamp-build || $(MAKE) -f debian/rules build
install -d -g root -m 755 -o root debian/tmp
chmod g-s debian/tmp
install -d -g root -m 755 -o root debian/tmp/DEBIAN
install -d -g root -m 755 -o root debian/tmp/usr/bin
install -d -g root -m 755 -o root debian/tmp/usr/share/man/man1
$(INSTALL_PROGRAM) -g root -o root -m 755 mmv debian/tmp/usr/bin
+ test "$(STRIP)" != true || strip \
+ --remove-section=.comment --remove-section=.note \
+ debian/tmp/usr/bin/mmv
install -g root -o root -m 644 mmv.1 debian/tmp/usr/share/man/man1
gzip -9f debian/tmp/usr/share/man/man1/mmv.1
(cd debian/tmp/usr/bin;\
chown -R root.root debian/tmp/usr/share/doc/$(p)
dpkg-shlibdeps debian/tmp/usr/bin/mmv
dpkg-gencontrol -isp
- dh_md5sums
+ cd debian/tmp && find * -type f ! -regex '^DEBIAN/.*' -print0 | \
+ xargs -r0 md5sum > DEBIAN/md5sums
dpkg --build debian/tmp && dpkg-name -o -s .. debian/tmp.deb
define checkdir