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