~ubuntu-branches/ubuntu/saucy/mupen64plus-video-rice/saucy

« back to all changes in this revision

Viewing changes to .pc/default-optimisations.patch/projects/unix/Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Sven Eckelmann
  • Date: 2011-01-22 11:05:28 UTC
  • Revision ID: james.westby@ubuntu.com-20110122110528-ur02h11mxe5nwzf8
Tags: 1.99.4-1
* New Upstream Version
* Updated my maintainer e-mail address
* Split source package to match upstreams modular release packages
* debian/copyright:
  - Update to DEP5 revision 164
  - Update copyright years
* debian/patches:
  - Add hurd_os.patch, Add GNU/Hurd as operating system with "linux" userland
  - Rebase default-optimisations.patch against 1.99.4
  - Remove upstream merged patches: as-needed.patch,
    correct_fpr32_mapping.patch, correct_security_printf.patch,
    debian-archs.patch, dejavu-font.patch, destdir.patch,
    dont-install-unneeded.patch, fix-7z-subfolder.patch,
    fix-desktop-file.patch, fix_r0_override.patch, fix_readpng.patch,
    ftbfs-debugger.patch, ftbfs-dynarec.patch, ftbfs-glibc210.patch,
    ftbfs-gvariant-type-conflicts.patch, ftbfs-kfreebsd.patch,
    glide64_hurd.patch, glide64-noasm.patch, gtk-open-filter.patch,
    interpreter_x86_fldcw.patch, jttl_fix_romclosed.patch, link_gdk.patch,
    load_aidacrate.patch, load_vistatus.patch, noexecstack.patch,
    optional_signinfo.patch, osd-pause-crash.patch, path_max.patch,
    pie_support.patch, plugin-searchpath.patch, remove-gln64.patch,
    remove-nondfsg-icons.patch, resume_on_start.patch, rice-ati-symbols.patch,
    rice-crash-vendorstring.patch, rice_fog.patch, rice_nodebug.patch,
    rice-screenflickering.patch, rice-texturepack-crash.patch,
    rsp_hle_bigendian.patch, rsp_ucode2_reset.patch,
    static-binutils-libs.patch, system-libbz2.patch, system-liblzma.patch,
    system-libpng.patch, system-zlib.patch, version-string.patch,
    xdg-basedir.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
2
# *   Mupen64plus-video-rice - Makefile                                     *
 
3
# *   Mupen64Plus homepage: http://code.google.com/p/mupen64plus/           *
 
4
# *   Copyright (C) 2007-2009 Richard Goedeken                              *
 
5
# *   Copyright (C) 2007-2008 DarkJeztr Tillin9                             *
 
6
# *                                                                         *
 
7
# *   This program is free software; you can redistribute it and/or modify  *
 
8
# *   it under the terms of the GNU General Public License as published by  *
 
9
# *   the Free Software Foundation; either version 2 of the License, or     *
 
10
# *   (at your option) any later version.                                   *
 
11
# *                                                                         *
 
12
# *   This program is distributed in the hope that it will be useful,       *
 
13
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
14
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
15
# *   GNU General Public License for more details.                          *
 
16
# *                                                                         *
 
17
# *   You should have received a copy of the GNU General Public License     *
 
18
# *   along with this program; if not, write to the                         *
 
19
# *   Free Software Foundation, Inc.,                                       *
 
20
# *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
 
21
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
22
# Makefile for RiceVideo plugin in Mupen64Plus
 
23
 
 
24
# detect operating system
 
25
UNAME = $(shell uname -s)
 
26
OS := NONE
 
27
ifeq ("$(UNAME)","Linux")
 
28
  OS = LINUX
 
29
  SO_EXTENSION = so
 
30
  SHARED = -shared
 
31
endif
 
32
ifeq ("$(UNAME)","linux")
 
33
  OS = LINUX
 
34
  SO_EXTENSION = so
 
35
  SHARED = -shared
 
36
endif
 
37
ifneq ("$(filter GNU hurd,$(UNAME))","")
 
38
  OS = LINUX
 
39
  SO_EXTENSION = so
 
40
  SHARED = -shared
 
41
endif
 
42
ifeq ("$(UNAME)","Darwin")
 
43
  OS = OSX
 
44
  SO_EXTENSION = dylib
 
45
  SHARED = -bundle
 
46
endif
 
47
ifeq ("$(UNAME)","FreeBSD")
 
48
  OS = FREEBSD
 
49
  SO_EXTENSION = so
 
50
  SHARED = -shared
 
51
endif
 
52
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
 
53
  OS = LINUX
 
54
  SO_EXTENSION = so
 
55
  SHARED = -shared
 
56
endif
 
57
ifeq ("$(OS)","NONE")
 
58
  $(error OS type "$(UNAME)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
 
59
endif
 
60
 
 
61
# detect system architecture
 
62
HOST_CPU ?= $(shell uname -m)
 
63
CPU := NONE
 
64
ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","")
 
65
  CPU := X86
 
66
  ifeq ("$(BITS)", "32")
 
67
    ARCH_DETECTED := 64BITS_32
 
68
  else
 
69
    ARCH_DETECTED := 64BITS
 
70
  endif
 
71
endif
 
72
ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
 
73
  CPU := X86
 
74
  ARCH_DETECTED := 32BITS
 
75
endif
 
76
# PPC doesn't work yet
 
77
#ifneq ("$(filter ppc powerpc,$(HOST_CPU))","")
 
78
#  CPU := PPC
 
79
#  ARCH_DETECTED := 32BITS
 
80
#  NO_ASM := 1
 
81
#endif
 
82
#ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
 
83
#  CPU := PPC
 
84
#  ARCH_DETECTED := 64BITS
 
85
#  NO_ASM := 1
 
86
#endif
 
87
ifeq ("$(CPU)","NONE")
 
88
  $(error CPU type "$(HOST_CPU)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
 
89
endif
 
90
 
 
91
# base CFLAGS, LIBS, and LDFLAGS
 
92
CFLAGS += -Wall -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -fvisibility=hidden -I../../src
 
93
CXXFLAGS += -fvisibility-inlines-hidden
 
94
LDFLAGS += -lpng
 
95
 
 
96
# Since we are building a shared library, we must compile with -fPIC for x86_64 CPUs.
 
97
# On 32-bit systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
 
98
ifeq ($(ARCH_DETECTED), 64BITS)
 
99
  CFLAGS += -fpic -DPIC
 
100
endif
 
101
# tweak flags for 32-bit build on 64-bit system
 
102
ifeq ($(ARCH_DETECTED), 64BITS_32)
 
103
  ifeq ($(OS), FREEBSD)
 
104
    $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
 
105
  endif
 
106
  CFLAGS += -m32
 
107
  LDFLAGS += -m32 -m elf_i386
 
108
endif
 
109
 
 
110
# set special flags per-system
 
111
ifeq ($(OS),FREEBSD)
 
112
  LDFLAGS += -lGL $(shell pkg-config --libs libpng)
 
113
  CFLAGS += $(shell pkg-config --cflags libpng)
 
114
endif
 
115
ifeq ($(OS), LINUX)
 
116
  LDFLAGS += -ldl -lGL
 
117
  # only export api symbols
 
118
  LDFLAGS += -Wl,-version-script,$(SRCDIR)/video_api_export.ver
 
119
  ifeq ($(CPU), X86)
 
120
    ifeq ($(ARCH_DETECTED), 64BITS)
 
121
      CFLAGS += -pipe -O3 -march=athlon64
 
122
    else
 
123
      CFLAGS += -pipe -O3 -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
 
124
    endif
 
125
  endif
 
126
endif
 
127
ifeq ($(OS), OSX)
 
128
  ifeq ($(CPU), X86)
 
129
    ifeq ($(ARCH_DETECTED), 64BITS)
 
130
      CFLAGS += -pipe -O3 -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
 
131
      LDFLAGS += -ldl -bundle -framework OpenGL -arch x86_64
 
132
    else
 
133
      CFLAGS += -pipe -O3 -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
 
134
      LDFLAGS += -ldl -bundle -framework OpenGL -arch i686
 
135
    endif
 
136
  endif
 
137
endif
 
138
ifeq ($(CPU), PPC)
 
139
  CFLAGS += -mcpu=powerpc
 
140
endif
 
141
 
 
142
# test for presence of SDL
 
143
ifeq ($(shell which sdl-config 2>/dev/null),)
 
144
  $(error No SDL development libraries found!)
 
145
endif
 
146
ifeq ($(OS),FREEBSD)
 
147
    CFLAGS  += $(shell sdl-config --cflags) -DPIC
 
148
    LDFLAGS += $(shell sdl-config --libs) -DPIC
 
149
endif
 
150
ifeq ($(OS),OSX)
 
151
    CFLAGS  += $(shell sdl-config --cflags) -DPIC
 
152
    # sdl-config on mac screws up when we're trying to build a library and not an executable
 
153
    # SDL 1.3 is supposed to fix that, if it's ever released
 
154
    LDFLAGS += -L/usr/local/lib -lSDL -Wl,-framework,Cocoa
 
155
endif
 
156
ifeq ($(OS),LINUX)
 
157
    CFLAGS  += $(shell sdl-config --cflags)
 
158
    LDFLAGS += $(shell sdl-config --libs)
 
159
endif
 
160
 
 
161
# set mupen64plus core API header path
 
162
ifneq ("$(APIDIR)","")
 
163
  CFLAGS += "-I$(APIDIR)"
 
164
else
 
165
  TRYDIR = ../../../mupen64plus-core/src/api
 
166
  ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
 
167
    CFLAGS += -I$(TRYDIR)
 
168
  else
 
169
    TRYDIR = /usr/local/include/mupen64plus
 
170
    ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
 
171
      CFLAGS += -I$(TRYDIR)
 
172
    else
 
173
      TRYDIR = /usr/include/mupen64plus
 
174
      ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
 
175
        CFLAGS += -I$(TRYDIR)
 
176
      else
 
177
        $(error Mupen64Plus API header files not found! Use makefile parameter APIDIR to force a location.)
 
178
      endif
 
179
    endif
 
180
  endif
 
181
endif
 
182
 
 
183
# set shell function names
 
184
CC      ?= gcc
 
185
CXX     ?= g++
 
186
INSTALL ?= install
 
187
ifeq ($(OS),OSX)
 
188
  STRIP ?= strip -x 
 
189
else
 
190
  STRIP ?= strip -s
 
191
endif
 
192
 
 
193
# set special flags for given Makefile parameters
 
194
ifeq ($(DEBUG),1)
 
195
  CFLAGS += -g
 
196
  STRIP = true # disable binary strip
 
197
endif
 
198
ifeq ($(NO_ASM), 1)
 
199
  CFLAGS += -DNO_ASM
 
200
endif
 
201
 
 
202
# set installation options
 
203
ifeq ($(PREFIX),)
 
204
  PREFIX := /usr/local
 
205
endif
 
206
ifeq ($(SHAREDIR),)
 
207
  SHAREDIR := $(PREFIX)/share/mupen64plus
 
208
endif
 
209
ifeq ($(LIBDIR),)
 
210
  LIBDIR := $(PREFIX)/lib/mupen64plus
 
211
endif
 
212
 
 
213
SRCDIR = ../../src
 
214
OBJDIR = _obj
 
215
 
 
216
# list of source files to compile
 
217
SOURCE = \
 
218
        $(SRCDIR)/liblinux/BMGImage.c \
 
219
        $(SRCDIR)/liblinux/BMGUtils.cpp \
 
220
        $(SRCDIR)/liblinux/bmp.c \
 
221
        $(SRCDIR)/liblinux/pngrw.c \
 
222
        $(SRCDIR)/osal_dynamiclib_unix.c \
 
223
        $(SRCDIR)/osal_files_unix.c \
 
224
        $(SRCDIR)/Blender.cpp \
 
225
        $(SRCDIR)/Combiner.cpp \
 
226
        $(SRCDIR)/CombinerTable.cpp \
 
227
        $(SRCDIR)/Config.cpp \
 
228
        $(SRCDIR)/ConvertImage.cpp \
 
229
        $(SRCDIR)/ConvertImage16.cpp \
 
230
        $(SRCDIR)/CNvTNTCombiner.cpp \
 
231
        $(SRCDIR)/Debugger.cpp \
 
232
        $(SRCDIR)/DecodedMux.cpp \
 
233
        $(SRCDIR)/DirectXDecodedMux.cpp \
 
234
        $(SRCDIR)/DeviceBuilder.cpp \
 
235
        $(SRCDIR)/FrameBuffer.cpp \
 
236
        $(SRCDIR)/GeneralCombiner.cpp \
 
237
        $(SRCDIR)/GraphicsContext.cpp \
 
238
        $(SRCDIR)/OGLCombiner.cpp \
 
239
        $(SRCDIR)/OGLCombinerNV.cpp \
 
240
        $(SRCDIR)/OGLCombinerTNT2.cpp \
 
241
        $(SRCDIR)/OGLDecodedMux.cpp \
 
242
        $(SRCDIR)/OGLExtCombiner.cpp \
 
243
        $(SRCDIR)/OGLExtensions.cpp \
 
244
        $(SRCDIR)/OGLExtRender.cpp \
 
245
        $(SRCDIR)/OGLFragmentShaders.cpp \
 
246
        $(SRCDIR)/OGLGraphicsContext.cpp \
 
247
        $(SRCDIR)/OGLRender.cpp \
 
248
        $(SRCDIR)/OGLRenderExt.cpp \
 
249
        $(SRCDIR)/OGLTexture.cpp \
 
250
        $(SRCDIR)/Render.cpp \
 
251
        $(SRCDIR)/RenderBase.cpp \
 
252
        $(SRCDIR)/RenderExt.cpp \
 
253
        $(SRCDIR)/RenderTexture.cpp \
 
254
        $(SRCDIR)/RSP_Parser.cpp \
 
255
        $(SRCDIR)/RSP_S2DEX.cpp \
 
256
        $(SRCDIR)/Texture.cpp \
 
257
        $(SRCDIR)/TextureFilters.cpp \
 
258
        $(SRCDIR)/TextureFilters_2xsai.cpp \
 
259
        $(SRCDIR)/TextureFilters_hq2x.cpp \
 
260
        $(SRCDIR)/TextureFilters_hq4x.cpp \
 
261
        $(SRCDIR)/TextureManager.cpp \
 
262
        $(SRCDIR)/VectorMath.cpp \
 
263
        $(SRCDIR)/Video.cpp
 
264
 
 
265
# generate a list of object files build, make a temporary directory for them
 
266
OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE)))
 
267
OBJECTS += $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(filter %.cpp, $(SOURCE)))
 
268
OBJDIRS = $(dir $(OBJECTS))
 
269
$(shell mkdir -p $(OBJDIRS))
 
270
 
 
271
# build targets
 
272
TARGET = mupen64plus-video-rice.$(SO_EXTENSION)
 
273
 
 
274
targets:
 
275
        @echo "Mupen64plus-video-rice N64 Graphics plugin makefile. "
 
276
        @echo "  Targets:"
 
277
        @echo "    all           == Build Mupen64plus-video-rice plugin"
 
278
        @echo "    clean         == remove object files"
 
279
        @echo "    rebuild       == clean and re-build all"
 
280
        @echo "    install       == Install Mupen64Plus-video-rice plugin"
 
281
        @echo "    uninstall     == Uninstall Mupen64Plus-video-rice plugin"
 
282
        @echo "  Options:"
 
283
        @echo "    BITS=32       == build 32-bit binaries on 64-bit machine"
 
284
        @echo "    NO_ASM=1      == build without inline assembly code (x86 MMX/SSE)"
 
285
        @echo "    APIDIR=path   == path to find Mupen64Plus Core headers"
 
286
        @echo "  Install Options:"
 
287
        @echo "    PREFIX=path   == install/uninstall prefix (default: /usr/local)"
 
288
        @echo "    SHAREDIR=path == path to install shared data files (default: PREFIX/share/mupen64plus)"
 
289
        @echo "    LIBDIR=path   == path to install plugin libraries (default: PREFIX/lib/mupen64plus)"
 
290
        @echo "    DESTDIR=path  == path to prepend to all installation paths (only for packagers)"
 
291
        @echo "  Debugging Options:"
 
292
        @echo "    DEBUG=1       == add debugging symbols"
 
293
 
 
294
all: $(TARGET)
 
295
 
 
296
install: $(TARGET)
 
297
        $(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
 
298
        $(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
 
299
        $(INSTALL) -d -v "$(DESTDIR)$(SHAREDIR)"
 
300
        $(INSTALL) -m 0644 "../../data/RiceVideoLinux.ini" "$(DESTDIR)$(SHAREDIR)"
 
301
 
 
302
uninstall:
 
303
        rm -f "$(DESTDIR)$(LIBDIR)/$(TARGET)"
 
304
        rm -f "$(DESTDIR)$(SHAREDIR)/RiceVideoLinux.ini"
 
305
 
 
306
clean:
 
307
        rm -rf ./_obj/* $(TARGET)
 
308
        rmdir ./_obj
 
309
 
 
310
rebuild: clean all
 
311
 
 
312
# build dependency files
 
313
CFLAGS += -MD
 
314
-include $(OBJECTS:.o=.d)
 
315
 
 
316
CXXFLAGS += $(CFLAGS)
 
317
 
 
318
# reduced compile output when running make without V=1
 
319
ifneq ($(findstring $(MAKEFLAGS),s),s)
 
320
ifndef V
 
321
        Q_CC  = @echo '    CC  '$@;
 
322
        Q_CXX = @echo '    CXX '$@;
 
323
        Q_LD  = @echo '    LD  '$@;
 
324
endif
 
325
endif
 
326
 
 
327
# build rules
 
328
$(TARGET): $(OBJECTS)
 
329
        $(Q_LD)$(CXX) $(SHARED) $^ $(LDFLAGS) -o $@
 
330
        $(STRIP) $@
 
331
 
 
332
$(OBJDIR)/%.o: $(SRCDIR)/%.c
 
333
        $(Q_CC)$(CC) -o $@ $(CFLAGS) -c $<
 
334
 
 
335
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
 
336
        $(Q_CXX)$(CXX) -o $@ $(CXXFLAGS) -c $<