fix most compiler code style warnings
[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 CONF_HGW?=$(CONF_GUI)
11 ifeq ($(ARCH),armel)
12         CONF_BUILD_ASM_CPU?=1
13         CONF_BUILD_ASM_SPC700?=1
14         CONF_BUILD_ASM_SA1?=0   # Still not there
15         CONF_XSP?=1
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   # Still not there
21         CONF_XSP?=0
22         CONF_BUILD_MISC_ROUTINES?=misc_i386
23 endif
24
25 # SNES stuff
26 OBJS = apu.o c4.o c4emu.o cheats.o cheats2.o clip.o cpu.o cpuexec.o data.o
27 OBJS += dma.o dsp1.o font.o fxemu.o fxinst.o gfx.o globals.o loadzip.o memmap.o 
28 OBJS += ppu.o sa1.o sdd1.o sdd1emu.o snapshot.o soundux.o spc700.o srtc.o tile.o
29
30 ifeq ($(CONF_BUILD_ASM_CPU), 1)
31         # ASM CPU Core from yoyofr's OpenSnes9X
32         OBJS += os9x_asm_cpu.o os9x_65c816.o
33         CPPFLAGS += -DCONF_BUILD_ASM_CPU=1
34 else
35         OBJS += cpuops.o
36 endif
37
38 ifeq ($(CONF_BUILD_ASM_SPC700), 1)
39         OBJS += spc700a.o
40         CPPFLAGS += -DCONF_BUILD_ASM_SPC700=1
41 endif
42
43 ifeq ($(CONF_BUILD_ASM_SA1), 1)
44         crash
45 else
46         OBJS += sa1cpu.o
47 endif
48
49 ifeq ($(CONF_XSP), 1)
50         CPPFLAGS += -DCONF_XSP=1 $(shell pkg-config --cflags xsp)
51         LDLIBS += $(shell pkg-config --libs xsp)
52 endif
53
54 OBJS += $(CONF_BUILD_MISC_ROUTINES).o
55
56 # from open-whatever sdk
57 OBJS += unzip.o ioapi.o
58 # my extensions to snes9x (speedhacks support)
59 OBJS += hacks.o
60 # the glue code that sticks it all together in a monstruous way
61 OBJS += platform/path.o platform/config.o
62 OBJS += platform/sdl.o platform/sdlv.o platform/sdla.o platform/sdli.o
63
64 ifeq ($(CONF_HGW), 1)
65         CPPFLAGS += -DCONF_HGW=1 -I/usr/include/hgw
66         LDLIBS += -lhgw
67         OBJS += platform/hgw.o
68 endif
69
70 # automatic dependencies
71 DEPS := $(OBJS:.o=.d)
72
73 all: drnoksnes
74
75 clean:
76         rm -f drnoksnes *.o *.d platform/*.o platform/*.d
77         rm -f build-stamp configure-stamp
78
79 remake: clean deps all
80
81 -include $(DEPS)
82
83 drnoksnes: $(OBJS)
84         $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
85
86 install: drnoksnes
87         install drnoksnes $(DESTDIR)/usr/games
88
89 deps: $(DEPS)
90 %.d: %.cpp
91         @$(CXX) $(CPPFLAGS) -MM $^ -MF $@ -MT $@ -MT $*.o
92 %.d: %.c
93         @$(CC) $(CPPFLAGS) -MM $^ -MF $@ -MT $@ -MT $*.o
94 %.d: %.s
95         @touch $@
96
97 # GUI
98 gui:
99         $(MAKE) -C gui all
100
101 gui_clean:
102         $(MAKE) -C gui clean
103         
104 gui_install:
105         $(MAKE) -C gui install DESTDIR="$(DESTDIR)"
106         
107 ifeq ($(CONF_GUI), 1)
108 all: gui
109 clean: gui_clean
110 install: gui_install
111 endif
112
113 .PHONY: all clean remake deps install gui gui_clean
114