Added czech translation by fri
[drnoksnes] / Makefile
index b4137b4..108d616 100644 (file)
--- a/Makefile
+++ b/Makefile
-
-APPNAME = DrPocketSnes
-
-COPT = -IC:/cygwin/opt/cegcc/arm-wince-cegcc/include -I .
-COPT += -mcpu=arm920 -mtune=arm920t -O3 -ffast-math -fexpensive-optimizations -finline -finline-functions -msoft-float -falign-functions=32 -falign-loops -falign-labels -falign-jumps -fomit-frame-pointer
-COPT += -D__GIZ__
-
-GCC = gcc
-STRIP = strip
-
-#
-# SNES stuff (c-based)
-# memset.o memcpy.o 
-OBJS = 2xsaiwin.o apu.o c4.o c4emu.o cheats.o cheats2.o clip.o cpu.o cpuexec.o data.o 
-OBJS += dma.o dsp1.o fxemu.o fxinst.o gfx.o globals.o loadzip.o memmap.o ppu.o  
-OBJS += sdd1.o sdd1emu.o snapshot.o soundux.o spc700.o srtc.o tile.o
-#
-# ASM CPU Core, ripped from Yoyo's OpenSnes9X
-#
-OBJS += os9x_asm_cpu.o os9x_65c816.o spc700a.o
-#
-# and some asm from LJP...
-#
-OBJS += m3d_func.o misc.o
-# 
-# Dave's minimal SDK
-#
-OBJS += giz_sdk.o menu.o input.o gp2x_menutile.o gp2x_highlightbar.o \
-                       gp2x_menu_header.o unzip.o zip.o ioapi.o giz_kgsdkasm.o
-
-#
-# and the glue code that sticks it all together :)
-#
-OBJS += main.o
-
-# Inopia's menu system, hacked for the GP2X under rlyeh's sdk
-PRELIBS = -LC:/cygwin/opt/cegcc/arm-wince-cegcc/lib -lz -lGizSdk $(LIBS) 
-
-all: $(APPNAME).exe
-clean: tidy $(APPNAME).exe
-
-.c.o:
-       $(GCC) $(COPT) -c $< -o $@
-
-.cpp.o:
-       $(GCC) $(COPT) -c $< -o $@
-
-# make seems to lowercase the extensions, so files with '.S' end up being passed to the compiler as '.s', which means thousands of errors.
-# this is a small workaround. 
-
-spc700a.o: spc700a.s
-       $(GCC) $(COPT) -c $< -o $@
-       
-os9x_65c816.o: os9x_65c816.s
-       $(GCC) $(COPT) -c $< -o $@
-
-osnes9xgp_asmfunc.o: osnes9xgp_asmfunc.s
-       $(GCC) $(COPT) -c $< -o $@
-
-m3d_func.o: m3d_func.S
-       $(GCC) $(COPT) -c $< -o $@
-
-spc_decode.o: spc_decode.s
-       $(GCC) $(COPT) -c $< -o $@
-
-misc.o: misc.s
-       $(GCC) $(COPT) -c $< -o $@
-
-memset.o: memset.s
-       $(GCC) $(COPT) -c $< -o $@
+#!/usr/bin/make
+
+CPPFLAGS := -I. $(shell sdl-config --cflags) $(shell pkg-config --cflags x11)
+LDLIBS := -lz $(shell sdl-config --libs) $(shell pkg-config --libs x11) -lpopt
+
+-include config.mk
+
+# Sane defaults
+CONF_GUI?=1
+ifeq ($(ARCH),armel)
+       CONF_BUILD_ASM_CPU?=1
+       CONF_BUILD_ASM_SPC700?=1
+       CONF_BUILD_ASM_SA1?=0   # Still not there
+       CONF_BUILD_MISC_ROUTINES?=misc_armel
+else ifeq ($(ARCH),i386)
+       CONF_BUILD_ASM_CPU?=0
+       CONF_BUILD_ASM_SPC700?=0
+       CONF_BUILD_ASM_SA1?=0
+       CONF_BUILD_MISC_ROUTINES?=misc_i386
+endif
+# Hardware pixel doubling (in N8x0)
+CONF_XSP?=0
+# Hildon Desktop compositing (in Fremantle)
+CONF_HD?=0
+# Link to libzeemote
+CONF_ZEEMOTE?=0
+
+# SNES stuff
+OBJS = apu.o c4.o c4emu.o cheats.o cheats2.o clip.o cpu.o cpuexec.o data.o
+OBJS += dma.o dsp1.o font.o fxemu.o fxinst.o gfx.o globals.o loadzip.o memmap.o 
+OBJS += ppu.o sa1.o sdd1.o sdd1emu.o snapshot.o soundux.o spc700.o srtc.o tile.o
+
+ifeq ($(CONF_BUILD_ASM_CPU), 1)
+       # ASM CPU Core from yoyofr's OpenSnes9X
+       OBJS += os9x_asm_cpu.o os9x_65c816.o
+       CPPFLAGS += -DCONF_BUILD_ASM_CPU=1
+else
+       OBJS += cpuops.o
+endif
+
+ifeq ($(CONF_BUILD_ASM_SPC700), 1)
+       OBJS += spc700a.o
+       CPPFLAGS += -DCONF_BUILD_ASM_SPC700=1
+endif
+
+ifeq ($(CONF_BUILD_ASM_SA1), 1)
+       crash
+else
+       OBJS += sa1cpu.o
+endif
+
+OBJS += $(CONF_BUILD_MISC_ROUTINES).o
+
+# from open-whatever sdk
+OBJS += unzip.o ioapi.o
+# my extensions to snes9x (speedhacks support)
+OBJS += hacks.o
+# the glue code that sticks it all together in a monstruous way
+OBJS += platform/path.o platform/config.o
+OBJS += platform/sdl.o platform/sdlv.o platform/sdla.o platform/sdli.o
+OBJS += platform/sdlvscalers.o
+
+ifeq ($(CONF_XSP), 1)
+       CPPFLAGS += -DCONF_XSP=1 $(shell pkg-config --cflags xsp)
+       LDLIBS += $(shell pkg-config --libs xsp)
+endif
+ifeq ($(CONF_HD), 1)
+       CPPFLAGS += -DCONF_HD=1
+       LDLIBS += -lSDL_haa
+       CONF_EXIT_BUTTON ?= 1
+endif
+ifeq ($(CONF_GUI), 1)
+       CPPFLAGS += -DCONF_GUI=1 $(shell pkg-config --cflags libosso gconf-2.0)
+       LDLIBS += $(shell pkg-config --libs libosso gconf-2.0)
+       OBJS += platform/osso.o
+endif
+ifeq ($(CONF_EXIT_BUTTON), 1)
+       CPPFLAGS += -DCONF_EXIT_BUTTON=1
+       LDLIBS += -lSDL_image
+       OBJS += platform/sdlvexit.o
+endif
+ifeq ($(CONF_ZEEMOTE), 1)
+       CPPFLAGS += -DCONF_ZEEMOTE=1
+       LDLIBS += -lzeemote -lzeemote-conf -lbluetooth
+       OBJS += platform/zeemote.o
+endif
+
+# automatic dependencies
+DEPS := $(OBJS:.o=.d)
+
+all: drnoksnes
+
+clean:
+       rm -f drnoksnes *.o *.d platform/*.o platform/*.d
+       rm -f build-stamp configure-stamp
+
+remake: clean deps all
+
+-include $(DEPS)
+
+drnoksnes: $(OBJS)
+       $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+install: drnoksnes
+       install drnoksnes $(DESTDIR)/usr/games
+
+deps: $(DEPS)
+%.d: %.cpp
+       @$(CXX) $(CPPFLAGS) -MM $^ -MF $@ -MT $@ -MT $*.o
+%.d: %.c
+       @$(CC) $(CPPFLAGS) -MM $^ -MF $@ -MT $@ -MT $*.o
+%.d: %.s
+       @touch $@
+
+# GUI
+gui:
+       $(MAKE) -C gui all
+
+gui_clean:
+       $(MAKE) -C gui clean
        
-memcpy.o: memcpy.s
-       $(GCC) $(COPT) -c $< -o $@
-
-dspMixer.o: dspMixer.s
-       $(GCC) $(COPT) -c $< -o $@
+gui_install:
+       $(MAKE) -C gui install DESTDIR="$(DESTDIR)"
        
-giz_kgsdkasm.o: giz_kgsdkasm.s
-       $(GCC) $(COPT) -c $< -o $@
+ifeq ($(CONF_GUI), 1)
+all: gui
+clean: gui_clean
+install: gui_install
+endif
 
-RenderASM/render8.o: RenderASM/render8.S
-       $(GCC) $(COPT) -c $< -o $@
+profclean: clean
+       find . -name '*.gcno' -delete
+       find . -name '*.gcda' -delete
 
-$(APPNAME)d.exe: $(OBJS)
-       $(GCC) $(COPT) $(OBJS) -static $(PRELIBS) -o $@ -lstdc++ -lm
+distclean: profclean clean
+       rm -f config.mk
 
-$(APPNAME).exe: $(APPNAME)d.exe
-       $(STRIP) $(APPNAME)d.exe -o $(APPNAME).exe
+.PHONY: all clean remake deps install gui gui_clean distclean
 
-tidy:
-       rm *.o
-       rm $(APPNAME)d.exe
-       rm $(APPNAME).exe