#!/usr/bin/make -f

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

DEB_GS_FRAMEWORKS = StepTalk
DEB_GS_DEVPKG_NAME_StepTalk = libsteptalk-dev

include /usr/share/cdbs/1/rules/gnustep.mk
include /usr/share/cdbs/1/class/gnumakefile.mk

p_steptalk = steptalk
d_steptalk = $(CURDIR)/debian/$(p_steptalk)

DEB_DH_SHLIBDEPS_INCLUDE = $(DEB_DESTDIR)/$(GNUSTEP_SYSTEM_LIBRARIES)
DEB_DH_MAKESHLIBS_ARGS = -V
DEB_GS_AUTO_DH_INSTALL = y
DEB_GS_AUTO_LINTIAN_OVERRIDES = y

LDFLAGS += -Wl,-z,defs -Wl,--as-needed

ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
optim := debug=yes
endif

DEB_MAKE_INVOKE += $(optim) OBJCFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
		     messages=yes

gs-pre-install/StepTalk::
# Ship the Bundles/Modules with the runtime library; they're required.
	echo '$(GNUSTEP_SYSTEM_BUNDLES)' >> debian/libsteptalk0.install
	echo '/usr/lib/GNUstep/StepTalk' >> debian/libsteptalk0.install

build/steptalk::
	$(DEB_MAKE_INVOKE) -C Examples/Shell

install/steptalk::
	$(DEB_MAKE_INVOKE) -C Examples/Shell $(DEB_MAKE_INSTALL_TARGET)

binary-post-install/steptalk::
	mkdir $(d_steptalk)/usr/share/doc/$(p_steptalk)/examples/Shell
	for i in AppKit.txt ChangeLog README Unix.txt; do \
	  cp -r $(CURDIR)/Examples/Shell/$$i \
	  $(d_steptalk)/usr/share/doc/$(p_steptalk)/examples/Shell; \
	done

clean::
	$(DEB_MAKE_INVOKE) -C Examples/Shell distclean
