Previous 15994 Revisions Next

r7078 Wednesday 20th January, 2010 at 14:08:26 UTC by R. Belmont
Removing now unnecessary file.
[ROOT]makefile.sdl

makefile.sdl
r7077r7078
1###########################################################################
2#
3#   makefile
4#
5#   Core makefile for building MAME and derivatives
6#
7#   Copyright (c) Nicola Salmoria and the MAME Team.
8#   Visit http://mamedev.org for licensing and usage restrictions.
9#
10###########################################################################
11
12
13
14###########################################################################
15#################   BEGIN USER-CONFIGURABLE OPTIONS   #####################
16###########################################################################
17
18
19#-------------------------------------------------
20# specify core target: mame, mess, etc.
21# specify subtarget: mame, mess, tiny, etc.
22# build rules will be included from
23# src/$(TARGET)/$(SUBTARGET).mak
24#-------------------------------------------------
25
26ifndef TARGET
27TARGET = mess
28endif
29
30ifndef SUBTARGET
31SUBTARGET = $(TARGET)
32endif
33
34
35
36#-------------------------------------------------
37# specify OSD layer: windows, sdl, etc.
38# build rules will be included from
39# src/osd/$(OSD)/$(OSD).mak
40#-------------------------------------------------
41
42ifndef OSD
43OSD = sdl
44endif
45
46ifndef CROSS_BUILD_OSD
47CROSS_BUILD_OSD = $(OSD)
48endif
49
50
51
52#-------------------------------------------------
53# specify OS target, which further differentiates
54# the underlying OS; supported values are:
55# win32, unix, macosx, os2
56#-------------------------------------------------
57
58ifndef TARGETOS
59ifeq ($(OSD),windows)
60TARGETOS = win32
61else
62TARGETOS = unix
63endif
64endif
65
66
67
68#-------------------------------------------------
69# configure name of final executable
70#-------------------------------------------------
71
72# uncomment and specify prefix to be added to the name
73# PREFIX =
74
75# uncomment and specify suffix to be added to the name
76# SUFFIX =
77
78
79
80#-------------------------------------------------
81# specify architecture-specific optimizations
82#-------------------------------------------------
83
84# uncomment and specify architecture-specific optimizations here
85# some examples:
86#   optimize for I686:   ARCHOPTS = -march=pentiumpro
87#   optimize for Core 2: ARCHOPTS = -march=pentium-m -msse3
88#   optimize for G4:     ARCHOPTS = -mcpu=G4
89# note that we leave this commented by default so that you can
90# configure this in your environment and never have to think about it
91# ARCHOPTS =
92
93
94
95#-------------------------------------------------
96# specify program options; see each option below
97# for details
98#-------------------------------------------------
99
100# uncomment next line to build a debug version
101# DEBUG = 1
102
103# uncomment next line to include the internal profiler
104# PROFILER = 1
105
106# uncomment the force the universal DRC to always use the C backend
107# you may need to do this if your target architecture does not have
108# a native backend
109# FORCE_DRC_C_BACKEND = 1
110
111# uncomment next line to build using unix-style libsdl on Mac OS X
112# (vs. the native framework port).  Normal users should not enable this.
113# MACOSX_USE_LIBSDL = 1
114
115
116#-------------------------------------------------
117# specify build options; see each option below
118# for details
119#-------------------------------------------------
120
121# uncomment next line if you are building for a 64-bit target
122# PTR64 = 1
123
124# uncomment next line if you are building for a big-endian target
125# BIGENDIAN = 1
126
127# uncomment next line to build expat as part of MAME build
128BUILD_EXPAT = 1
129
130# uncomment next line to build zlib as part of MAME build
131BUILD_ZLIB = 1
132
133# uncomment next line to include the symbols
134# SYMBOLS = 1
135
136# uncomment next line to include profiling information from the compiler
137# PROFILE = 1
138
139# uncomment next line to generate a link map for exception handling in windows
140# MAP = 1
141
142# uncomment next line to generate verbose build information
143# VERBOSE = 1
144
145# specify optimization level or leave commented to use the default
146# (default is OPTIMIZE = 3 normally, or OPTIMIZE = 0 with symbols)
147# OPTIMIZE = 3
148
149# experimental: uncomment to compile everything as C++ for stricter type checking
150# CPP_COMPILE = 1
151
152
153###########################################################################
154##################   END USER-CONFIGURABLE OPTIONS   ######################
155###########################################################################
156
157
158#-------------------------------------------------
159# sanity check the configuration
160#-------------------------------------------------
161
162# specify a default optimization level if none explicitly stated
163ifndef OPTIMIZE
164ifndef SYMBOLS
165OPTIMIZE = 3
166else
167OPTIMIZE = 0
168endif
169endif
170
171# profiler defaults to on for DEBUG builds
172ifdef DEBUG
173ifndef PROFILER
174PROFILER = 1
175endif
176endif
177
178
179
180#-------------------------------------------------
181# platform-specific definitions
182#-------------------------------------------------
183
184# extension for executables
185EXE =
186
187ifeq ($(TARGETOS),win32)
188EXE = .exe
189endif
190ifeq ($(TARGETOS),os2)
191EXE = .exe
192endif
193
194ifndef BUILD_EXE
195BUILD_EXE = $(EXE)
196endif
197
198# compiler, linker and utilities
199AR = @ar
200CC = @gcc
201LD = @gcc
202MD = -mkdir$(EXE)
203RM = @rm -f
204
205
206
207#-------------------------------------------------
208# form the name of the executable
209#-------------------------------------------------
210
211# debug builds just get the 'd' suffix and nothing more
212ifdef DEBUG
213DEBUGSUFFIX = d
214endif
215
216# cpp builds get a 'pp' suffix
217ifdef CPP_COMPILE
218CPPSUFFIX = pp
219endif
220
221# the name is just 'target' if no subtarget; otherwise it is
222# the concatenation of the two (e.g., mametiny)
223ifeq ($(TARGET),$(SUBTARGET))
224NAME = $(TARGET)
225else
226NAME = $(TARGET)$(SUBTARGET)
227endif
228
229# fullname is prefix+name+suffix+debugsuffix
230FULLNAME = $(PREFIX)$(NAME)$(CPPSUFFIX)$(SUFFIX)$(DEBUGSUFFIX)
231
232# add an EXE suffix to get the final emulator name
233EMULATOR = $(FULLNAME)$(EXE)
234
235
236
237#-------------------------------------------------
238# source and object locations
239#-------------------------------------------------
240
241# all sources are under the src/ directory
242SRC = src
243
244# build the targets in different object dirs, so they can co-exist
245OBJ = obj/$(OSD)/$(FULLNAME)
246
247
248
249#-------------------------------------------------
250# compile-time definitions
251#-------------------------------------------------
252
253# CR/LF setup: use both on win32/os2, CR only on everything else
254DEFS = -DCRLF=2
255
256ifeq ($(TARGETOS),win32)
257DEFS = -DCRLF=3
258endif
259ifeq ($(TARGETOS),os2)
260DEFS = -DCRLF=3
261endif
262
263# map the INLINE to something digestible by GCC
264DEFS += -DINLINE="static __inline__"
265
266# define LSB_FIRST if we are a little-endian target
267ifndef BIGENDIAN
268DEFS += -DLSB_FIRST
269endif
270
271# define PTR64 if we are a 64-bit target
272ifdef PTR64
273DEFS += -DPTR64
274endif
275
276# define MAME_DEBUG if we are a debugging build
277ifdef DEBUG
278DEFS += -DMAME_DEBUG
279else
280DEFS += -DNDEBUG
281endif
282
283# define MAME_PROFILER if we are a profiling build
284ifdef PROFILER
285DEFS += -DMAME_PROFILER
286endif
287
288
289
290#-------------------------------------------------
291# compile flags
292# CCOMFLAGS are common flags
293# CONLYFLAGS are flags only used when compiling for C
294# CPPONLYFLAGS are flags only used when compiling for C++
295#-------------------------------------------------
296
297# start with empties for everything
298CCOMFLAGS =
299CONLYFLAGS =
300CPPONLYFLAGS =
301
302# CFLAGS is defined based on C or C++ targets
303# (remember, expansion only happens when used, so doing it here is ok)
304ifdef CPP_COMPILE
305CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
306else
307CFLAGS = $(CCOMFLAGS) $(CONLYFLAGS)
308endif
309
310# we compile C-only to C89 standard with GNU extensions
311# we compile C++ code to C++98 standard with GNU extensions
312CONLYFLAGS += -std=gnu89
313CPPONLYFLAGS += -x c++ -std=gnu++98
314
315# this speeds it up a bit by piping between the preprocessor/compiler/assembler
316CCOMFLAGS += -pipe
317
318# add -g if we need symbols, and ensure we have frame pointers
319ifdef SYMBOLS
320CCOMFLAGS += -g -fno-omit-frame-pointer
321endif
322
323# add -v if we need verbose build information
324ifdef VERBOSE
325CCOMFLAGS += -v
326endif
327
328# add profiling information for the compiler
329ifdef PROFILE
330CCOMFLAGS += -pg
331endif
332
333# add the optimization flag
334CCOMFLAGS += -O$(OPTIMIZE)
335
336# if we are optimizing, include optimization options
337# and make all errors into warnings
338ifneq ($(OPTIMIZE),0)
339ifneq ($(TARGETOS),os2)
340ifndef IA64
341CCOMFLAGS += -Werror -fno-strict-aliasing $(ARCHOPTS)
342else
343endif
344else
345CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
346endif
347endif
348
349# add a basic set of warnings
350CCOMFLAGS += \
351   -Wall \
352   -Wcast-align \
353   -Wundef \
354   -Wformat-security \
355   -Wwrite-strings \
356   -Wno-sign-compare
357
358# warnings only applicable to C compiles
359CONLYFLAGS += \
360   -Wpointer-arith \
361   -Wbad-function-cast \
362   -Wstrict-prototypes
363
364# this warning is not supported on the os2 compilers
365ifneq ($(TARGETOS),os2)
366CONLYFLAGS += -Wdeclaration-after-statement
367endif
368
369
370#-------------------------------------------------
371# include paths
372#-------------------------------------------------
373
374# add core include paths
375CCOMFLAGS += \
376   -I$(SRC)/$(TARGET) \
377   -I$(SRC)/$(TARGET)/includes \
378   -I$(OBJ)/$(TARGET)/layout \
379   -I$(SRC)/emu \
380   -I$(OBJ)/emu \
381   -I$(OBJ)/emu/layout \
382   -I$(SRC)/lib/util \
383   -I$(SRC)/osd \
384   -I$(SRC)/osd/$(OSD) \
385
386
387
388#-------------------------------------------------
389# linking flags
390#-------------------------------------------------
391
392# LDFLAGS are used generally; LDFLAGSEMULATOR are additional
393# flags only used when linking the core emulator
394LDFLAGS =
395ifneq ($(TARGETOS),macosx)
396ifneq ($(TARGETOS),os2)
397ifneq ($(TARGETOS),solaris)
398LDFLAGS = -Wl,--warn-common
399endif
400endif
401endif
402LDFLAGSEMULATOR =
403
404# add profiling information for the linker
405ifdef PROFILE
406LDFLAGS += -pg
407endif
408
409# strip symbols and other metadata in non-symbols and non profiling builds
410ifndef SYMBOLS
411ifndef PROFILE
412ifneq ($(TARGETOS),macosx)
413LDFLAGS += -s
414endif
415endif
416endif
417
418# output a map file (emulator only)
419ifdef MAP
420LDFLAGSEMULATOR += -Wl,-Map,$(FULLNAME).map
421endif
422
423
424
425#-------------------------------------------------
426# define the standard object directory; other
427# projects can add their object directories to
428# this variable
429#-------------------------------------------------
430
431OBJDIRS = $(OBJ)
432
433
434
435#-------------------------------------------------
436# define standard libarires for CPU and sounds
437#-------------------------------------------------
438
439LIBEMU = $(OBJ)/libemu.a
440LIBCPU = $(OBJ)/libcpu.a
441LIBDASM = $(OBJ)/libdasm.a
442LIBSOUND = $(OBJ)/libsound.a
443LIBUTIL = $(OBJ)/libutil.a
444LIBOCORE = $(OBJ)/libocore.a
445LIBOSD = $(OBJ)/libosd.a
446
447VERSIONOBJ = $(OBJ)/version.o
448
449
450
451#-------------------------------------------------
452# either build or link against the included
453# libraries
454#-------------------------------------------------
455
456# start with an empty set of libs
457LIBS =
458
459# add expat XML library
460ifdef BUILD_EXPAT
461CCOMFLAGS += -I$(SRC)/lib/expat
462EXPAT = $(OBJ)/libexpat.a
463else
464LIBS += -lexpat
465EXPAT =
466endif
467
468# add ZLIB compression library
469ifdef BUILD_ZLIB
470CCOMFLAGS += -I$(SRC)/lib/zlib
471ZLIB = $(OBJ)/libz.a
472else
473LIBS += -lz
474ZLIB =
475endif
476
477
478
479#-------------------------------------------------
480# 'all' target needs to go here, before the
481# include files which define additional targets
482#-------------------------------------------------
483
484all: maketree buildtools emulator tools
485
486
487
488
489#-------------------------------------------------
490# defines needed by multiple make files
491#-------------------------------------------------
492
493BUILDSRC = $(SRC)/build
494BUILDOBJ = $(OBJ)/build
495BUILDOUT = $(BUILDOBJ)
496
497
498#-------------------------------------------------
499# include the various .mak files
500#-------------------------------------------------
501
502# include OSD-specific rules first
503include $(SRC)/osd/$(OSD)/$(OSD).mak
504
505# then the various core pieces
506include $(SRC)/$(TARGET)/$(SUBTARGET).mak
507include $(SRC)/emu/emu.mak
508include $(SRC)/lib/lib.mak
509include $(SRC)/build/build.mak
510-include $(SRC)/osd/$(CROSS_BUILD_OSD)/build.mak
511include $(SRC)/tools/tools.mak
512
513# combine the various definitions to one
514CDEFS = $(DEFS) $(COREDEFS) $(SOUNDDEFS)
515
516
517
518#-------------------------------------------------
519# primary targets
520#-------------------------------------------------
521
522emulator: maketree $(BUILD) $(EMULATOR)
523
524buildtools: maketree $(BUILD)
525
526tools: maketree $(TOOLS)
527
528maketree: $(sort $(OBJDIRS))
529
530clean:
531   @echo Deleting object tree $(OBJ)...
532   $(RM) -r $(OBJ)
533   @echo Deleting $(EMULATOR)...
534   $(RM) $(EMULATOR)
535   @echo Deleting $(TOOLS)...
536   $(RM) $(TOOLS)
537ifdef MAP
538   @echo Deleting $(FULLNAME).map...
539   $(RM) $(FULLNAME).map
540endif
541
542
543
544#-------------------------------------------------
545# directory targets
546#-------------------------------------------------
547
548$(sort $(OBJDIRS)):
549   $(MD) -p $@
550
551
552
553#-------------------------------------------------
554# executable targets and dependencies
555#-------------------------------------------------
556
557ifndef EXECUTABLE_DEFINED
558
559# always recompile the version string
560$(VERSIONOBJ): $(DRVLIBS) $(LIBOSD) $(LIBEMU) $(LIBCPU) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(LIBOCORE) $(RESFILE)
561
562$(EMULATOR): $(VERSIONOBJ) $(DRVLIBS) $(LIBOSD) $(LIBEMU) $(LIBCPU) $(LIBDASM) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(LIBOCORE) $(RESFILE)
563   @echo Linking $@...
564   $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $^ $(LIBS) -o $@
565
566endif
567
568#-------------------------------------------------
569# generic rules
570#-------------------------------------------------
571
572$(OBJ)/%.o: $(SRC)/%.c | $(OSPREBUILD)
573   @echo Compiling $<...
574   $(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
575
576$(OBJ)/%.pp: $(SRC)/%.c | $(OSPREBUILD)
577   @echo Compiling $<...
578   $(CC) $(CDEFS) $(CFLAGS) -E $< -o $@
579
580$(OBJ)/%.s: $(SRC)/%.c | $(OSPREBUILD)
581   @echo Compiling $<...
582   $(CC) $(CDEFS) $(CFLAGS) -S $< -o $@
583
584$(OBJ)/%.lh: $(SRC)/%.lay $(FILE2STR)
585   @echo Converting $<...
586   @$(FILE2STR) $< $@ layout_$(basename $(notdir $<))
587
588$(OBJ)/%.fh: $(SRC)/%.png $(PNG2BDC) $(FILE2STR)
589   @echo Converting $<...
590   @$(PNG2BDC) $< $(OBJ)/temp.bdc
591   @$(FILE2STR) $(OBJ)/temp.bdc $@ font_$(basename $(notdir $<)) UINT8
592
593$(OBJ)/%.a:
594   @echo Archiving $@...
595   $(RM) $@
596   $(AR) -cr $@ $^
597
598ifeq ($(TARGETOS),macosx)
599$(OBJ)/%.o: $(SRC)/%.m | $(OSPREBUILD)
600   @echo Objective-C compiling $<...
601   $(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
602endif

Previous 15994 Revisions Next


© 1998-2018 The MESS Team