File: rules

package info (click to toggle)
xmame 0.106-2
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 108,660 kB
  • ctags: 145,358
  • sloc: ansic: 1,578,356; perl: 1,384; xml: 1,366; asm: 1,341; sh: 399; objc: 366; tcl: 213; makefile: 208; csh: 3
file content (157 lines) | stat: -rwxr-xr-x 4,920 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/usr/bin/make -f
# Build rules for xmame
# Created by Bruno Barrera C. <bruno@debian.org> and Nicos Panayides <anarxia@gmx.net>
# based on the rules file from Martin Mitchell <martin@debian.org>

# Comment if you do not want MESS to be built
DEB_BUILD_MESS = yes

# Pretty standard stuff
CC=gcc
DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
DEB_HOST_GNU_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)

### Select which binary packages to build ###
DEB_BINARY_PACKAGES = -pxmame-x -pxmame-sdl -pxmame-tools
DEB_BINARY_INDEP_PACKAGES = -pxmame-common

# Build svgalib binary for i386 only
ifeq ($(DEB_HOST_GNU_CPU),i486)
DEB_BINARY_PACKAGES += -pxmame-svga
endif

# Add xmess packages if mess is selected
ifeq ($(DEB_BUILD_MESS),yes)
DEB_BINARY_PACKAGES += -pxmess-x -pxmess-sdl
DEB_BINARY_INDEP_PACKAGES += -pxmess-common
endif

### Set arch and CPU options to what makefile.unix expects ###

# Arch: no change needed 
MAME_ARCH := $(DEB_HOST_GNU_SYSTEM)

# Set CPU, a bit trickier

# Ideally get it from DEB_HOST_GNU_CPU (the debian way)
# Works for: i386, ia64, alpha, m68k, mips
MAME_CPU := $(DEB_HOST_GNU_CPU)

# It worked until i386 became i486 anyway.
ifeq ($(DEB_HOST_GNU_CPU),i486)
MAME_CPU = i386
endif

MY_CPU := $(MAME_CPU)
MY_CPU := $(MY_CPU:sh3=risc_lsb)
MY_CPU := $(MY_CPU:sh4=risc_lsb)
MY_CPU := $(MY_CPU:sh3eb=risc)
MY_CPU := $(MY_CPU:sh4eb=risc)
MY_CPU := $(MY_CPU:x86_64=amd64)

DEB_ESOUND_OPTS := SOUND_ESOUND=1
DEB_SOUND_OPTS = SOUND_WAVEOUT=1 SOUND_ALSA=1
DEB_INPUT_OPTS = JOY_STANDARD=1 LIRC=1
DEB_COMMON_OPTS = CC=$(CC) LD="$(CC) -Wl,-s,--relax" DBGFLAGS=-g DESTDIR=/usr/games MANDIR=/usr/share/man/man6 ARCH=$(MAME_ARCH) MY_CPU=$(MY_CPU)
DEB_XMAME_OPTS = TARGET=mame XMAMEROOT="/usr/share/games/xmame" SYSCONFDIR="/etc/xmame"
DEB_XMESS_OPTS = TARGET=mess XMAMEROOT="/usr/share/games/xmess" SYSCONFDIR="/etc/xmame"

DEB_X11_OPTS = DISPLAY_METHOD=x11 $(DEB_INPUT_OPTS) $(DEB_SOUND_OPTS) $(DEB_ESOUND_OPTS) X11_DGA=1 X11_XV=1 X11_OPENGL=1
DEB_SDL_OPTS = DISPLAY_METHOD=SDL SOUND_SDL=1 JOY_SDL=1 $(DEB_INPUT_OPTS)
DEB_SVGA_OPTS = DISPLAY_METHOD=svgalib $(DEB_SOUND_OPTS) $(DEB_INPUT_OPTS)

# Optimizations for i386 
ifeq ($(DEB_HOST_ARCH),i386)
DEB_OPTFLAGS="-02 -Wall -Wno-unused -march=i586 -mcpu=i686 -fomit-frame-pointer -funroll-loops -ffast-math -pipe"
DEB_COMMON_OPTS += X86_MIPS3_DRC=1 EFFECT_MMX_ASM=1
else
DEB_OPTFLAGS="-02 -Wall -Wno-unused -fomit-frame-pointer -funroll-loops -ffast-math -fsigned-char -pipe -mlongcall"
endif

# Support for the noopt option
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
DEB_OPTFLAGS="-O0 -Wall -Wno-unused"
endif

DEB_COMMON_OPTS += OPTFLAGS=$(DEB_OPTFLAGS)

build: 
	dh_testdir
	$(MAKE) $(DEB_XMAME_OPTS) $(DEB_COMMON_OPTS) $(DEB_X11_OPTS)
	$(MAKE) $(DEB_XMAME_OPTS) $(DEB_COMMON_OPTS) $(DEB_SDL_OPTS)

# Create svgalib package only on i386 (only arch that has one)
ifeq ($(DEB_HOST_ARCH),i386)
	$(MAKE) $(DEB_XMAME_OPTS) $(DEB_COMMON_OPTS) $(DEB_SVGA_OPTS)
endif

ifeq ($(DEB_BUILD_MESS),yes)
	$(MAKE) $(DEB_XMESS_OPTS) $(DEB_COMMON_OPTS) $(DEB_X11_OPTS)
	$(MAKE) $(DEB_XMESS_OPTS) $(DEB_COMMON_OPTS) $(DEB_SDL_OPTS)
endif

	touch build

clean:  
	dh_testdir
	-rm -f build
	-$(MAKE) TARGET=mame clean
	-$(MAKE) TARGET=mess clean
	debconf-updatepo
	dh_clean -a
	dh_clean $(DEB_BINARY_INDEP_PACKAGES) -pxmame-gl

binary-indep:
	dh_testdir
	dh_testroot

	dh_installdirs $(DEB_BINARY_INDEP_PACKAGES) -pxmame-gl
	dh_link usr/share/doc/xmame-common usr/share/doc/xmame
	dh_link -pxmame-gl
	dh_installdocs $(DEB_BINARY_INDEP_PACKAGES)
	dh_install $(DEB_BINARY_INDEP_PACKAGES) -pxmame-gl

ifeq ($(DEB_BUILD_MESS),yes)
	dh_installchangelogs -pxmess-common -k doc/mess/messnew.txt
endif

	dh_installman $(DEB_BINARY_INDEP_PACKAGES)
	dh_installchangelogs -pxmame-common -k doc/changes.unix
	
	dh_compress $(DEB_BINARY_INDEP_PACKAGES)
	dh_fixperms $(DEB_BINARY_INDEP_PACKAGES)
	dh_installdeb $(DEB_BINARY_INDEP_PACKAGES) -pxmame-gl
	dh_gencontrol $(DEB_BINARY_INDEP_PACKAGES) -pxmame-gl
	dh_md5sums $(DEB_BINARY_INDEP_PACKAGES) -pxmame-gl
	dh_builddeb $(DEB_BINARY_INDEP_PACKAGES) -pxmame-gl

binary-arch: build
	dh_testdir
	dh_testroot
	dh_clean -k $(DEB_BINARY_PACKAGES)
	dh_installdirs $(DEB_BINARY_PACKAGES)
	dh_install $(DEB_BINARY_PACKAGES)
	dh_installman -pxmame-tools
	dh_installdocs -pxmame-tools
	dh_installchangelogs -pxmame-tools
	dh_link $(DEB_BINARY_PACKAGES)
	dh_strip $(DEB_BINARY_PACKAGES)
	dh_compress $(DEB_BINARY_PACKAGES)
	dh_fixperms $(DEB_BINARY_PACKAGES)

ifeq ($(DEB_HOST_ARCH),i386)
	chmod 4755 debian/xmame-svga/usr/games/xmame.svgalib
endif
	dh_installdeb $(DEB_BINARY_PACKAGES)
	dh_shlibdeps $(DEB_BINARY_PACKAGES)
	dh_installdebconf -pxmame-x
ifeq ($(DEB_BUILD_MESS),yes)
	dh_installdebconf -pxmess-x
endif
	dh_gencontrol $(DEB_BINARY_PACKAGES)
	dh_md5sums $(DEB_BINARY_PACKAGES)
	dh_builddeb $(DEB_BINARY_PACKAGES)

binary: binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean