1#
2# OpenBOR - http://www.ChronoCrash.com
3# ---------------------------------------------------------------------------------------------------
4# All rights reserved, see LICENSE in OpenBOR root for details.
5#
6# Copyright (c) 2004 - 2014 OpenBOR Team
7#
8
9#----------------------------------------------------------------------------------------------------
10#
11#               	OpenBOR Makefile for ALL TARGET_PLATFORMs
12#
13#             PSP, PS3, Wii, Dreamcast, GP2X, WIZ, Pandora, OpenDingux, Windows, Darwin & Linux
14#
15#----------------------------------------------------------------------------------------------------
16
17ifndef VERSION_NAME
18VERSION_NAME = OpenBOR
19endif
20
21#----------------------------------------------------------------------------------------------------
22# Defines
23#----------------------------------------------------------------------------------------------------
24
25
26ifdef BUILD_PSP
27TARGET          = $(VERSION_NAME)
28TARGET_FINAL    = EBOOT.PBP
29TARGET_PLATFORM = PSP
30PBPNAME_STR     = $(TARGET)
31BUILD_TREMOR    = 1
32BUILDING        = 1
33ifeq ($(BUILD_PSP), 0)
34BUILD_DEBUG     = 1
35endif
36endif
37
38
39ifdef BUILD_WIN
40TARGET          = $(VERSION_NAME).elf
41TARGET_FINAL    = $(VERSION_NAME).exe
42TARGET_PLATFORM = WIN
43TARGET_ARCH     = x86
44TARGET_RESOURCE = resources/$(VERSION_NAME).res
45OBJTYPE         = win32
46BUILD_SDL       = 1
47BUILD_GFX       = 1
48BUILD_STATIC    = 1
49BUILD_SDL_IO    = 1
50BUILD_OPENGL    = 1
51BUILD_LOADGL    = 1
52BUILD_VORBIS    = 1
53BUILD_WEBM      = 1
54BUILDING        = 1
55YASM 	        = yasm$(EXTENSION)
56CC              = $(WINDEV)/$(PREFIX)gcc$(EXTENSION)
57INCLUDES        = $(SDKPATH)/include \
58                  $(SDKPATH)/include/SDL2
59LIBRARIES       = $(SDKPATH)/lib
60ARCHFLAGS       = -m32
61ifeq ($(findstring 86, $(TARGET_ARCH)), 86)
62BUILD_MMX       = 1
63endif
64ifeq ($(BUILD_WIN), 0)
65BUILD_DEBUG     = 1
66endif
67endif
68
69
70ifdef BUILD_LINUX
71TARGET 	        = $(VERSION_NAME).elf
72TARGET_FINAL    = $(VERSION_NAME)
73TARGET_PLATFORM = LINUX
74BUILD_SDL       = 1
75BUILD_GFX       = 1
76BUILD_PTHREAD   = 1
77BUILD_SDL_IO    = 1
78BUILD_OPENGL    = 1
79BUILD_LOADGL    = 1
80BUILD_VORBIS    = 1
81BUILD_WEBM      = 1
82BUILDING        = 1
83YASM 	        = yasm
84CC  	        = $(LNXDEV)/$(PREFIX)gcc
85OBJTYPE         = elf
86INCLUDES        = $(SDKPATH)/include
87ifeq ($(findstring 64, $(GCC_TARGET)), 64)
88TARGET_ARCH     = amd64
89BUILD_AMD64     = 1
90ARCHFLAGS       = -m64
91LIBRARIES       = $(SDKPATH)/lib/$(GCC_TARGET)
92CFLAGS          += -DAMD64
93else
94TARGET_ARCH     = x86
95ARCHFLAGS       = -m32
96LIBRARIES       = $(SDKPATH)/lib32
97BUILD_MMX       = 1
98endif
99ifeq ($(BUILD_LINUX), 0)
100BUILD_DEBUG     = 1
101endif
102endif
103
104ifdef BUILD_DARWIN
105TARGET          = $(VERSION_NAME).elf
106TARGET_FINAL    = $(VERSION_NAME)
107TARGET_PLATFORM = DARWIN
108BUILD_SDL       = 1
109BUILD_GFX       = 1
110BUILD_LINUX     = 1
111BUILD_PTHREAD   = 1
112BUILD_SDL_IO    = 1
113BUILD_OPENGL    = 1
114BUILD_LOADGL    = 1
115BUILD_VORBIS    = 1
116BUILDING        = 1
117YASM            = yasm
118CC              = $(PREFIX)gcc
119OBJTYPE         = macho
120INCLUDES        = $(DWNDEV)/include \
121                  $(DWNDEV)/include/SDL \
122                  $(SDKPATH)/usr/include/malloc
123LIBRARIES       = $(DWNDEV)/lib
124ifeq ($(findstring darwin10, $(PREFIX)), darwin10)
125ARCHFLAGS       = -arch i386 -arch x86_64
126else
127BUILD_MMX       = 1
128TARGET_ARCH     = x86
129ARCHFLAGS       = -arch i386
130endif
131ifeq ($(BUILD_DARWIN), 0)
132BUILD_DEBUG     = 1
133endif
134endif
135
136ifdef BUILD_PANDORA
137TARGET 	        = $(VERSION_NAME).elf
138TARGET_FINAL    = $(VERSION_NAME)
139TARGET_PLATFORM = PANDORA
140BUILD_LINUX     = 1
141BUILD_SDL       = 1
142BUILD_GFX       = 1
143BUILD_PTHREAD   = 1
144BUILD_SDL_IO    = 1
145BUILD_TREMOR    = 1
146BUILDING        = 1
147CC  	        = $(PNDDEV)/bin/arm-none-linux-gnueabi-gcc
148INCLUDES        = $(PNDDEV)/include \
149                  $(PNDDEV)/include/SDL
150OBJTYPE         = elf
151LIBRARIES       = $(PNDDEV)/lib
152ifeq ($(BUILD_PANDORA), 0)
153BUILD_DEBUG     = 1
154endif
155endif
156
157ifdef BUILD_GP2X
158TARGET 	        = $(VERSION_NAME).elf
159TARGET_FINAL    = $(VERSION_NAME).gpe
160TARGET_PLATFORM = GP2X
161BUILD_SDL       = 1
162BUILD_GFX       = 1
163BUILD_STATIC    = 1
164BUILD_PTHREAD   = 1
165BUILD_SDL_IO    = 1
166BUILD_TREMOR    = 1
167BUILDING        = 1
168CC              = $(GP2XDEV)/arm-open2x-linux-gcc
169UNAME          := $(shell uname)
170INCLUDES        = $(SDKPATH)/include \
171                  $(SDKPATH)/include/SDL
172LIBRARIES       = $(SDKPATH)/lib
173ifeq ($(BUILD_GP2X), 0)
174BUILD_DEBUG     = 1
175endif
176endif
177
178ifdef BUILD_WIZ
179TARGET 	        = $(VERSION_NAME).elf
180TARGET_FINAL    = $(VERSION_NAME).gpe
181TARGET_PLATFORM = WIZ
182BUILD_SDL       = 1
183BUILD_GFX       = 1
184BUILD_PTHREAD   = 1
185BUILD_SDL_IO    = 1
186BUILD_TREMOR    = 1
187BUILDING        = 1
188CC              = $(WIZDEV)/$(PREFIX)gcc$(EXTENSION)
189UNAME          := $(shell uname)
190INCLUDES        = $(SDKPATH)/include \
191                  $(SDKPATH)/include/SDL
192LIBRARIES       = $(SDKPATH)/lib
193ifeq ($(findstring wiz-sdk, $(SDKPATH)), wiz-sdk)
194INCLUDES       += $(SDKPATH)/../include
195LIBRARIES      += $(SDKPATH)/../lib/target \
196                  $(SDKPATH)/lib/target
197endif
198ifeq ($(BUILD_WIZ), 0)
199BUILD_DEBUG     = 1
200endif
201endif
202
203ifdef BUILD_OPENDINGUX
204TARGET 	        = $(VERSION_NAME).elf
205TARGET_FINAL    = $(VERSION_NAME).dge
206TARGET_PLATFORM = OPENDINGUX
207BUILD_SDL       = 1
208BUILD_GFX       = 1
209BUILD_PTHREAD   = 1
210BUILD_SDL_IO    = 1
211BUILD_TREMOR    = 1
212BUILDING        = 1
213CC              = $(OPENDINGUX_TOOLCHAIN_PREFIX)/bin/mipsel-linux-gcc
214INCLUDES        = $(OPENDINGUX_TOOLCHAIN_PREFIX)/include \
215                  $(OPENDINGUX_TOOLCHAIN_PREFIX)/include/SDL
216LIBRARIES       = $(OPENDINGUX_TOOLCHAIN_PREFIX)/lib
217ifeq ($(BUILD_OPENDINGUX), 0)
218BUILD_DEBUG     = 1
219endif
220endif
221
222ifdef BUILD_DC
223TARGET 	        = $(VERSION_NAME).elf
224TARGET_FINAL    = 1ST_READ.BIN
225TARGET_PLATFORM = DC
226BUILDING        = 1
227INCLUDES        = $(KOS_BASE)/../kos-ports/include/SDL \
228                  $(KOS_BASE)/../kos-ports/include/SDL-1.2.9 \
229                  $(KOS_BASE)/../kos-ports/include/png \
230                  $(KOS_BASE)/../kos-ports/include/zlib \
231                  $(KOS_BASE)/../kos-ports/include/liboggvorbis \
232                  $(KOS_BASE)/../kos-ports/libtremor/xiph
233ifeq ($(BUILD_DC), 0)
234BUILD_DEBUG     = 1
235endif
236endif
237
238ifdef BUILD_WII
239TARGET 	        = $(VERSION_NAME).elf
240TARGET_MAP      = $(TARGET).map
241TARGET_FINAL    = boot.dol
242TARGET_PLATFORM = WII
243BUILD_TREMOR    = 1
244BUILD_WEBM      = 1
245BUILD_ELM       = 1
246BUILDING        = 1
247INCLUDES        = $(DEVKITPRO)/portlibs/ppc/include \
248                  $(DEVKITPRO)/libogc/include
249LIBRARIES       = $(DEVKITPRO)/portlibs/ppc/lib \
250                  $(DEVKITPRO)/libogc/lib/wii
251ifeq ($(BUILD_WII), 0)
252BUILD_DEBUG     = 1
253endif
254endif
255
256
257STRIP           = cp $(TARGET) $(TARGET_FINAL)
258ifndef BUILD_DEBUG
259ifndef NO_STRIP
260ifdef BUILD_WIN
261STRIP 	        = $(WINDEV)/$(PREFIX)strip$(EXTENSION) $(TARGET) -o $(TARGET_FINAL)
262endif
263ifdef BUILD_LINUX
264STRIP 	        = $(LNXDEV)/$(PREFIX)strip $(TARGET) -o $(TARGET_FINAL)
265endif
266ifdef BUILD_DARWIN
267STRIP           = $(PREFIX)strip $(TARGET) -o $(TARGET_FINAL)
268endif
269ifdef BUILD_PANDORA
270STRIP 	        = $(PNDDEV)/bin/arm-none-linux-gnueabi-strip $(TARGET) -o $(TARGET_FINAL)
271endif
272ifdef BUILD_GP2X
273STRIP 	        = $(GP2XDEV)/arm-open2x-linux-strip $(TARGET) -o $(TARGET_FINAL)
274endif
275ifdef BUILD_WIZ
276STRIP 	        = $(WIZDEV)/$(PREFIX)strip$(EXTENSION) $(TARGET) -o $(TARGET_FINAL)
277endif
278ifdef BUILD_OPENDINGUX
279STRIP           = $(OPENDINGUX_TOOLCHAIN_PREFIX)/bin/mipsel-linux-strip $(TARGET) -o $(TARGET_FINAL)
280endif
281ifdef BUILD_WII
282STRIP           = elf2dol $< $@
283endif
284endif
285endif
286
287
288#----------------------------------------------------------------------------------------------------
289# Directories
290#----------------------------------------------------------------------------------------------------
291
292ifdef BUILD_PSP
293INCS           += psp
294endif
295
296
297ifdef BUILD_DC
298INCS           += dc
299endif
300
301
302ifdef BUILD_WII
303INCS           += wii
304endif
305
306
307ifdef BUILD_SDL
308INCS           += sdl
309endif
310
311
312ifdef BUILD_LINUX
313INCS           += 'libpng-config --prefix'/include/libpng
314endif
315
316
317ifdef BUILD_GP2X
318INCS 	       += sdl/gp2x
319endif
320
321ifdef BUILD_WIZ
322INCS 	       += sdl/gp2x
323endif
324
325ifdef BUILD_OPENDINGUX
326INCS           += '$(OPENDINGUX_TOOLCHAIN_PREFIX)/bin/libpng-config --prefix'/include/libpng
327endif
328
329
330INCS 	       += .                                                                                 \
331                  source                                                                            \
332                  source/adpcmlib                                                                   \
333                  source/gamelib                                                                    \
334                  source/preprocessorlib                                                            \
335                  source/ramlib                                                                     \
336                  source/randlib                                                                    \
337                  source/scriptlib                                                                  \
338                  source/pnglib                                                                     \
339
340
341ifdef BUILD_GFX
342INCS 	       += source/gfxlib
343endif
344
345ifdef BUILD_WEBM
346INCS 	       += source/webmlib
347endif
348
349INCS += $(INCLUDES)
350
351#----------------------------------------------------------------------------------------------------
352# Objects
353#----------------------------------------------------------------------------------------------------
354
355ADPCM 	        = source/adpcmlib/adpcm.o
356
357ifdef BUILD_GFX
358GFX 	        = source/gfxlib/2xSaI.o                                                             \
359                  source/gfxlib/bilinear.o                                                          \
360                  source/gfxlib/dotmatrix.o                                                         \
361                  source/gfxlib/gfx.o                                                               \
362                  source/gfxlib/hq2x.o                                                              \
363                  source/gfxlib/scale2x.o                                                           \
364                  source/gfxlib/scanline.o                                                          \
365                  source/gfxlib/simple2x.o                                                          \
366                  source/gfxlib/tv2x.o
367endif
368
369ifdef BUILD_MMX
370GFX 	       += source/gfxlib/2xSaImmx.o                                                          \
371                  source/gfxlib/bilinearmmx.o                                                       \
372                  source/gfxlib/hq2x16mmx.o
373endif
374
375GAME	        = source/gamelib/draw.o                                                             \
376                  source/gamelib/draw16.o                                                           \
377                  source/gamelib/draw32.o                                                           \
378                  source/gamelib/font.o                                                             \
379                  source/gamelib/translation.o                                                             \
380                  source/gamelib/anigif.o                                                           \
381                  source/gamelib/bitmap.o 	                                                        \
382                  source/gamelib/screen.o                                                           \
383                  source/gamelib/screen16.o                                                         \
384                  source/gamelib/screen32.o                                                         \
385                  source/gamelib/loadimg.o                                                          \
386                  source/gamelib/palette.o                                                          \
387                  source/gamelib/packfile.o                                                         \
388                  source/gamelib/filecache.o                                                        \
389                  source/gamelib/pixelformat.o                                                      \
390                  source/gamelib/soundmix.o                                                         \
391                  source/gamelib/spriteq.o                                                          \
392                  source/gamelib/sprite.o                                                          \
393                  source/gamelib/spritex8p16.o                                                      \
394                  source/gamelib/spritex8p32.o                                                      \
395                  source/gamelib/commands.o                                                         \
396                  source/gamelib/models.o                                                           \
397                  source/gamelib/transform.o
398SCRIPT          = source/scriptlib/StackedSymbolTable.o                                             \
399                  source/scriptlib/ScriptVariant.o                                                  \
400                  source/scriptlib/SymbolTable.o                                                    \
401                  source/scriptlib/Instruction.o                                                    \
402                  source/scriptlib/Interpreter.o                                                    \
403                  source/scriptlib/ImportCache.o                                                    \
404                  source/scriptlib/ParserSet.o                                                      \
405                  source/scriptlib/Parser.o                                                         \
406                  source/scriptlib/Lexer.o                                                          \
407                  source/scriptlib/Stack.o                                                          \
408                  source/scriptlib/List.o                                                           \
409                  source/preprocessorlib/pp_lexer.o                                                 \
410                  source/preprocessorlib/pp_parser.o                                                \
411                  source/preprocessorlib/pp_expr.o
412RAM             = source/ramlib/ram.o
413RAND	        = source/randlib/rand32.o
414PNG             = source/pnglib/pngdec.o                                                            \
415                  source/pnglib/savepng.o
416SOURCE	        = source/stringptr.o                                                                \
417				  source/utils.o                                                                    \
418                  source/stristr.o																	\
419                  source/omath.o
420
421
422
423ifdef BUILD_PSP
424GAME_CONSOLE    = psp/control/control.o                                                             \
425                  psp/dvemgr/dvemgr.o                                                               \
426                  psp/kernel/kernel.o                                                               \
427                  psp/graphics.o                                                                    \
428                  psp/audiodrv.o                                                                    \
429                  psp/sblaster.o                                                                    \
430                  psp/control.o                                                                     \
431                  psp/vertex.o                                                                      \
432                  psp/timer.o                                                                       \
433                  psp/video.o                                                                       \
434                  psp/image.o                                                                       \
435                  psp/menu.o                                                                        \
436                  psp/pspport.o
437endif
438
439
440ifdef BUILD_DC
441GAME_CONSOLE    = dc/dcport.o                                                                       \
442                  dc/bios.o                                                                         \
443                  dc/gdrom.o                                                                        \
444                  dc/timer.o                                                                        \
445                  dc/sblaster.o                                                                     \
446                  dc/control.o                                                                      \
447                  dc/video.o
448endif
449
450
451ifdef BUILD_WII
452GAME_CONSOLE    = wii/control.o                                                                     \
453                  wii/sblaster.o                                                                    \
454                  wii/timer.o                                                                       \
455                  wii/video.o                                                                       \
456                  wii/threads.o                                                                     \
457                  wii/menu.o                                                                        \
458                  wii/wiiport.o
459endif
460
461
462ifdef BUILD_SDL
463GAME	       += source/gamelib/filters.o
464endif
465
466
467
468ifdef BUILD_SDL_IO
469GAME_CONSOLE   += sdl/joysticks.o                                                                   \
470                  sdl/control.o                                                                     \
471                  sdl/sblaster.o                                                                    \
472                  sdl/timer.o                                                                       \
473                  sdl/sdlport.o                                                                     \
474                  sdl/video.o                                                                       \
475                  sdl/videocommon.o                                                                 \
476				  sdl/threads.o                                                                     \
477                  sdl/menu.o
478endif
479
480
481ifdef BUILD_OPENGL
482GAME_CONSOLE   += sdl/opengl.o
483endif
484
485
486ifdef BUILD_LOADGL
487GAME_CONSOLE   += sdl/loadgl.o
488endif
489
490
491ifdef BUILD_GP2X
492GAME_CONSOLE   += sdl/gp2x/gp2xport.o
493endif
494
495
496ifdef BUILD_WIZ
497GAME_CONSOLE   += sdl/gp2x/gp2xport.o
498endif
499
500
501ifdef BUILD_WEBM
502WEBM 	       += source/webmlib/vidplay.o                                                          \
503                  source/webmlib/vorbis.o                                                           \
504				  source/webmlib/samplecvt.o                                                        \
505                  source/webmlib/yuv.o                                                              \
506				  source/webmlib/halloc/halloc.o                                                    \
507				  source/webmlib/nestegg/nestegg.o
508endif
509
510
511MAIN            = openbor.o					                                                \
512                  openborscript.o
513
514OBJS            = $(MAIN)                                                                           \
515                  $(GAME_CONSOLE)                                                                   \
516                  $(ADPCM)                                                                          \
517                  $(GFX)                                                                            \
518                  $(GAME)                                                                           \
519                  $(SOURCE)                                                                         \
520                  $(SCRIPT)                                                                         \
521                  $(RAM)                                                                            \
522                  $(RAND)                                                                           \
523                  $(PNG)                                                                            \
524                  $(WEBM)
525
526
527#----------------------------------------------------------------------------------------------------
528# Compiler Flags
529#----------------------------------------------------------------------------------------------------
530
531CFLAGS 	       += $(addprefix -I", $(addsuffix ", $(INCS))) $(ARCHFLAGS) -D$(TARGET_PLATFORM)
532CFLAGS 	       += -Wall -fsigned-char
533
534
535ifndef BUILD_GP2X
536ifndef BUILD_DARWIN
537ifdef BUILD_LINUX
538CFLAGS         += `pkg-config sdl2 --cflags`
539endif
540endif
541endif
542
543ifndef BUILD_DEBUG
544ifdef BUILD_DC
545CFLAGS 	       +=
546else
547CFLAGS 	       +=
548endif
549CFLAGS 	       += -fno-ident
550ifndef BUILD_AMD64
551CFLAGS         +=
552endif
553else
554CFLAGS 	       += -DDEBUG
555ifdef NO_RAM_DEBUGGER
556CFLAGS         += -DNO_RAM_DEBUGGER
557endif
558endif
559
560
561ifdef BUILD_PSP
562CFLAGS         += -G0
563endif
564
565
566ifdef BUILD_SDL
567CFLAGS 	       += -DSDL=1
568endif
569
570
571ifdef BUILD_DARWIN
572CFLAGS 	       += -DLINUX -headerpad_max_install_names -isysroot $(SDKPATH)
573endif
574
575
576ifdef BUILD_PANDORA
577CFLAGS         += -DLINUX
578endif
579
580
581ifdef BUILD_WII
582CFLAGS 	       += -DCACHE_BACKGROUNDS -DREVERSE_COLOR -D__ppc__ $(MACHDEP) -Wl,-Map,$(TARGET_MAP)
583ifdef BUILD_ELM
584CFLAGS         += -DUSE_LIBELM
585endif
586endif
587
588
589ifdef BUILD_WIZ
590CFLAGS 	       += -DGP2X
591endif
592
593
594ifdef BUILD_OPENDINGUX
595CFLAGS 	       += -D_REENTRANT -DOPENDINGUX -ffunction-sections -ffast-math -fsingle-precision-constant -G0 -mbranch-likely
596endif
597
598
599ifdef BUILD_MMX
600CFLAGS 	       += -DMMX
601endif
602
603
604ifdef BUILD_VORBIS
605CFLAGS         += -DOV_EXCLUDE_STATIC_CALLBACKS
606endif
607
608
609ifdef BUILD_TREMOR
610CFLAGS         += -DTREMOR
611endif
612
613
614ifdef BUILD_OPENGL
615CFLAGS         += -DOPENGL
616endif
617
618
619ifdef BUILD_LOADGL
620CFLAGS         += -DLOADGL
621endif
622
623
624ifdef BUILD_GLES
625CFLAGS         += -DGLES
626endif
627
628
629ifdef BUILD_VERBOSE
630CFLAGS         += -DVERBOSE
631endif
632
633
634ifdef BUILD_WEBM
635CFLAGS 	       += -DWEBM
636endif
637
638
639CXXFLAGS        = $(CFLAGS) -fno-exceptions -fno-rtti
640ASFLAGS         = $(CFLAGS)
641
642#----------------------------------------------------------------------------------------------------
643# Library
644#----------------------------------------------------------------------------------------------------
645
646LIBS            = $(addprefix -L", $(addsuffix ", $(LIBRARIES)))
647
648
649ifdef BUILD_PSP
650LIBS 	       += -lpspgu -lpspaudio -lpsppower -lpsprtc
651endif
652
653
654ifdef BUILD_DARWIN
655LIBS           += -Wl,-syslibroot,$(SDKPATH) \
656                  -framework Cocoa \
657                  -framework OpenGL \
658                  -framework Carbon \
659                  -framework AudioUnit \
660                  -framework IOKit \
661                  -lSDLmain
662endif
663
664
665ifdef BUILD_SDL
666ifeq ($(findstring DGE, $(SDKPATH)), DGE)
667LIBS           += -lSDL -lSDL_gfx -lts
668else
669LIBS           += -lSDL2 -lSDL2_gfx
670endif
671endif
672
673
674ifdef BUILD_WIN
675LIBS           += -lpsapi -lopengl32 -lwinmm -lole32 -loleaut32 -limm32 -lversion -mwindows
676endif
677
678
679ifdef BUILD_PTHREAD
680LIBS           += -lpthread
681endif
682
683
684ifdef BUILD_WII
685ifdef BUILD_ELM
686LIBS           += -lelm -lwiiuse -lbte -lasnd -logc
687else
688LIBS           += -lwiiuse -lbte -lfat -lasnd -logc
689endif
690endif
691
692
693ifdef BUILD_STATIC
694LIBS           += -static
695endif
696
697
698ifdef BUILD_DC
699LIBS           += -lc -lgcc -lSDL_129 -ltremor
700endif
701
702
703ifdef BUILD_VORBIS
704LIBS           += -lvorbisfile -lvorbis -logg
705endif
706
707
708ifdef BUILD_TREMOR
709LIBS           += -lvorbisidec -logg
710endif
711
712
713ifdef BUILD_WEBM
714LIBS           += -lvpx
715endif
716
717
718LIBS           += -lpng -lz -lm
719
720#----------------------------------------------------------------------------------------------------
721# Rules to manage Files and Libraries for PSP
722#----------------------------------------------------------------------------------------------------
723
724ifdef BUILD_PSP
725%.o : %.c
726	@$(ECHO) Compiling $(TARGET_PLATFORM) Port: $<...
727	$(CC) $(CFLAGS) -c $< -o $@
728%.o : %.S
729	@$(ECHO) Compiling $(TARGET_PLATFORM) Port: $<...
730	$(CC) $(CFLAGS) -c $< -o $@
731INCDIR          = $(INCS)
732PSP_EBOOT_TITLE = $(VERSION_NAME) $(VERSION)
733PSP_EBOOT_ICON 	= resources/OpenBOR_Icon_144x80.png
734PSP_EBOOT_PIC1	= resources/OpenBOR_Logo_480x272.png
735PSP_FW_VERSION  = 371
736PSP_LARGE_MEMORY= 1
737BUILD_PRX       = 1
738include psp/build.mak
739endif
740
741
742#----------------------------------------------------------------------------------------------------
743# Rules to manage Files and Libraries for Dreamcast
744#----------------------------------------------------------------------------------------------------
745
746ifdef BUILD_DC
747all : $(TARGET) $(TARGET_FINAL)
748KOS_LOCAL_CFLAGS = -I$(KOS_BASE)/../kos-ports/include -ffast-math
749include $(KOS_BASE)/Makefile.rules
750%.o : %.c
751	@$(ECHO) Compiling $(TARGET_PLATFORM) Port: $<...
752	$(KOS_CC) $(KOS_CFLAGS) $(CFLAGS) -c $< -o $@
753%.o : %.s
754	@$(ECHO) Compiling $(TARGET_PLATFORM) Port: $<...
755	$(KOS_AS) $(KOS_AFLAGS) $< -o $@
756%.o : %.S
757	@$(ECHO) Compiling $(TARGET_PLATFORM) Port: $<...
758	$(KOS_AS) $(KOS_AFLAGS) $< -o $@
759$(TARGET) : $(OBJS)
760	@$(ECHO)
761	@$(ECHO) Linking $(TARGET_PLATFORM) Port: $(TARGET)...
762	$(KOS_CC) $(KOS_CFLAGS) $(KOS_LOCAL_CFLAGS) $(KOS_LDFLAGS) -o $@ $(KOS_START) $^ $(LDFLAGS) $(LIBS) $(KOS_LIBS)
763$(TARGET_FINAL) : $(TARGET)
764	@$(ECHO) Creating $(TARGET_PLATFORM) Port: $(TARGET_FINAL)...
765	$(KOS_OBJCOPY) -R .stack -O binary $(TARGET) $(TARGET_FINAL)
766	@$(ECHO)
767	@$(ECHO) Completed $(TARGET_PLATFORM) Port!
768	@$(ECHO) $(TARGET_FINAL) is now ready!
769endif
770
771
772#----------------------------------------------------------------------------------------------------
773# Rules to manage Files and Libraries for SDL
774#----------------------------------------------------------------------------------------------------
775
776ifdef BUILD_SDL
777all : $(TARGET) $(TARGET_FINAL)
778	@$(ECHO)
779%.o : %.asm
780	@$(ECHO) Compiling $(TARGET_PLATFORM) Port: $<...
781	$(YASM) -D $(TARGET_PLATFORM) -f $(OBJTYPE) -m $(TARGET_ARCH) -o $@ $<
782%.o : %.c
783	@$(ECHO) Compiling $(TARGET_PLATFORM) Port: $<...
784	$(CC) $(CFLAGS) -c $< -o $@
785$(TARGET) : $(OBJS) $(RES)
786	@$(ECHO)
787	@$(ECHO) Linking $(TARGET_PLATFORM) Port: $(TARGET)...
788	$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(TARGET_RESOURCE) $(LDFLAGS) $(LIBS)
789$(TARGET_FINAL) : $(TARGET)
790	@$(ECHO) Stripping $(TARGET_PLATFORM) Port: $(TARGET_FINAL)...
791	$(STRIP)
792	@$(ECHO)
793	@$(ECHO) Completed $(TARGET_PLATFORM) Port!
794	@$(ECHO) $(TARGET_FINAL) is now ready!
795endif
796
797#----------------------------------------------------------------------------------------------------
798# Rules to manage Files and Libraries for Wii
799#----------------------------------------------------------------------------------------------------
800
801ifdef BUILD_WII
802SOURCES = $(INCS)
803include $(DEVKITPPC)/wii_rules
804all : $(TARGET) $(TARGET_FINAL)
805	@$(ECHO)
806%.o : %.c
807	@$(ECHO) Compiling $(TARGET_PLATFORM) Port: $<...
808	$(CC) $(CFLAGS) -c $< -o $@
809$(TARGET) : $(OBJS) $(RES)
810	@$(ECHO)
811	@$(ECHO) Linking $(TARGET_PLATFORM) Port: $(TARGET)...
812	$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(TARGET_RESOURCE) $(LDFLAGS) $(LIBS)
813$(TARGET_FINAL) : $(TARGET)
814	@$(ECHO) Stripping $(TARGET_PLATFORM) Port: $(TARGET_FINAL)...
815	$(STRIP)
816	@$(ECHO)
817	@$(ECHO) Completed $(TARGET_PLATFORM) Port!
818	@$(ECHO) $(TARGET_FINAL) is now ready!
819endif
820
821
822#----------------------------------------------------------------------------------------------------
823# Rules to CleanUp Files for All Platforms
824#----------------------------------------------------------------------------------------------------
825
826ifndef BUILDING
827all:
828	@$(ECHO)
829	@$(ECHO) Build A TARGET_PLATFORM:
830	@$(ECHO)
831	@$(ECHO) make BUILD_DC=1
832	@$(ECHO) make BUILD_PSP=1
833	@$(ECHO) make BUILD_PS2=1
834	@$(ECHO) make BUILD_WII=1
835	@$(ECHO) make BUILD_WIN=1
836	@$(ECHO) make BUILD_GP2X=1
837	@$(ECHO) make BUILD_WIZ=1
838	@$(ECHO) make BUILD_PANDORA=1
839	@$(ECHO) make BUILD_LINUX=1
840	@$(ECHO) make BUILD_OPENDINGUX=1
841	@$(ECHO)
842	@$(ECHO) Cleanup Intermediate Files:
843	@$(ECHO)
844	@$(ECHO) make clean
845	@$(ECHO)
846	@$(ECHO) Remove All Files:
847	@$(ECHO)
848	@$(ECHO) make clean-all
849	@$(ECHO)
850endif
851
852
853ifndef BUILD_PSP
854clean-all: clean-releases clean
855
856clean-releases:
857	rm -rf releases/*
858
859clean:
860	@$(ECHO)
861	@$(ECHO) "Removing All $(TARGET_PLATFORM) Files..."
862	rm -f $(TARGET) $(TARGET_FINAL) $(TARGET_MAP) PARAM.SFO linkmap $(OBJS)
863	@$(ECHO) Done!
864	@$(ECHO)
865endif
866
867version:
868	@$(ECHO) "-------------------------------------------------------"
869	@$(ECHO) "OpenBOR $(VERSION) - http://www.ChronoCrash.com"
870	@$(ECHO)
871	@$(ECHO) "All rights reserved."
872	@$(ECHO) "See LICENSE and README within OpenBOR root for details."
873	@$(ECHO)
874	@$(ECHO) "Copyright (c) 2004 - 2014 OpenBOR Team"
875	@$(ECHO) "-------------------------------------------------------"
876
877