Merge pull request #243 from retro-wertz/unai_fixes
[pcsx_rearmed.git] / Makefile
index a472492..89eba31 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,10 +2,16 @@
 
 # default stuff goes here, so that config can override
 TARGET ?= pcsx
-CFLAGS += -Wall -ggdb -Iinclude -ffast-math
-ifndef DEBUG
+CFLAGS += -Wall -Iinclude -ffast-math
+ifeq ($(DEBUG), 1)
+CFLAGS += -O0 -ggdb
+else
+ifeq ($(platform), vita)
+CFLAGS += -O3 -DNDEBUG
+else
 CFLAGS += -O2 -DNDEBUG
 endif
+endif
 CXXFLAGS += $(CFLAGS)
 #DRC_DBG = 1
 #PCNT = 1
@@ -46,6 +52,22 @@ OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore
        libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \
        libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o
 OBJS += libpcsxcore/gte.o libpcsxcore/gte_nf.o libpcsxcore/gte_divider.o
+ifeq ($(WANT_ZLIB),1)
+OBJS += deps/zlib/adler32.o \
+        deps/zlib/compress.o \
+        deps/zlib/crc32.o \
+        deps/zlib/deflate.o \
+        deps/zlib/gzclose.o \
+        deps/zlib/gzlib.o \
+        deps/zlib/gzread.o \
+        deps/zlib/gzwrite.o \
+        deps/zlib/inffast.o \
+        deps/zlib/inflate.o \
+        deps/zlib/inftrees.o \
+        deps/zlib/trees.o \
+        deps/zlib/uncompr.o \
+        deps/zlib/zutil.o
+endif
 ifeq "$(ARCH)" "arm"
 OBJS += libpcsxcore/gte_arm.o
 endif
@@ -56,21 +78,23 @@ libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
 
 # dynarec
 ifeq "$(USE_DYNAREC)" "1"
-OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
-OBJS += libpcsxcore/new_dynarec/pcsxmem.o
+OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/arm/linkage_arm.o
+OBJS += libpcsxcore/new_dynarec/backends/psx/pcsxmem.o
 else
-libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -DDRC_DISABLE
+libpcsxcore/new_dynarec/backends/psx/emu_if.o: CFLAGS += -DDRC_DISABLE
+frontend/libretro.o: CFLAGS += -DDRC_DISABLE
 endif
-OBJS += libpcsxcore/new_dynarec/emu_if.o
-libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
-       libpcsxcore/new_dynarec/pcsxmem_inline.c
-libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
+OBJS += libpcsxcore/new_dynarec/backends/psx/emu_if.o
+libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/arm/assem_arm.c \
+       libpcsxcore/new_dynarec/backends/psx/pcsxmem_inline.c
 ifdef DRC_DBG
-libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
+libpcsxcore/new_dynarec/backends/psx/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
 CFLAGS += -DDRC_DBG
 endif
 ifeq "$(DRC_CACHE_BASE)" "1"
 libpcsxcore/new_dynarec/%.o: CFLAGS += -DBASE_ADDR_FIXED=1
+libpcsxcore/new_dynarec/backends/psx/%.o: CFLAGS += -DBASE_ADDR_FIXED=1
+libpcsxcore/new_dynarec/arm/%.o: CFLAGS += -DBASE_ADDR_FIXED=1
 endif
 
 # spu
@@ -82,6 +106,11 @@ plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
 ifeq "$(ARCH)" "arm"
 OBJS += plugins/dfsound/arm_utils.o
 endif
+ifeq "$(HAVE_C64_TOOLS)" "1"
+plugins/dfsound/spu.o: CFLAGS += -DC64X_DSP
+plugins/dfsound/spu.o: plugins/dfsound/spu_c64x.c
+frontend/menu.o: CFLAGS += -DC64X_DSP
+endif
 ifneq ($(findstring oss,$(SOUND_DRIVERS)),)
 plugins/dfsound/out.o: CFLAGS += -DHAVE_OSS
 OBJS += plugins/dfsound/oss.o
@@ -164,6 +193,7 @@ OBJS += frontend/libpicofe/linux/fbdev.o frontend/libpicofe/linux/xenv.o
 OBJS += frontend/libpicofe/linux/in_evdev.o
 OBJS += frontend/plat_pandora.o frontend/plat_omap.o
 frontend/main.o frontend/menu.o: CFLAGS += -include frontend/pandora/ui_feat.h
+frontend/libpicofe/linux/plat.o: CFLAGS += -DPANDORA
 USE_PLUGIN_LIB = 1
 USE_FRONTEND = 1
 endif
@@ -188,6 +218,11 @@ endif
 ifeq "$(PLATFORM)" "libretro"
 OBJS += frontend/libretro.o
 CFLAGS += -DFRONTEND_SUPPORTS_RGB565
+CFLAGS += -DHAVE_LIBRETRO
+
+ifeq ($(MMAP_WIN32),1)
+OBJS += libpcsxcore/memmap_win32.o
+endif
 endif
 
 ifeq "$(USE_PLUGIN_LIB)" "1"
@@ -236,11 +271,22 @@ frontend/revision.h: FORCE
 %.o: %.S
        $(CC_AS) $(CFLAGS) -c $^ -o $@
 
+%.o: %.cpp
+       $(CXX) $(CXXFLAGS) -c -o $@ $<
+
+%.o: %.c
+       $(CC) $(CFLAGS) -c -o $@ $<
 
 target_: $(TARGET)
 
 $(TARGET): $(OBJS)
+       @echo "** BUILDING $(TARGET) FOR PLATFORM $(PLATFORM) **"
+ifeq ($(STATIC_LINKING), 1)
+       $(AR) rcs $@ $(OBJS)
+else
        $(CC_LINK) -o $@ $^ $(LDFLAGS) $(LDLIBS) $(EXTRA_LDFLAGS)
+endif
+       @echo "** BUILD SUCCESSFUL! GG NO RE **"
 
 clean: $(PLAT_CLEAN) clean_plugins
        $(RM) $(TARGET) $(OBJS) $(TARGET).map frontend/revision.h
@@ -282,7 +328,7 @@ endif
 ifeq "$(PLATFORM)" "pandora"
 PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
 
-rel: pcsx $(PLUGINS) \
+rel: pcsx plugins/dfsound/pcsxr_spu_area3.out $(PLUGINS) \
                frontend/pandora/pcsx.sh frontend/pandora/pcsx.pxml.templ frontend/pandora/pcsx.png \
                frontend/pandora/picorestore frontend/pandora/skin readme.txt COPYING
        rm -rf out