94eb604c92dea38b8e4f33fd36f0b74245ed2011
[gpsp.git] / gp2x / Makefile
1 # gpSP makefile
2 # Gilead Kutnick - Exophase
3 # GP2X port(ion) - Z
4
5 # Global definitions
6
7 PREFIX  = /opt/open2x/gcc-4.1.1-glibc-2.3.6
8 CC        = $(PREFIX)/bin/arm-open2x-linux-gcc
9 STRIP     = $(PREFIX)/bin/arm-open2x-linux-strip
10
11 OBJS      = main.o cpu.o memory.u video.o input.o sound.o gp2x.o gui.o        \
12             cheats.o zip.o cpu_threaded.z arm_stub.o video_blend.o            \
13             warm.o sys_cacheflush.o upscale_aspect.o
14 BIN       = gpsp.gpe 
15
16 # Platform specific definitions 
17
18 VPATH      += ..
19 CFLAGS     += -DARM_ARCH -DGP2X_BUILD
20 ifeq ($(WIZ),1)
21 CFLAGS     += -DWIZ_BUILD
22 endif
23 # NOTE: -funroll-loops will slow down compiling considerably
24 CFLAGS     += -O3 -std=c99 -msoft-float -funsigned-char -fno-common           \
25               -fno-builtin                                                    \
26
27 INCLUDES   = `$(PREFIX)/bin/sdl-config --cflags` -I$(PREFIX)/include
28 LIBS       = `$(PREFIX)/bin/sdl-config --libs`               \
29               -lm -ldl -lpthread -lz
30 ifneq ($(WIZ),1)
31 LIBS       += -static
32 endif
33
34 #CFLAGS     += -ggdb
35 #LIBS       += -ggdb
36
37 # Compilation:
38
39 .SUFFIXES: .c
40
41 %.z: %.c
42         $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
43
44 %.u: %.c
45         $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
46
47 %.o: %.c
48         $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
49
50 %.o: %.S
51         $(CC) $(ASFLAGS) $(INCLUDES) -c -o $@ $<
52
53 %.o: %.s
54         $(CC) $(ASFLAGS) $(INCLUDES) -c -o $@ $<
55
56 all:    $(OBJS)
57         $(CC) $(OBJS) $(LIBS) -o $(BIN)  
58         $(STRIP) $(BIN)
59
60 clean:
61         rm -f *.o *.u *.z $(BIN) 
62