~ubuntu-branches/ubuntu/saucy/mupen64plus-video-arachnoid/saucy-proposed

« back to all changes in this revision

Viewing changes to projects/unix/Makefile

  • Committer: Package Import Robot
  • Author(s): Sven Eckelmann
  • Date: 2013-07-06 01:31:51 UTC
  • mfrom: (1.3.1) (3.1.6 experimental)
  • Revision ID: package-import@ubuntu.com-20130706013151-sqpjrn75krbesdsk
Tags: 2.0.0-1
* New Upstream Version
* Upload to unstable
* debian/control:
  - Build-Depend on debhelper 9.20130604 for support of parameters when
    detecting targets in dh_auto_*
* debian/rules:
  - Work around new debhelper 9.20130624 dh_auto_{clean,test} behavior
    which is causing a FTBFS by adding an explicit
    override_dh_auto_{clean,test} rule
* debian/watch:
  - Verify new upstream versions using GPG key E05E608A04EF22F7596B

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
# Makefile for mupen64plus-video-arachnoid
22
22
 
23
23
# detect operation system
24
 
UNAME = $(shell uname -s)
 
24
UNAME ?= $(shell uname -s)
25
25
ifeq ("$(UNAME)","Linux")
26
26
  OS = LINUX
27
27
  SO_EXTENSION = so
59
59
  SO_EXTENSION = so
60
60
  SHARED = -shared
61
61
endif
 
62
ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
 
63
  OS = MINGW
 
64
  SO_EXTENSION = dll
 
65
  SHARED = -shared
 
66
  PIC = 0
 
67
endif
 
68
ifeq ("$(OS)","NONE")
 
69
  $(error OS type "$(UNAME)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
 
70
endif
62
71
 
63
72
# detect system architecture
64
73
HOST_CPU ?= $(shell uname -m)
76
85
  CPU := X86
77
86
  ARCH_DETECTED := 32BITS
78
87
endif
79
 
ifneq ("$(filter ppc powerpc,$(HOST_CPU))","")
 
88
ifneq ("$(filter ppc macppc socppc powerpc,$(HOST_CPU))","")
80
89
  CPU := PPC
81
90
  ARCH_DETECTED := 32BITS
82
91
  BIG_ENDIAN := 1
90
99
  PIC ?= 1
91
100
  $(warning Architecture "$(HOST_CPU)" not officially supported.')
92
101
endif
 
102
ifneq ("$(filter arm%,$(HOST_CPU))","")
 
103
  ifeq ("$(filter arm%b,$(HOST_CPU))","")
 
104
    CPU := ARM
 
105
    ARCH_DETECTED := 32BITS
 
106
    PIC ?= 1
 
107
    $(warning Architecture "$(HOST_CPU)" not officially supported.')
 
108
  endif
 
109
endif
93
110
 
94
111
# base CFLAGS, LDLIBS, and LDFLAGS
95
 
OPTFLAGS ?= -O3
96
 
CFLAGS += $(OPTFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src \
 
112
OPTFLAGS ?= -O3 -flto
 
113
WARNFLAGS ?= -Wall
 
114
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src \
97
115
                 -I../../src/hash -I../../src/ucodes -I../../src/GBI -I../../src/RDP -I../../src/utils \
98
116
                 -I../../src/log -I../../src/RSP -I../../src/framebuffer -I../../src/math -I../../src/renderer \
99
117
                 -I../../src/Assembler -I../../src/texture -I../../src/config -I../../src/Combiner 
103
121
# On OS X, add a few extra flags to elegantly support cross-compilation and backward
104
122
# compatibility (and also the flags to link against OpenGL)
105
123
ifeq ($(OS), OSX)
 
124
  # Select the proper SDK
 
125
  # Also, SDKs are stored in a different location since XCode 4.3
 
126
  OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .)
 
127
  OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .)
 
128
  OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .)
 
129
  OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`")
 
130
  ifeq ($(OSX_XCODEGE43), 11)
 
131
    OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
 
132
  else
 
133
    OSX_SYSROOT := /Developer/SDKs
 
134
  endif
 
135
 
106
136
  ifeq ($(CPU), X86)
107
137
    ifeq ($(ARCH_DETECTED), 64BITS)
108
 
      CFLAGS += -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
109
 
      LDFLAGS += -bundle -framework OpenGL -arch x86_64 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.5.sdk
 
138
      CFLAGS += -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
 
139
      LDFLAGS += -bundle
110
140
    else
111
 
      CFLAGS += -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
112
 
      LDFLAGS += -bundle -framework OpenGL -arch i686 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.5.sdk
 
141
      CFLAGS += -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
 
142
      LDFLAGS += -bundle
113
143
    endif
114
144
  endif
115
145
else
116
 
  # test for essential build dependencies
117
 
  ifeq ($(shell which pkg-config 2>/dev/null),)
118
 
    $(error pkg-config not found)
119
 
  endif
120
 
  ifeq ($(shell pkg-config --modversion gl 2>/dev/null),)
121
 
    $(error No OpenGL development libraries found!)
122
 
  endif
123
 
 
124
 
  CFLAGS += -pthread $(shell pkg-config --cflags gl)
125
 
  LDLIBS += -pthread $(shell pkg-config --libs gl)
 
146
  # search for OpenGL libraries
 
147
  ifeq ($(OS), OSX)
 
148
    GL_LDLIBS = -framework OpenGL
 
149
  endif
 
150
  ifeq ($(OS), MINGW)
 
151
    GL_LDLIBS = -lopengl32
 
152
  endif
 
153
 
 
154
  ifeq ($(origin GL_CFLAGS) $(origin GL_LDLIBS), undefined undefined)
 
155
    ifeq ($(origin PKG_CONFIG), undefined)
 
156
      PKG_CONFIG = $(CROSS_COMPILE)pkg-config
 
157
      ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)
 
158
        $(error $(PKG_CONFIG) not found)
 
159
      endif
 
160
    endif
 
161
 
 
162
    ifeq ($(shell $(PKG_CONFIG) --modversion gl 2>/dev/null),)
 
163
      $(error No OpenGL development libraries found!)
 
164
    endif
 
165
    GL_CFLAGS += $(shell $(PKG_CONFIG) --cflags gl)
 
166
    GL_LDLIBS +=  $(shell $(PKG_CONFIG) --libs gl)
 
167
  endif
 
168
  CFLAGS += $(GL_CFLAGS)
 
169
  LDLIBS += $(GL_LDLIBS)
 
170
 
 
171
  CFLAGS += -pthread
126
172
endif
127
173
ifeq ($(OS), LINUX)
128
174
  LDLIBS += -ldl 
136
182
# On 32-bit x86 systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
137
183
ifeq ($(PIC), 1)
138
184
  CFLAGS += -fPIC
139
 
  LDFLAGS += -fPIC
140
185
else
141
186
  CFLAGS += -fno-PIC
142
 
  LDFLAGS += -fno-PIC
143
187
endif
144
188
 
145
189
ifeq ($(BIG_ENDIAN), 1)
176
220
    # tweak flags for 32-bit build on 64-bit system
177
221
    ifeq ($(ARCH_DETECTED), 64BITS_32)
178
222
      CFLAGS += -m32
179
 
      LDFLAGS += -m32 -Wl,-m,elf_i386
 
223
      LDFLAGS += -Wl,-m,elf_i386
180
224
    endif
181
225
  endif
182
226
else
195
239
endif
196
240
 
197
241
# set base program pointers and flags
198
 
CC       ?= gcc
199
 
CXX      ?= g++
 
242
CC        = $(CROSS_COMPILE)gcc
 
243
CXX       = $(CROSS_COMPILE)g++
200
244
RM       ?= rm -f
201
245
INSTALL  ?= install
202
246
MKDIR ?= mkdir -p
203
247
COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
204
248
COMPILE.cc = $(Q_CXX)$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
205
 
LINK.o = $(Q_LD)$(CXX) $(LDFLAGS) $(TARGET_ARCH)
 
249
LINK.o = $(Q_LD)$(CXX) $(CXXFLAGS) $(LDFLAGS) $(TARGET_ARCH)
206
250
 
207
251
# set special flags for given Makefile parameters
208
252
ifeq ($(DEBUG),1)
228
272
 
229
273
 
230
274
SRCDIR = ../../src
231
 
OBJDIR = _obj
 
275
OBJDIR = _obj$(POSTFIX)
232
276
 
233
277
# list of source files to compile
234
278
SOURCE = \
282
326
        $(SRCDIR)/Combiner/CombinerCache.cpp \
283
327
        $(SRCDIR)/RomDetector.cpp \
284
328
        $(SRCDIR)/RDP/RDP.cpp \
285
 
        $(SRCDIR)/RDP/RDPInstructions.cpp \
286
 
        $(SRCDIR)/osal_dynamiclib_unix.cpp
 
329
        $(SRCDIR)/RDP/RDPInstructions.cpp
 
330
 
 
331
ifeq ($(OS),MINGW)
 
332
SOURCE += $(SRCDIR)/osal_dynamiclib_win32.cpp
 
333
else
 
334
SOURCE += $(SRCDIR)/osal_dynamiclib_unix.cpp
 
335
endif
287
336
 
288
337
 
289
338
# generate a list of object files build, make a temporary directory for them
293
342
 
294
343
# build targets
295
344
 
296
 
TARGET = mupen64plus-video-arachnoid.$(SO_EXTENSION)
 
345
TARGET = mupen64plus-video-arachnoid$(POSTFIX).$(SO_EXTENSION)
297
346
targets:
298
347
        @echo "Mupen64plus-video-arachnoid N64 Graphics plugin makefile. "
299
348
        @echo "  Targets:"
305
354
        @echo "  Options:"
306
355
        @echo "    BITS=32       == build 32-bit binaries on 64-bit machine"
307
356
        @echo "    APIDIR=path   == path to find Mupen64Plus Core headers"
308
 
        @echo "    OPTFLAGS=flag == compiler optimization (default: -O3)"
 
357
        @echo "    OPTFLAGS=flag == compiler optimization (default: -O3 -flto)"
 
358
        @echo "    WARNFLAGS=flag == compiler warning levels (default: -Wall)"
309
359
        @echo "    PIC=(1|0)     == Force enable/disable of position independent code"
 
360
        @echo "    POSTFIX=name  == String added to the name of the the build (default: '')"
310
361
        @echo "  Install Options:"
311
362
        @echo "    PREFIX=path   == install/uninstall prefix (default: /usr/local)"
312
363
        @echo "    LIBDIR=path   == library prefix (default: PREFIX/lib)"
314
365
        @echo "    DESTDIR=path  == path to prepend to all installation paths (only for packagers)"
315
366
        @echo "  Debugging Options:"
316
367
        @echo "    DEBUG=1       == add debugging symbols"
317
 
        @echo "    LTO=1         == enable experimental build with link-time optimization"
318
368
        @echo "    V=1           == show verbose compiler output"
319
369
 
320
370
all: $(TARGET)
328
378
 
329
379
 
330
380
clean:
331
 
        $(RM) -r ./_obj mupen64plus-video-arachnoid.$(SO_EXTENSION)
 
381
        $(RM) -r $(OBJDIR) $(TARGET)
332
382
 
333
383
# build dependency files
334
384
CFLAGS += -MD
335
385
-include $(OBJECTS:.o=.d)
336
386
 
337
387
CXXFLAGS += $(CFLAGS)
338
 
ifeq ($(LTO), 1)
339
 
  CFLAGS += -flto
340
 
  CXXFLAGS += -flto
341
 
  LDFLAGS += -fuse-linker-plugin $(CXXFLAGS)
342
 
endif
343
388
 
344
389
# standard build rules
345
390
$(OBJDIR)/%.o: $(SRCDIR)/%.c