| 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 upscale_aspect.o |
| 14 | ifeq ($(WIZ),1) |
| 15 | BIN = gpsp_wiz |
| 16 | else |
| 17 | BIN = gpsp_gp2x |
| 18 | endif |
| 19 | |
| 20 | # Platform specific definitions |
| 21 | |
| 22 | VPATH += .. |
| 23 | CFLAGS += -DARM_ARCH -DGP2X_BUILD |
| 24 | ifeq ($(WIZ),1) |
| 25 | CFLAGS += -DWIZ_BUILD |
| 26 | endif |
| 27 | # NOTE: -funroll-loops will slow down compiling considerably |
| 28 | CFLAGS += -O3 -std=c99 -msoft-float -funsigned-char -fno-common \ |
| 29 | -fno-builtin \ |
| 30 | |
| 31 | INCLUDES = `$(PREFIX)/bin/sdl-config --cflags` -I$(PREFIX)/include |
| 32 | LIBS = `$(PREFIX)/bin/sdl-config --libs` \ |
| 33 | -lm -ldl -lpthread -lz |
| 34 | ifneq ($(WIZ),1) |
| 35 | LIBS += -static |
| 36 | endif |
| 37 | |
| 38 | # Compilation: |
| 39 | |
| 40 | .SUFFIXES: .c |
| 41 | |
| 42 | %.z: %.c |
| 43 | $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< |
| 44 | |
| 45 | %.u: %.c |
| 46 | $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< |
| 47 | |
| 48 | %.o: %.c |
| 49 | $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< |
| 50 | |
| 51 | %.o: %.S |
| 52 | $(CC) $(ASFLAGS) $(INCLUDES) -c -o $@ $< |
| 53 | |
| 54 | %.o: %.s |
| 55 | $(CC) $(ASFLAGS) $(INCLUDES) -c -o $@ $< |
| 56 | |
| 57 | all: $(OBJS) |
| 58 | $(CC) $(OBJS) $(LIBS) -o $(BIN) |
| 59 | $(STRIP) $(BIN) |
| 60 | |
| 61 | clean: |
| 62 | rm -f *.o *.u *.z $(BIN) |
| 63 | |