#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

# Tell 'jam' to statically link private libraries; the convenience
# library is pretty small and it's much simpler in jam than trying to
# install to a private library prefix directory (would be
# /usr/lib/gargoyle) - or using a LD_LIBRARY_PATH wrapper.
export STATIC=1

# Don't (attempt to) use embeddable fonts, use system ones
export BUNDLEFONTS=no

# Verbose build with actual commands
JAMFLAGS = -dx

# Parallel build support
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    JAMFLAGS += -j$(NUMJOBS)
endif

TARGET  := $(CURDIR)/debian/gargoyle-free

%:
	dh $@

override_dh_auto_build:
	jam $(JAMFLAGS)

override_dh_auto_install:
#	install the package into debian/gargoyle-free.
	jam $(JAMFLAGS) install  # to build/dist/
#	'debian/install' doesn't support renaming files:
#	(last field is always a directory, even without a trailing '/')
	install -m 755 build/dist/gargoyle $(TARGET)/usr/games/gargoyle-free

override_dh_auto_clean:
	jam $(JAMFLAGS) clean
	rm -rf build/
