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

« back to all changes in this revision

Viewing changes to .pc/gcc_lto.patch/projects/unix/Makefile

  • Committer: Package Import Robot
  • Author(s): Sven Eckelmann
  • Date: 2013-05-05 14:21:41 UTC
  • mfrom: (3.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20130505142141-hu122rcme4kvwy7c
Tags: 1.99.5-2
* Upload to unstable
* Remove obsolete DM-Upload-Allowed in debian/control
* Disable extra debug code in release builds with -DNDEBUG in
  debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
 
# *   Arachnoid - Makefile                                                  *
3
 
# *   http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/            *
4
 
# *   Copyright (C) 2009 Richard42, Jon Ring                                *
5
 
# *                                                                         *
6
 
# *   This program is free software; you can redistribute it and/or modify  *
7
 
# *   it under the terms of the GNU General Public License as published by  *
8
 
# *   the Free Software Foundation; either version 2 of the License, or     *
9
 
# *   (at your option) any later version.                                   *
10
 
# *                                                                         *
11
 
# *   This program is distributed in the hope that it will be useful,       *
12
 
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13
 
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14
 
# *   GNU General Public License for more details.                          *
15
 
# *                                                                         *
16
 
# *   You should have received a copy of the GNU General Public License     *
17
 
# *   along with this program; if not, write to the                         *
18
 
# *   Free Software Foundation, Inc.,                                       *
19
 
# *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
20
 
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
21
 
# Makefile for mupen64plus-video-arachnoid
22
 
 
23
 
# detect operation system
24
 
UNAME = $(shell uname -s)
25
 
ifeq ("$(UNAME)","Linux")
26
 
  OS = LINUX
27
 
  SO_EXTENSION = so
28
 
  SHARED = -shared
29
 
endif
30
 
ifeq ("$(UNAME)","linux")
31
 
  OS = LINUX
32
 
  SO_EXTENSION = so
33
 
  SHARED = -shared
34
 
endif
35
 
ifneq ("$(filter GNU hurd,$(UNAME))","")
36
 
  OS = LINUX
37
 
  SO_EXTENSION = so
38
 
  SHARED = -shared
39
 
endif
40
 
ifeq ("$(UNAME)","Darwin")
41
 
  OS = OSX
42
 
  LDLIBS += -liconv -lpng
43
 
  SO_EXTENSION = dylib
44
 
  SHARED = -bundle
45
 
endif
46
 
ifeq ("$(UNAME)","FreeBSD")
47
 
  OS = FREEBSD
48
 
  SO_EXTENSION = so
49
 
  SHARED = -shared
50
 
endif
51
 
ifeq ("$(UNAME)","OpenBSD")
52
 
  OS = FREEBSD
53
 
  SO_EXTENSION = so
54
 
  SHARED = -shared
55
 
  $(warning OS type "$(UNAME)" not officially supported.')
56
 
endif
57
 
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
58
 
  OS = LINUX
59
 
  SO_EXTENSION = so
60
 
  SHARED = -shared
61
 
endif
62
 
 
63
 
# detect system architecture
64
 
HOST_CPU ?= $(shell uname -m)
65
 
NO_ASM ?= 1
66
 
ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","")
67
 
  CPU := X86
68
 
  ifeq ("$(BITS)", "32")
69
 
    ARCH_DETECTED := 64BITS_32
70
 
  else
71
 
    ARCH_DETECTED := 64BITS
72
 
    PIC ?= 1
73
 
  endif
74
 
endif
75
 
ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
76
 
  CPU := X86
77
 
  ARCH_DETECTED := 32BITS
78
 
endif
79
 
ifneq ("$(filter ppc powerpc,$(HOST_CPU))","")
80
 
  CPU := PPC
81
 
  ARCH_DETECTED := 32BITS
82
 
  BIG_ENDIAN := 1
83
 
  PIC ?= 1
84
 
  $(warning Architecture "$(HOST_CPU)" not officially supported.')
85
 
endif
86
 
ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
87
 
  CPU := PPC
88
 
  ARCH_DETECTED := 64BITS
89
 
  BIG_ENDIAN := 1
90
 
  PIC ?= 1
91
 
  $(warning Architecture "$(HOST_CPU)" not officially supported.')
92
 
endif
93
 
 
94
 
# base CFLAGS, LDLIBS, and LDFLAGS
95
 
OPTFLAGS ?= -O3
96
 
CFLAGS += $(OPTFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src \
97
 
                 -I../../src/hash -I../../src/ucodes -I../../src/GBI -I../../src/RDP -I../../src/utils \
98
 
                 -I../../src/log -I../../src/RSP -I../../src/framebuffer -I../../src/math -I../../src/renderer \
99
 
                 -I../../src/Assembler -I../../src/texture -I../../src/config -I../../src/Combiner 
100
 
CXXFLAGS += -fvisibility-inlines-hidden
101
 
LDFLAGS += $(SHARED)
102
 
 
103
 
# On OS X, add a few extra flags to elegantly support cross-compilation and backward
104
 
# compatibility (and also the flags to link against OpenGL)
105
 
ifeq ($(OS), OSX)
106
 
  ifeq ($(CPU), X86)
107
 
    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
110
 
    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
113
 
    endif
114
 
  endif
115
 
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
 
  ifeq ($(shell pkg-config --modversion glu 2>/dev/null),)
124
 
    $(error No OpenGL utility development libraries found!)
125
 
  endif
126
 
 
127
 
  CFLAGS += -pthread $(shell pkg-config --cflags gl glu)
128
 
  LDLIBS += -pthread $(shell pkg-config --libs gl glu)
129
 
endif
130
 
ifeq ($(OS), LINUX)
131
 
  LDLIBS += -ldl 
132
 
endif
133
 
ifeq ($(OS), FREEBSD)
134
 
  LDLIBS += -lc
135
 
endif
136
 
 
137
 
 
138
 
# Since we are building a shared library, we must compile with -fPIC on some architectures
139
 
# 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
140
 
ifeq ($(PIC), 1)
141
 
  CFLAGS += -fPIC
142
 
  LDFLAGS += -fPIC
143
 
else
144
 
  CFLAGS += -fno-PIC
145
 
  LDFLAGS += -fno-PIC
146
 
endif
147
 
 
148
 
ifeq ($(BIG_ENDIAN), 1)
149
 
  CFLAGS += -DM64P_BIG_ENDIAN
150
 
endif
151
 
 
152
 
# set mupen64plus core API header path
153
 
ifneq ("$(APIDIR)","")
154
 
  CFLAGS += "-I$(APIDIR)"
155
 
else
156
 
  TRYDIR = ../../../mupen64plus-core/src/api
157
 
  ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
158
 
    CFLAGS += -I$(TRYDIR)
159
 
  else
160
 
    TRYDIR = /usr/local/include/mupen64plus
161
 
    ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
162
 
      CFLAGS += -I$(TRYDIR)
163
 
    else
164
 
      TRYDIR = /usr/include/mupen64plus
165
 
      ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
166
 
        CFLAGS += -I$(TRYDIR)
167
 
      endif
168
 
    endif
169
 
  endif
170
 
endif
171
 
 
172
 
# set special flags per-system
173
 
ifeq ($(OS), LINUX)
174
 
  # only export api symbols
175
 
  LDFLAGS += -Wl,-version-script,$(SRCDIR)/video_api_export.ver
176
 
endif
177
 
ifneq ($(OS), FREEBSD)
178
 
  ifeq ($(CPU), X86)
179
 
    # tweak flags for 32-bit build on 64-bit system
180
 
    ifeq ($(ARCH_DETECTED), 64BITS_32)
181
 
      CFLAGS += -m32
182
 
      LDFLAGS += -m32 -Wl,-m,elf_i386
183
 
    endif
184
 
  endif
185
 
else
186
 
  ifeq ($(ARCH_DETECTED), 64BITS_32)
187
 
    $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
188
 
  endif
189
 
endif
190
 
 
191
 
# reduced compile output when running make without V=1
192
 
ifneq ($(findstring $(MAKEFLAGS),s),s)
193
 
ifndef V
194
 
        Q_CC  = @echo '    CC  '$@;
195
 
        Q_CXX = @echo '    CXX '$@;
196
 
        Q_LD  = @echo '    LD  '$@;
197
 
endif
198
 
endif
199
 
 
200
 
# set base program pointers and flags
201
 
CC       ?= gcc
202
 
CXX      ?= g++
203
 
RM       ?= rm -f
204
 
INSTALL  ?= install
205
 
MKDIR ?= mkdir -p
206
 
COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
207
 
COMPILE.cc = $(Q_CXX)$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
208
 
LINK.o = $(Q_LD)$(CXX) $(LDFLAGS) $(TARGET_ARCH)
209
 
 
210
 
# set special flags for given Makefile parameters
211
 
ifeq ($(DEBUG),1)
212
 
  CFLAGS += -g
213
 
  INSTALL_STRIP_FLAG ?= 
214
 
else
215
 
  INSTALL_STRIP_FLAG ?= -s
216
 
endif
217
 
 
218
 
# set installation options
219
 
ifeq ($(PREFIX),)
220
 
  PREFIX := /usr/local
221
 
endif
222
 
ifeq ($(SHAREDIR),)
223
 
  SHAREDIR := $(PREFIX)/share/mupen64plus
224
 
endif
225
 
ifeq ($(LIBDIR),)
226
 
  LIBDIR := $(PREFIX)/lib
227
 
endif
228
 
ifeq ($(PLUGINDIR),)
229
 
  PLUGINDIR := $(LIBDIR)/mupen64plus
230
 
endif
231
 
 
232
 
 
233
 
SRCDIR = ../../src
234
 
OBJDIR = _obj
235
 
 
236
 
# list of source files to compile
237
 
SOURCE = \
238
 
        $(SRCDIR)/main.cpp \
239
 
        $(SRCDIR)/log/Logger.cpp \
240
 
        $(SRCDIR)/config/Config.cpp \
241
 
        $(SRCDIR)/config/StringFunctions.cpp \
242
 
        $(SRCDIR)/GraphicsPlugin.cpp \
243
 
        $(SRCDIR)/OpenGLManager.cpp \
244
 
        $(SRCDIR)/renderer/OpenGLRenderer.cpp \
245
 
        $(SRCDIR)/framebuffer/FrameBuffer.cpp \
246
 
        $(SRCDIR)/renderer/OpenGL2DRenderer.cpp \
247
 
        $(SRCDIR)/FogManager.cpp \
248
 
        $(SRCDIR)/MultiTexturingExt.cpp \
249
 
        $(SRCDIR)/ExtensionChecker.cpp \
250
 
        $(SRCDIR)/SecondaryColorExt.cpp \
251
 
        $(SRCDIR)/Memory.cpp \
252
 
        $(SRCDIR)/math/Matrix4.cpp \
253
 
        $(SRCDIR)/texture/CachedTexture.cpp \
254
 
        $(SRCDIR)/texture/TextureCache.cpp \
255
 
        $(SRCDIR)/texture/ImageFormatSelector.cpp \
256
 
        $(SRCDIR)/hash/CRCCalculator.cpp \
257
 
        $(SRCDIR)/hash/CRCCalculator2.cpp \
258
 
        $(SRCDIR)/texture/TextureLoader.cpp \
259
 
        $(SRCDIR)/DisplayListParser.cpp \
260
 
        $(SRCDIR)/VI.cpp \
261
 
        $(SRCDIR)/ucodes/UCodeSelector.cpp \
262
 
        $(SRCDIR)/ucodes/UCode0.cpp \
263
 
        $(SRCDIR)/ucodes/UCode1.cpp \
264
 
        $(SRCDIR)/ucodes/UCode2.cpp \
265
 
        $(SRCDIR)/ucodes/UCode3.cpp \
266
 
        $(SRCDIR)/ucodes/UCode4.cpp \
267
 
        $(SRCDIR)/ucodes/UCode5.cpp \
268
 
        $(SRCDIR)/ucodes/UCode6.cpp \
269
 
        $(SRCDIR)/ucodes/UCode7.cpp \
270
 
        $(SRCDIR)/ucodes/UCode8.cpp \
271
 
        $(SRCDIR)/ucodes/UCode9.cpp \
272
 
        $(SRCDIR)/ucodes/UCode10.cpp \
273
 
        $(SRCDIR)/GBI/GBI.cpp \
274
 
        $(SRCDIR)/RSP/RSP.cpp \
275
 
        $(SRCDIR)/RSP/RSPMatrixManager.cpp \
276
 
        $(SRCDIR)/RSP/RSPVertexManager.cpp \
277
 
        $(SRCDIR)/RSP/RSPLightManager.cpp \
278
 
        $(SRCDIR)/Combiner/AdvancedCombinerManager.cpp \
279
 
        $(SRCDIR)/Combiner/CombinerBase.cpp \
280
 
        $(SRCDIR)/Combiner/AdvancedTexEnvCombiner.cpp \
281
 
        $(SRCDIR)/Combiner/SimpleTexEnvCombiner.cpp \
282
 
        $(SRCDIR)/Combiner/DummyCombiner.cpp \
283
 
        $(SRCDIR)/Combiner/CombinerStageMerger.cpp \
284
 
        $(SRCDIR)/Combiner/CombinerStageCreator.cpp \
285
 
        $(SRCDIR)/Combiner/CombinerCache.cpp \
286
 
        $(SRCDIR)/RomDetector.cpp \
287
 
        $(SRCDIR)/RDP/RDP.cpp \
288
 
        $(SRCDIR)/RDP/RDPInstructions.cpp \
289
 
        $(SRCDIR)/osal_dynamiclib_unix.cpp
290
 
 
291
 
 
292
 
# generate a list of object files build, make a temporary directory for them
293
 
OBJECTS := $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(filter %.cpp, $(SOURCE)))
294
 
OBJDIRS = $(dir $(OBJECTS))
295
 
$(shell $(MKDIR) $(OBJDIRS))
296
 
 
297
 
# build targets
298
 
 
299
 
TARGET = mupen64plus-video-arachnoid.$(SO_EXTENSION)
300
 
targets:
301
 
        @echo "Mupen64plus-video-arachnoid N64 Graphics plugin makefile. "
302
 
        @echo "  Targets:"
303
 
        @echo "    all           == Build Mupen64plus-video-arachnoid plugin"
304
 
        @echo "    clean         == remove object files"
305
 
        @echo "    rebuild       == clean and re-build all"
306
 
        @echo "    install       == Install Mupen64Plus-video-arachnoid plugin"
307
 
        @echo "    uninstall     == Uninstall Mupen64Plus-video-arachnoid plugin"
308
 
        @echo "  Options:"
309
 
        @echo "    BITS=32       == build 32-bit binaries on 64-bit machine"
310
 
        @echo "    APIDIR=path   == path to find Mupen64Plus Core headers"
311
 
        @echo "    OPTFLAGS=flag == compiler optimization (default: -O3)"
312
 
        @echo "    PIC=(1|0)     == Force enable/disable of position independent code"
313
 
        @echo "  Install Options:"
314
 
        @echo "    PREFIX=path   == install/uninstall prefix (default: /usr/local)"
315
 
        @echo "    LIBDIR=path   == library prefix (default: PREFIX/lib)"
316
 
        @echo "    PLUGINDIR=path == path to install plugin libraries (default: LIBDIR/mupen64plus)"
317
 
        @echo "    DESTDIR=path  == path to prepend to all installation paths (only for packagers)"
318
 
        @echo "  Debugging Options:"
319
 
        @echo "    DEBUG=1       == add debugging symbols"
320
 
        @echo "    V=1           == show verbose compiler output"
321
 
 
322
 
all: $(TARGET)
323
 
 
324
 
install: $(TARGET)
325
 
        $(INSTALL) -d "$(DESTDIR)$(PLUGINDIR)"
326
 
        $(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(PLUGINDIR)"
327
 
 
328
 
uninstall:
329
 
        $(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)"
330
 
 
331
 
 
332
 
clean:
333
 
        $(RM) -r ./_obj mupen64plus-video-arachnoid.$(SO_EXTENSION)
334
 
 
335
 
# build dependency files
336
 
CFLAGS += -MD
337
 
-include $(OBJECTS:.o=.d)
338
 
 
339
 
CXXFLAGS += $(CFLAGS)
340
 
 
341
 
# standard build rules
342
 
$(OBJDIR)/%.o: $(SRCDIR)/%.c
343
 
        $(COMPILE.c) -o $@ $<
344
 
 
345
 
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
346
 
        $(COMPILE.cc) -o $@ $<
347
 
 
348
 
$(TARGET): $(OBJECTS)
349
 
        $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
350
 
 
351
 
.PHONY: all clean install uninstall targets