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