greg@346: #!/usr/bin/make -f
greg@346: # -*- makefile -*-
greg@346: # Sample debian/rules that uses debhelper.
greg@346: #
greg@346: # This file was originally written by Joey Hess and Craig Small.
greg@346: # As a special exception, when this file is copied by dh-make into a
greg@346: # dh-make output file, you may use that output file without restriction.
greg@346: # This special exception was added by Craig Small in version 0.37 of dh-make.
greg@346: #
greg@346: # Modified to make a template file for a multi-binary package with separated
greg@346: # build-arch and build-indep targets  by Bill Allombert 2001
greg@346: 
greg@346: # Uncomment this to turn on verbose mode.
greg@346: export DH_VERBOSE=1
greg@346: 
greg@346: # This has to be exported to make some magic below work.
greg@346: export DH_OPTIONS
greg@346: 
greg@346: CFLAGS = -Wall -g
greg@346: 
greg@346: ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
greg@346: 	CFLAGS += -O0
greg@346: else
greg@346: 	CFLAGS += -O2
greg@346: endif
greg@346: 
greg@346: config.status: configure
greg@346: 	#### CONFIG.STATUS ####	
greg@346: 	dh_testdir
greg@346: 	# Add here commands to configure the package.
greg@346: 	cp debian/control-$(shell echo $(CAN_INTERFACE)) debian/control
greg@346: 	./configure --can=$(shell echo $(CAN_INTERFACE)) --prefix=/usr 
greg@346: 
greg@346: ##############
greg@346: # And now the simple things for dpatch. Here we only apply/unapply the patches.
greg@346: # You can do more things with dpatch, like having patches only applied on
greg@346: # a special architecture - see the non-dh version of the sample for this!
greg@346: patch: patch-stamp
greg@346: patch-stamp:
greg@346: 	dpatch apply-all
greg@346: 	dpatch cat-all >patch-stamp
greg@346: 	touch patch-stamp
greg@346: 
greg@346: unpatch:
greg@346: 	dpatch deapply-all
greg@346: 	rm -rf patch-stamp debian/patched
greg@346: 
greg@346: ##################
greg@346: #Architecture 
greg@346: build: build-arch build-indep
greg@346: 
greg@346: build-arch: build-arch-stamp
greg@346: build-arch-stamp:  config.status patch
greg@346: 	#### BUILD-ARCH-STAMP ####
greg@346: 	# Add here commands to compile the arch part of the package.
greg@346: 	$(MAKE) 
greg@346: 	touch $@
greg@346: 
greg@346: build-indep: build-indep-stamp
greg@346: build-indep-stamp:  config.status
greg@346: 	#### BUILD-INDEP-STAMP ####
greg@346: 	# Add here commands to compile the indep part of the package.
greg@346: 
greg@346: clean: unpatch
greg@346: 	#### CLEAN ####
greg@346: 	dh_testdir
greg@346: 	dh_testroot
greg@346: 	rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
greg@346: 
greg@346: 	# Add here commands to clean up after the build process.
greg@346: 	-$(MAKE) clean
greg@346: ifneq "$(wildcard /usr/share/misc/config.sub)" ""
greg@346: 	cp -f /usr/share/misc/config.sub config.sub
greg@346: endif
greg@346: ifneq "$(wildcard /usr/share/misc/config.guess)" ""
greg@346: 	cp -f /usr/share/misc/config.guess config.guess
greg@346: endif
greg@346: 
greg@346: 
greg@346: 	dh_clean 
greg@346: 
greg@346: install: install-indep install-arch
greg@346: install-indep:
greg@346: 	#### INSTALL-INDEP ####
greg@346: 	dh_testdir
greg@346: 	dh_testroot
greg@346: 	dh_clean -k -i 
greg@346: 	dh_installdirs -i
greg@346: 
greg@346: 	# Add here commands to install the indep part of the package into
greg@346: 	# debian/<package>-doc.
greg@346: 	
greg@346: 	dh_install -i --sourcedir=debian/canfestival
greg@346: 
greg@346: install-arch:
greg@346: 	#### INSTALL-ARCH ####
greg@346: 	dh_testdir
greg@346: 	dh_testroot
greg@346: 	dh_clean -k -s 
greg@346: 	dh_installdirs -s
greg@346: 
greg@346: 	# Add here commands to install the arch part of the package into 
greg@346: 	# debian/tmp.
greg@346: 
greg@346: 	$(MAKE) -C src PREFIX=$(CURDIR)/debian/canfestival/usr install	
greg@346: 	$(MAKE) -C drivers PREFIX=$(CURDIR)/debian/canfestival/usr install
greg@373: 	$(MAKE) -C examples PREFIX=$(CURDIR)/debian/canfestival/usr install
greg@346: 	$(MAKE) -C objdictgen PREFIX=$(CURDIR)/debian/canfestival/usr/share install
greg@346: 	cp debian/objdictedit.desktop $(CURDIR)/debian/canfestival/usr/share/applications/objdictedit.desktop
greg@346: 	cp debian/objdictedit.png $(CURDIR)/debian/canfestival/usr/share/objdictgen/objdictedit.png
greg@346: 	dh_install -s
greg@346: 
greg@346: # Must not depend on anything. This is to be called by
greg@346: # binary-arch/binary-indep
greg@346: # in another 'make' thread.
greg@346: binary-common:
greg@346: 	#### BINARY-COMMON ####
greg@346: 	dh_testdir
greg@346: 	dh_testroot
greg@346: 	dh_installchangelogs CHANGES
greg@346: 	dh_installdocs
greg@346: #	dh_installexamples
greg@346: #	dh_installmenu
greg@346: #	dh_installdebconf	
greg@346: #	dh_installlogrotate	
greg@346: #	dh_installemacsen
greg@346: #	dh_installpam
greg@346: #	dh_installmime
greg@346: #	dh_python
greg@346: #	dh_installinit
greg@346: #	dh_installcron
greg@346: #	dh_installinfo
greg@346: #	dh_installman
greg@346: 	dh_link
greg@346: 	dh_strip
greg@346: 	dh_compress
greg@346: 	dh_fixperms
greg@346: #	dh_perl
greg@346: #	dh_makeshlibs
greg@346: 	dh_installdeb
greg@346: #	dh_shlibdeps -l /usr/lib
greg@346: 	dh_gencontrol
greg@346: 	dh_md5sums
greg@346: 	dh_builddeb
greg@346: # Build architecture independant packages using the common target.
greg@346: binary-indep: build-indep install-indep
greg@346: 	#### BINARY-INDEP ####
greg@346: 	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
greg@346: 
greg@346: # Build architecture dependant packages using the common target.
greg@346: binary-arch: build-arch install-arch
greg@346: 	#### BINARY-ARCH ####
greg@346: 	$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
greg@346: 
greg@346: binary: binary-arch binary-indep
greg@346: .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch patch unpatch