disabling inline set/gets + enable sa-1 c cpu
[drnoksnes] / Makefile
1 #!/usr/bin/make
2
3 CPPFLAGS := -I. $(shell sdl-config --cflags) $(shell pkg-config --cflags x11 xsp) -I/usr/include/hgw
4 LDLIBS := -lz $(shell sdl-config --libs) $(shell pkg-config --libs x11 xsp) -lpopt -lhgw
5
6 # Default CFLAGS for building in N8x0
7 ARCH ?= arm
8 CFLAGS ?= -DMAEMO -DMAEMO_VERSION=4 -march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -O2 -g -Wall -static-libgcc
9 ASFLAGS ?= -march=armv6j -mfpu=vfp -mfloat-abi=softfp -g
10 CXXFLAGS ?= $(CFLAGS)
11
12 GAME_VERSION ?= $(shell head -n 1 debian/changelog | sed 's/[^0-9.-]//g')-git
13 export GAME_VERSION
14 export DESTDIR
15
16 # Configuration settings
17 CONF_BUILD_ASM_CPU=0
18 CONF_BUILD_ASM_SPC700=0
19
20 ifeq ($(ARCH),arm)
21         CONF_BUILD_ASM_CPU=1
22         CONF_BUILD_ASM_SPC700=1
23         CONF_BUILD_ROUTINES=misc_armel
24 else ifeq ($(ARCH),intel)
25         CONF_BUILD_ROUTINES=misc_i386
26 endif
27
28 # SNES stuff
29 OBJS = 2xsaiwin.o apu.o c4.o c4emu.o cheats.o cheats2.o clip.o cpu.o cpuexec.o data.o
30 OBJS += dma.o dsp1.o fxemu.o fxinst.o gfx.o globals.o loadzip.o memmap.o netplay.o ppu.o
31 OBJS += sa1.o sdd1.o sdd1emu.o snapshot.o soundux.o spc700.o srtc.o tile.o
32
33 ifeq ($(CONF_BUILD_ASM_CPU), 1)
34         # ASM CPU Core from yoyofr's OpenSnes9X
35         OBJS += os9x_asm_cpu.o os9x_65c816.o
36         CPPFLAGS += -DCONF_BUILD_ASM_CPU=1
37 else
38         OBJS += cpuops.o sa1cpu.o
39 endif
40
41 ifeq ($(CONF_BUILD_ASM_SPC700), 1)
42         OBJS += spc700a.o
43         CPPFLAGS += -DCONF_BUILD_ASM_SPC700=1
44 endif
45
46 OBJS += $(CONF_BUILD_ROUTINES).o
47
48 # from open-whatever sdk
49 OBJS += unzip.o ioapi.o
50 # my extensions to snes9x (speedhacks support)
51 OBJS += hacks.o
52 # the glue code that sticks it all together in a monstruous way
53 OBJS += platform/path.o platform/config.o platform/hgw.o
54 OBJS += platform/sdl.o platform/sdlv.o platform/sdla.o platform/sdli.o
55
56 # automatic dependencies
57 DEPS := $(OBJS:.o=.d)
58
59 all: drnoksnes gui
60
61 clean: gui_clean
62         rm -f drnoksnes *.o *.d platform/*.o platform/*.d
63         rm -f build-stamp configure-stamp
64
65 remake: clean deps all
66
67 -include $(DEPS)
68
69 drnoksnes: $(OBJS)
70         $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
71
72 install: drnoksnes
73         install drnoksnes $(DESTDIR)/usr/games
74         $(MAKE) -C gui install
75
76 deps: $(DEPS)
77 %.d: %.cpp
78         @$(CXX) $(CPPFLAGS) -MM $^ -MF $@ -MT $@ -MT $*.o
79 %.d: %.c
80         @$(CC) $(CPPFLAGS) -MM $^ -MF $@ -MT $@ -MT $*.o
81 %.d: %.s
82         @touch $@
83
84 gui:
85         $(MAKE) -C gui all
86         
87 gui_clean:
88         $(MAKE) -C gui clean
89         
90 .PHONY: all clean remake deps install gui gui_clean
91