translating
[drnoksnes] / Makefile
1 #!/usr/bin/make
2
3 CPPFLAGS := -I. $(shell sdl-config --cflags) $(shell pkg-config --cflags x11)
4 LDLIBS := -lz $(shell sdl-config --libs) $(shell pkg-config --libs x11) -lpopt
5
6 -include config.mk
7
8 # Sane defaults
9 CONF_GUI?=1
10 # Use Hildon Games Wrapper library
11 CONF_HGW?=$(CONF_GUI)
12 ifeq ($(ARCH),armel)
13         CONF_BUILD_ASM_CPU?=1
14         CONF_BUILD_ASM_SPC700?=1
15         CONF_BUILD_ASM_SA1?=0   # Still not there
16         CONF_BUILD_MISC_ROUTINES?=misc_armel
17 else ifeq ($(ARCH),i386)
18         CONF_BUILD_ASM_CPU?=0
19         CONF_BUILD_ASM_SPC700?=0
20         CONF_BUILD_ASM_SA1?=0
21         CONF_BUILD_MISC_ROUTINES?=misc_i386
22 endif
23 # Hardware pixel doubling (in N8x0)
24 CONF_XSP?=0
25 # Hildon Desktop compositing (in Fremantle)
26 CONF_HD?=0
27
28 # SNES stuff
29 OBJS = apu.o c4.o c4emu.o cheats.o cheats2.o clip.o cpu.o cpuexec.o data.o
30 OBJS += dma.o dsp1.o font.o fxemu.o fxinst.o gfx.o globals.o loadzip.o memmap.o 
31 OBJS += ppu.o 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
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 ifeq ($(CONF_BUILD_ASM_SA1), 1)
47         crash
48 else
49         OBJS += sa1cpu.o
50 endif
51
52
53 ifeq ($(CONF_XSP), 1)
54         CPPFLAGS += -DCONF_XSP=1 $(shell pkg-config --cflags xsp)
55         LDLIBS += $(shell pkg-config --libs xsp)
56 endif
57 ifeq ($(CONF_HD), 1)
58         CPPFLAGS += -DCONF_HD=1
59 endif
60
61 OBJS += $(CONF_BUILD_MISC_ROUTINES).o
62
63 # from open-whatever sdk
64 OBJS += unzip.o ioapi.o
65 # my extensions to snes9x (speedhacks support)
66 OBJS += hacks.o
67 # the glue code that sticks it all together in a monstruous way
68 OBJS += platform/path.o platform/config.o
69 OBJS += platform/sdl.o platform/sdlv.o platform/sdla.o platform/sdli.o
70 OBJS += platform/sdlvscalers.o
71
72 ifeq ($(CONF_HGW), 1)
73         CPPFLAGS += -DCONF_HGW=1 -I/usr/include/hgw
74         LDLIBS += -lhgw
75         OBJS += platform/hgw.o
76 endif
77
78 # automatic dependencies
79 DEPS := $(OBJS:.o=.d)
80
81 all: drnoksnes
82
83 clean:
84         rm -f drnoksnes *.o *.d platform/*.o platform/*.d
85         rm -f build-stamp configure-stamp
86
87 remake: clean deps all
88
89 -include $(DEPS)
90
91 drnoksnes: $(OBJS)
92         $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
93
94 install: drnoksnes
95         install drnoksnes $(DESTDIR)/usr/games
96
97 deps: $(DEPS)
98 %.d: %.cpp
99         @$(CXX) $(CPPFLAGS) -MM $^ -MF $@ -MT $@ -MT $*.o
100 %.d: %.c
101         @$(CC) $(CPPFLAGS) -MM $^ -MF $@ -MT $@ -MT $*.o
102 %.d: %.s
103         @touch $@
104
105 # GUI
106 gui:
107         $(MAKE) -C gui all
108
109 gui_clean:
110         $(MAKE) -C gui clean
111         
112 gui_install:
113         $(MAKE) -C gui install DESTDIR="$(DESTDIR)"
114         
115 ifeq ($(CONF_GUI), 1)
116 all: gui
117 clean: gui_clean
118 install: gui_install
119 endif
120
121 distclean: clean
122         rm -f config.mk
123
124 .PHONY: all clean remake deps install gui gui_clean distclean
125