added configure script
[drnoksnes] / Makefile
index b9f5d10..bf5d5a3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,34 +1,29 @@
 #!/usr/bin/make
 
-CPPFLAGS := -I. $(shell sdl-config --cflags) $(shell pkg-config --cflags x11 xsp) -I/usr/include/hgw
-LDLIBS := -lz $(shell sdl-config --libs) $(shell pkg-config --libs x11 xsp) -lpopt -lhgw
-
-# Default CFLAGS for building in N8x0
-ARCH ?= arm
-CFLAGS ?= -DMAEMO -DMAEMO_VERSION=4 -march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -O2 -g -Wall -static-libgcc
-ASFLAGS ?= -march=armv6j -mfpu=vfp -mfloat-abi=softfp -g
-CXXFLAGS ?= $(CFLAGS)
-
-GAME_VERSION ?= $(shell head -n 1 debian/changelog | sed 's/[^0-9.-]//g')-git
-export GAME_VERSION
-export DESTDIR
-
-# Configuration settings
-CONF_BUILD_ASM_CPU=0
-CONF_BUILD_ASM_SPC700=0
-
-ifeq ($(ARCH),arm)
-       CONF_BUILD_ASM_CPU=1
-       CONF_BUILD_ASM_SPC700=1
-       CONF_BUILD_ROUTINES=misc_armel
-else ifeq ($(ARCH),intel)
-       CONF_BUILD_ROUTINES=misc_i386
+CPPFLAGS := -I. $(shell sdl-config --cflags) $(shell pkg-config --cflags x11) -I/usr/include/hgw
+LDLIBS := -lz $(shell sdl-config --libs) $(shell pkg-config --libs x11) -lpopt -lhgw
+
+-include config.mk
+
+# Sane defaults
+ifeq ($(ARCH),armel)
+       CONF_BUILD_ASM_CPU?=1
+       CONF_BUILD_ASM_SPC700?=1
+       CONF_BUILD_ASM_SA1?=0   # Still not there
+       CONF_XSP?=1
+       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   # Still not there
+       CONF_XSP?=0
+       CONF_BUILD_MISC_ROUTINES?=misc_i386
 endif
 
 # SNES stuff
-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 netplay.o ppu.o
-OBJS += sdd1.o sdd1emu.o snapshot.o soundux.o spc700.o srtc.o tile.o
+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
@@ -40,10 +35,21 @@ endif
 
 ifeq ($(CONF_BUILD_ASM_SPC700), 1)
        OBJS += spc700a.o
-       CPPFLAGS += -DCONF_BUILD_ASM_CPU=1
+       CPPFLAGS += -DCONF_BUILD_ASM_SPC700=1
+endif
+
+ifeq ($(CONF_BUILD_ASM_SA1), 1)
+       crash
+else
+       OBJS += sa1cpu.o
 endif
 
-OBJS += $(CONF_BUILD_ROUTINES).o
+ifeq ($(CONF_XSP), 1)
+       CPPFLAGS += -DCONF_XSP=1 $(shell pkg-config --cflags xsp)
+       LDLIBS += $(shell pkg-config --libs xsp)
+endif
+
+OBJS += $(CONF_BUILD_MISC_ROUTINES).o
 
 # from open-whatever sdk
 OBJS += unzip.o ioapi.o
@@ -71,7 +77,7 @@ drnoksnes: $(OBJS)
 
 install: drnoksnes
        install drnoksnes $(DESTDIR)/usr/games
-       $(MAKE) -C gui install
+       $(MAKE) -C gui install DESTDIR="$(DESTDIR)"
 
 deps: $(DEPS)
 %.d: %.cpp
@@ -83,9 +89,9 @@ deps: $(DEPS)
 
 gui:
        $(MAKE) -C gui all
-       
+
 gui_clean:
        $(MAKE) -C gui clean
-       
+
 .PHONY: all clean remake deps install gui gui_clean