new controls dialog; using gconf instead of hgw
[drnoksnes] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
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.
8
9 # Uncomment this to turn on verbose mode.
10 #export DH_VERBOSE=1
11
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)
17
18 # Determine Maemo version
19 MAEMO_VERSION := $(shell cut -d"." -f1 /etc/maemo_version)
20
21 # Determine app version from debian changelog
22 GAME_VERSION := $(shell head -n 1 debian/changelog | sed 's/[^0-9.-]//g')
23
24 # Default CFLAGS
25 CFLAGS = -Wall -g -DMAEMO -DMAEMO_VERSION=$(MAEMO_VERSION)
26 GUI_CFLAGS := -std=c99 -fPIC -shared $(CFLAGS)
27 LDFLAGS = -Wl,-z,defs
28 GUI_LDFLAGS := -export-dynamic -avoid-version -module -shared $(LDFLAGS)
29 ASFLAGS = -g
30
31 M4=m4
32 M4DEFS=-DMAEMO_MAJOR=$(MAEMO_VERSION)
33
34 # Architecture specific CFLAGS
35 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
36         CFLAGS += -O0
37 else ifneq (,$(findstring armel,$(ARCH)))
38         CFLAGS += -O2 -ffast-math
39         GUI_CFLAGS += -Os
40         ifneq (,$(findstring vfp,$(DEB_BUILD_OPTIONS)))
41                 CFLAGS += -march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp
42                 ASFLAGS += -march=armv6j -mfpu=vfp -mfloat-abi=softfp
43         endif
44         ifeq ($(shell expr "$(MAEMO_VERSION)" "<" 5), 1)
45                 # Fixes hang while exiting in Diablo.
46                 CFLAGS += -static-libgcc
47         endif
48 else ifneq (,$(findstring i386,$(ARCH)))
49         CFLAGS += -O2 -ffast-math
50         GUI_CFLAGS += -O2
51 else
52         # Don't support anything else
53         crash
54 endif
55
56 debian/control: debian/control.m4
57         $(M4) $(M4DEFS) debian/control.m4 > debian/control
58
59 configure: configure-stamp
60 configure-stamp:
61         dh_testdir
62         $(M4) $(M4DEFS) debian/control.m4 > debian/control
63         $(M4) $(M4DEFS) debian/drnoksnes.postinst.m4 > debian/drnoksnes.postinst
64         
65         echo ARCH="$(ARCH)" > config.mk
66         echo CONF_GUI=1 >> config.mk
67         echo CONF_HGW=1 >> config.mk
68 ifeq ($(shell expr "$(MAEMO_VERSION)" ">" 4), 1)
69         # Maemo 5 devices do not support Xsp
70         # But they support hildon compositing stuff
71         echo CONF_HD=1 >> config.mk
72 else
73         echo CONF_XSP=1 >> config.mk
74 endif
75         echo ASFLAGS="$(ASFLAGS)" >> config.mk
76         echo CFLAGS="$(CFLAGS)" >> config.mk
77         echo CXXFLAGS="$(CFLAGS)" >> config.mk
78         echo LDFLAGS="$(LDFLAGS)" >> config.mk
79         
80         echo CONF_NLS=1 > gui/config.mk
81         echo CFLAGS="$(GUI_CFLAGS)" >> gui/config.mk
82         echo LDFLAGS="$(GUI_LDFLAGS)" >> gui/config.mk
83         echo MAEMO_VERSION="$(MAEMO_VERSION)" >> gui/config.mk
84         echo GAME_VERSION="$(GAME_VERSION)" >> gui/config.mk
85         
86         touch configure-stamp
87
88 build: build-stamp
89 build-stamp: configure-stamp 
90         dh_testdir
91         $(MAKE)
92         touch $@
93
94 clean:
95         dh_testdir
96         dh_testroot
97         rm -f build-stamp configure-stamp
98         -$(MAKE) clean
99         rm -f config.mk gui/config.mk
100         dh_clean
101
102 install: build
103         dh_testdir
104         dh_testroot
105         dh_clean -k 
106         dh_installdirs
107         $(MAKE) DESTDIR=$(CURDIR)/debian/drnoksnes GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 install
108
109 # Build architecture-independent files here.
110 binary-indep: build install
111 # We have nothing to do by default.
112
113 # Build architecture-dependent files here.
114 binary-arch: build install
115         dh_testdir
116         dh_testroot
117 #       dh_installchangelogs 
118 #       dh_installdocs
119 #       dh_installexamples
120 #       dh_installman
121         dh_gconf
122 #       Fixes a nasty bug with dh_gconf & busybox
123         rm -f $(CURDIR)/debian/drnoksnes.postrm.debhelper
124         dh_link
125         dh_strip --dbg-package=drnoksnes-dbg
126         dh_compress
127         dh_fixperms
128         dh_installdeb
129         dh_shlibdeps
130         dh_gencontrol
131         dh_md5sums
132         dh_builddeb
133
134 binary: binary-indep binary-arch
135 .PHONY: build clean binary-indep binary-arch binary install configure