~ubuntu-branches/ubuntu/wily/mupen64plus-ui-console/wily

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Sven Eckelmann
  • Date: 2015-05-01 16:42:54 UTC
  • mfrom: (1.2.3) (4.1.9 experimental)
  • Revision ID: package-import@ubuntu.com-20150501164254-mrvd5n7om3hg1uc0
Tags: 2.5-1
* New Upstream Version
* Upload to unstable
* Install mupen64plus.desktop to associate application/x-n64-rom files with
  mupen64plus-ui-console
* Upgraded to policy 3.9.6, no changes required
* debian/copyright:
  - Update years in debian/copyright
  - Add new files to debian/copyright

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
 
# *   Mupen64plus - Makefile                                                *
3
 
# *   Mupen64Plus homepage: http://code.google.com/p/mupen64plus/           *
4
 
# *   Copyright (C) 2009 Richard42                                          *
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-ui-console
22
 
 
23
 
# detect operation system
24
 
UNAME ?= $(shell uname -s)
25
 
OS := NONE
26
 
ifeq ("$(UNAME)","Linux")
27
 
  OS = LINUX
28
 
endif
29
 
ifeq ("$(UNAME)","linux")
30
 
  OS = LINUX
31
 
endif
32
 
ifneq ("$(filter GNU hurd,$(UNAME))","")
33
 
  OS = LINUX
34
 
endif
35
 
ifeq ("$(UNAME)","Darwin")
36
 
  OS = OSX
37
 
endif
38
 
ifeq ("$(UNAME)","FreeBSD")
39
 
  OS = FREEBSD
40
 
endif
41
 
ifeq ("$(UNAME)","OpenBSD")
42
 
  OS = FREEBSD
43
 
  $(warning OS type "$(UNAME)" not officially supported.')
44
 
endif
45
 
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
46
 
  OS = LINUX
47
 
endif
48
 
ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
49
 
  OS = MINGW
50
 
endif
51
 
ifeq ("$(OS)","NONE")
52
 
  $(error OS type "$(UNAME)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
53
 
endif
54
 
 
55
 
# detect system architecture
56
 
HOST_CPU ?= $(shell uname -m)
57
 
NO_ASM ?= 1
58
 
CPU := NONE
59
 
ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","")
60
 
  CPU := X86
61
 
  ifeq ("$(BITS)", "32")
62
 
    ARCH_DETECTED := 64BITS_32
63
 
  else
64
 
    ARCH_DETECTED := 64BITS
65
 
  endif
66
 
endif
67
 
ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
68
 
  CPU := X86
69
 
  ARCH_DETECTED := 32BITS
70
 
endif
71
 
ifneq ("$(filter ppc macppc socppc powerpc,$(HOST_CPU))","")
72
 
  CPU := PPC
73
 
  ARCH_DETECTED := 32BITS
74
 
  BIG_ENDIAN := 1
75
 
  $(warning Architecture "$(HOST_CPU)" not officially supported.')
76
 
endif
77
 
ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
78
 
  CPU := PPC
79
 
  ARCH_DETECTED := 64BITS
80
 
  BIG_ENDIAN := 1
81
 
  $(warning Architecture "$(HOST_CPU)" not officially supported.')
82
 
endif
83
 
ifneq ("$(filter arm%,$(HOST_CPU))","")
84
 
  ifeq ("$(filter arm%b,$(HOST_CPU))","")
85
 
    CPU := ARM
86
 
    ARCH_DETECTED := 32BITS
87
 
    $(warning Architecture "$(HOST_CPU)" not officially supported.')
88
 
  endif
89
 
endif
90
 
ifeq ("$(CPU)","NONE")
91
 
  $(error CPU type "$(HOST_CPU)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
92
 
endif
93
 
 
94
 
# base CFLAGS, LDLIBS, and LDFLAGS
95
 
OPTFLAGS ?= -O3 -flto
96
 
WARNFLAGS ?= -Wall
97
 
 
98
 
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -I../../src
99
 
ifeq ($(OS), MINGW)
100
 
  CFLAGS += -lpthread
101
 
  LDLIBS += -lpthread
102
 
else
103
 
  CFLAGS += -pthread
104
 
  LDLIBS += -pthread
105
 
endif
106
 
 
107
 
ifeq ($(PIE), 1)
108
 
  CFLAGS += -fPIE
109
 
  LDFLAGS += -pie
110
 
else
111
 
  CFLAGS += -fno-PIE
112
 
endif
113
 
 
114
 
# set special flags per-system
115
 
ifeq ($(OS), LINUX)
116
 
  LDLIBS += -ldl
117
 
endif
118
 
ifeq ($(OS), OSX)
119
 
  # Select the proper SDK
120
 
  # Also, SDKs are stored in a different location since XCode 4.3
121
 
  OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .)
122
 
  OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .)
123
 
  OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .)
124
 
  OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`")
125
 
  ifeq ($(OSX_XCODEGE43), 11)
126
 
    OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
127
 
  else
128
 
    OSX_SYSROOT := /Developer/SDKs
129
 
  endif
130
 
 
131
 
  ifeq ($(CPU), X86)
132
 
    ifeq ($(ARCH_DETECTED), 64BITS)
133
 
      CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
134
 
    else
135
 
      CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
136
 
    endif
137
 
  endif
138
 
endif
139
 
 
140
 
# test for presence of SDL
141
 
ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
142
 
  SDL_CONFIG = $(CROSS_COMPILE)sdl-config
143
 
  ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
144
 
    $(error No SDL development libraries found!)
145
 
  endif
146
 
  SDL_CFLAGS  += $(shell $(SDL_CONFIG) --cflags)
147
 
  SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs)
148
 
endif
149
 
CFLAGS += $(SDL_CFLAGS)
150
 
LDLIBS += $(SDL_LDLIBS)
151
 
 
152
 
ifeq ($(OS), MINGW)
153
 
  LDLIBS += -mconsole
154
 
endif
155
 
 
156
 
ifeq ($(BIG_ENDIAN), 1)
157
 
  CFLAGS += -DM64P_BIG_ENDIAN
158
 
endif
159
 
 
160
 
# tweak flags for 32-bit build on 64-bit system
161
 
ifeq ($(ARCH_DETECTED), 64BITS_32)
162
 
  ifeq ($(OS), FREEBSD)
163
 
    $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
164
 
  endif
165
 
  CFLAGS += -m32
166
 
  LDFLAGS += -Wl,-m,elf_i386
167
 
endif
168
 
 
169
 
# set mupen64plus core API header path
170
 
ifneq ("$(APIDIR)","")
171
 
  CFLAGS += "-I$(APIDIR)"
172
 
else
173
 
  TRYDIR = ../../../mupen64plus-core/src/api
174
 
  ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
175
 
    CFLAGS += -I$(TRYDIR)
176
 
  else
177
 
    TRYDIR = /usr/local/include/mupen64plus
178
 
    ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
179
 
      CFLAGS += -I$(TRYDIR)
180
 
    else
181
 
      TRYDIR = /usr/include/mupen64plus
182
 
      ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
183
 
        CFLAGS += -I$(TRYDIR)
184
 
      else
185
 
        $(error Mupen64Plus API header files not found! Use makefile parameter APIDIR to force a location.)
186
 
      endif
187
 
    endif
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_LD  = @echo '    LD  '$@;
196
 
endif
197
 
endif
198
 
 
199
 
# set base program pointers and flags
200
 
CC        = $(CROSS_COMPILE)gcc
201
 
CXX       = $(CROSS_COMPILE)g++
202
 
RM       ?= rm -f
203
 
INSTALL  ?= install
204
 
MKDIR ?= mkdir -p
205
 
COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
206
 
LINK.o = $(Q_LD)$(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH)
207
 
 
208
 
# set special flags for given Makefile parameters
209
 
# note: COREDIR _must_ end in a slash if you want it to work; not necessary for the others
210
 
ifneq ($(PLUGINDIR),)
211
 
  CFLAGS += '-DPLUGINDIR="$(PLUGINDIR)"'
212
 
endif
213
 
ifneq ($(COREDIR),)
214
 
  CFLAGS += '-DCOREDIR="$(COREDIR)"'
215
 
endif
216
 
ifneq ($(SHAREDIR),)
217
 
  CFLAGS += '-DSHAREDIR="$(SHAREDIR)"'
218
 
endif
219
 
ifeq ($(DEBUG),1)
220
 
  CFLAGS += -g
221
 
  INSTALL_STRIP_FLAG ?= 
222
 
else
223
 
  INSTALL_STRIP_FLAG ?= -s
224
 
endif
225
 
 
226
 
# set installation options
227
 
ifeq ($(PREFIX),)
228
 
  PREFIX := /usr/local
229
 
endif
230
 
ifeq ($(BINDIR),)
231
 
  BINDIR := $(PREFIX)/bin
232
 
endif
233
 
ifeq ($(MANDIR),)
234
 
  MANDIR := $(PREFIX)/share/man
235
 
endif
236
 
 
237
 
SRCDIR = ../../src
238
 
OBJDIR = _obj$(POSTFIX)
239
 
 
240
 
ifeq ("$(OS)","MINGW")
241
 
  EXEEXT = .exe
242
 
else
243
 
  EXEEXT =
244
 
endif
245
 
 
246
 
# list of source files to compile
247
 
SOURCE = \
248
 
        $(SRCDIR)/cheat.c \
249
 
        $(SRCDIR)/compare_core.c \
250
 
        $(SRCDIR)/core_interface.c \
251
 
        $(SRCDIR)/main.c \
252
 
        $(SRCDIR)/plugin.c
253
 
 
254
 
ifeq ($(OS), MINGW)
255
 
SOURCE += \
256
 
        $(SRCDIR)/osal_dynamiclib_win32.c \
257
 
        $(SRCDIR)/osal_files_win32.c
258
 
else
259
 
SOURCE += \
260
 
        $(SRCDIR)/osal_dynamiclib_unix.c \
261
 
        $(SRCDIR)/osal_files_unix.c
262
 
endif
263
 
 
264
 
# generate a list of object files build, make a temporary directory for them
265
 
OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE)))
266
 
OBJDIRS = $(dir $(OBJECTS))
267
 
$(shell $(MKDIR) $(OBJDIRS))
268
 
 
269
 
# build targets
270
 
TARGET = mupen64plus$(POSTFIX)$(EXEEXT)
271
 
 
272
 
targets:
273
 
        @echo "Mupen64Plus-ui-console makefile."
274
 
        @echo "  Targets:"
275
 
        @echo "    all            == Build Mupen64Plus console front-end application"
276
 
        @echo "    clean          == remove object files and build products"
277
 
        @echo "    rebuild        == clean and re-build all"
278
 
        @echo "    install        == Install Mupen64Plus console front-end application"
279
 
        @echo "    uninstall      == Uninstall Mupen64Plus console front-end application"
280
 
        @echo "  Options:"
281
 
        @echo "    COREDIR=path   == default path to search for Mupen64Plus Core (must end with slash)"
282
 
        @echo "    PLUGINDIR=path == default path to search for plugins"
283
 
        @echo "    SHAREDIR=path  == default path to search for shared data files"
284
 
        @echo "    APIDIR=path    == path to find Mupen64Plus Core headers"
285
 
        @echo "    OPTFLAGS=flags == compiler optimization (default: -O3 -flto)"
286
 
        @echo "    WARNFLAGS=flag == compiler warning levels (default: -Wall)"
287
 
        @echo "    PIE=(1|0)      == Force enable/disable of position independent executables"
288
 
        @echo "    POSTFIX=name  == String added to the name of the the build (default: '')"
289
 
        @echo "  Install Options:"
290
 
        @echo "    PREFIX=path    == install/uninstall prefix (default: /usr/local/)"
291
 
        @echo "    BINDIR=path    == path to install mupen64plus binary (default: PREFIX/bin/)"
292
 
        @echo "    MANDIR=path    == path to install mupen64plus manual page (default: PREFIX/share/man)"
293
 
        @echo "    DESTDIR=path   == path to prepend to all installation paths (only for packagers)"
294
 
        @echo "  Debugging Options:"
295
 
        @echo "    DEBUG=1        == add debugging symbols to application binary"
296
 
        @echo "    V=1            == show verbose compiler output"
297
 
 
298
 
all: $(TARGET)
299
 
 
300
 
clean:
301
 
        $(RM) -r $(OBJDIR) $(TARGET)
302
 
 
303
 
rebuild: clean all
304
 
 
305
 
install: $(TARGET)
306
 
        $(INSTALL) -d "$(DESTDIR)$(BINDIR)"
307
 
        $(INSTALL) -m 0755 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(BINDIR)"
308
 
        $(INSTALL) -d "$(DESTDIR)$(MANDIR)/man6"
309
 
        $(INSTALL) -m 0644 ../../doc/mupen64plus.6 "$(DESTDIR)$(MANDIR)/man6"
310
 
 
311
 
uninstall:
312
 
        $(RM) "$(DESTDIR)$(BINDIR)/$(TARGET)" "$(DESTDIR)$(MANDIR)/man6/mupen64plus.6"
313
 
 
314
 
# build dependency files
315
 
CFLAGS += -MD
316
 
-include $(OBJECTS:.o=.d)
317
 
 
318
 
# standard build rules
319
 
$(OBJDIR)/%.o: $(SRCDIR)/%.c
320
 
        $(COMPILE.c) -o $@ $<
321
 
 
322
 
$(TARGET): $(OBJECTS)
323
 
        $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
324
 
 
325
 
.PHONY: all clean install uninstall targets