3 # Sample debian/rules that uses debhelper.
4 # This file was originally written by Joey Hess and Craig Small.
5 # As a special exception, when this file is copied by dh-make into a
6 # dh-make output file, you may use that output file without restriction.
7 # This special exception was added by Craig Small in version 0.37 of dh-make.
9 # Uncomment this to turn on verbose mode.
12 # These are used for cross-compiling and for saving the configure script
13 # from having to guess our platform (since we know it already)
14 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
15 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
16 ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
18 # Determine Maemo version
19 MAEMO_VERSION := $(shell cut -d"." -f1 /etc/maemo_version)
21 # Determine app version from debian changelog
22 GAME_VERSION := $(shell head -n 1 debian/changelog | sed 's/[^0-9.-]//g')
25 CFLAGS := -Wall -g -DMAEMO -DMAEMO_VERSION=$(MAEMO_VERSION)
26 CXXFLAGS := -Wall -g -DMAEMO -DMAEMO_VERSION=$(MAEMO_VERSION)
27 GUI_CFLAGS := -std=c99 -fPIC -shared $(CFLAGS)
28 LDFLAGS := -Wl,-z,defs -Wl,-O1
29 GUI_LDFLAGS := -export-dynamic -avoid-version -module -shared $(LDFLAGS)
32 # Compiler optimization settings
33 OPT_CFLAGS := -O2 -fomit-frame-pointer -ffast-math
34 OPT_CXXFLAGS := $(OPT_CFLAGS) -fno-exceptions -fno-rtti
37 M4DEFS=-DMAEMO_MAJOR=$(MAEMO_VERSION)
39 # Architecture specific CFLAGS
40 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
44 else ifneq (,$(findstring armel,$(ARCH)))
45 CFLAGS += $(OPT_CFLAGS)
46 CXXFLAGS += $(OPT_CXXFLAGS)
48 ifneq (,$(findstring vfp,$(DEB_BUILD_OPTIONS)))
49 CFLAGS += -march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp
50 ASFLAGS += -march=armv6j -mfpu=vfp -mfloat-abi=softfp
52 ifeq ($(shell expr "$(MAEMO_VERSION)" "<" 5), 1)
53 # Fixes hang while exiting in Diablo.
54 CFLAGS += -static-libgcc
56 else ifneq (,$(findstring i386,$(ARCH)))
57 CFLAGS += $(OPT_CFLAGS)
58 CXXFLAGS += $(OPT_CXXFLAGS)
61 # Don't support anything else
65 debian/control: debian/control.m4
66 $(M4) $(M4DEFS) debian/control.m4 > debian/control
68 configure: configure-stamp
71 $(M4) $(M4DEFS) debian/control.m4 > debian/control
72 $(M4) $(M4DEFS) debian/drnoksnes.postinst.m4 > debian/drnoksnes.postinst
74 echo ARCH="$(ARCH)" > config.mk
75 echo CONF_GUI=1 >> config.mk
76 ifeq ($(shell expr "$(MAEMO_VERSION)" ">" 4), 1)
77 # Maemo 5 devices do not support Xsp
78 # But they support hildon compositing stuff
79 echo CONF_HD=1 >> config.mk
81 echo CONF_XSP=1 >> config.mk
83 echo CONF_ZEEMOTE=1 >> config.mk
84 echo ASFLAGS="$(ASFLAGS)" >> config.mk
85 echo CFLAGS="$(CFLAGS)" >> config.mk
86 echo CXXFLAGS="$(CXXFLAGS)" >> config.mk
87 echo LDFLAGS="$(LDFLAGS)" >> config.mk
89 echo CONF_NLS=1 > gui/config.mk
90 echo CFLAGS="$(GUI_CFLAGS)" >> gui/config.mk
91 echo LDFLAGS="$(GUI_LDFLAGS)" >> gui/config.mk
92 echo MAEMO_VERSION="$(MAEMO_VERSION)" >> gui/config.mk
93 echo GAME_VERSION="$(GAME_VERSION)" >> gui/config.mk
98 build-stamp: configure-stamp
106 rm -f build-stamp configure-stamp
108 rm -f config.mk gui/config.mk
116 $(MAKE) DESTDIR=$(CURDIR)/debian/drnoksnes GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 install
118 # Build architecture-independent files here.
119 binary-indep: build install
120 # We have nothing to do by default.
122 # Build architecture-dependent files here.
123 binary-arch: build install
126 # dh_installchangelogs
131 # Fixes a nasty bug with dh_gconf & busybox
132 rm -f $(CURDIR)/debian/drnoksnes.postrm.debhelper
134 dh_strip --dbg-package=drnoksnes-dbg
143 binary: binary-indep binary-arch
144 .PHONY: build clean binary-indep binary-arch binary install configure