| 1 | #CROSS_COMPILE= |
| 2 | AS = $(CROSS_COMPILE)as |
| 3 | CC = $(CROSS_COMPILE)gcc |
| 4 | LD = $(CROSS_COMPILE)ld |
| 5 | |
| 6 | ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}') |
| 7 | |
| 8 | CFLAGS += -ggdb -Ifrontend |
| 9 | LDFLAGS += -lz -lpthread -ldl -lpng -lbz2 |
| 10 | ifeq "$(ARCH)" "arm" |
| 11 | CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp -ffast-math |
| 12 | ASFLAGS += -mcpu=cortex-a8 -mfpu=neon |
| 13 | endif |
| 14 | ifndef DEBUG |
| 15 | CFLAGS += -O2 -DNDEBUG |
| 16 | endif |
| 17 | CFLAGS += $(EXTRA_CFLAGS) |
| 18 | |
| 19 | USE_OSS ?= 1 |
| 20 | #USE_ALSA = 1 |
| 21 | #DRC_DBG = 1 |
| 22 | #PCNT = 1 |
| 23 | TARGET = pcsx |
| 24 | |
| 25 | -include Makefile.local |
| 26 | |
| 27 | all: $(TARGET) |
| 28 | |
| 29 | # core |
| 30 | OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \ |
| 31 | libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/gte.o libpcsxcore/mdec.o \ |
| 32 | libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \ |
| 33 | libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \ |
| 34 | libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \ |
| 35 | libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o |
| 36 | # dynarec |
| 37 | ifndef NO_NEW_DRC |
| 38 | OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o |
| 39 | OBJS += libpcsxcore/new_dynarec/pcsxmem.o |
| 40 | endif |
| 41 | OBJS += libpcsxcore/new_dynarec/emu_if.o |
| 42 | libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c |
| 43 | ifdef DRC_DBG |
| 44 | libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64 |
| 45 | CFLAGS += -DDRC_DBG |
| 46 | endif |
| 47 | |
| 48 | # spu |
| 49 | OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \ |
| 50 | plugins/dfsound/registers.o plugins/dfsound/spu.o |
| 51 | ifeq "$(USE_OSS)" "1" |
| 52 | plugins/dfsound/%.o: CFLAGS += -DUSEOSS |
| 53 | OBJS += plugins/dfsound/oss.o |
| 54 | endif |
| 55 | ifeq "$(USE_ALSA)" "1" |
| 56 | plugins/dfsound/%.o: CFLAGS += -DUSEALSA |
| 57 | OBJS += plugins/dfsound/alsa.o |
| 58 | LDFLAGS += -lasound |
| 59 | endif |
| 60 | |
| 61 | # gpu |
| 62 | plugins/dfxvideo/%.o: CFLAGS += -Wall |
| 63 | OBJS += plugins/dfxvideo/gpu.o |
| 64 | ifdef X11 |
| 65 | LDFLAGS += -lX11 -lXv |
| 66 | OBJS += plugins/dfxvideo/draw.o |
| 67 | else |
| 68 | OBJS += plugins/dfxvideo/draw_fb.o |
| 69 | endif |
| 70 | |
| 71 | # cdrcimg |
| 72 | plugins/cdrcimg/%.o: CFLAGS += -Wall |
| 73 | OBJS += plugins/cdrcimg/cdrcimg.o |
| 74 | |
| 75 | # dfinput |
| 76 | plugins/dfinput/%.o: CFLAGS += -Wall |
| 77 | OBJS += plugins/dfinput/pad.o |
| 78 | |
| 79 | # gui |
| 80 | OBJS += frontend/main.o frontend/plugin.o |
| 81 | ifeq "$(USE_GTK)" "1" |
| 82 | OBJS += maemo/hildon.o maemo/main.o |
| 83 | maemo/%.o: maemo/%.c |
| 84 | maemo/%.o: CFLAGS += -Wall |
| 85 | else |
| 86 | OBJS += frontend/plugin_lib.o frontend/menu.o |
| 87 | OBJS += frontend/linux/fbdev.o frontend/linux/in_evdev.o |
| 88 | OBJS += frontend/linux/plat.o frontend/linux/oshide.o |
| 89 | OBJS += frontend/common/fonts.o frontend/common/input.o frontend/common/readpng.o |
| 90 | ifeq "$(ARCH)" "arm" |
| 91 | OBJS += frontend/plat_omap.o |
| 92 | OBJS += frontend/pandora.o |
| 93 | else |
| 94 | OBJS += frontend/plat_dummy.o |
| 95 | endif |
| 96 | endif # !USE_GTK |
| 97 | ifeq "$(ARCH)" "arm" |
| 98 | OBJS += frontend/arm_utils.o |
| 99 | endif |
| 100 | ifdef X11 |
| 101 | frontend/%.o: CFLAGS += -DX11 |
| 102 | OBJS += frontend/xkb.o |
| 103 | endif |
| 104 | ifdef PCNT |
| 105 | CFLAGS += -DPCNT |
| 106 | endif |
| 107 | frontend/%.o: CFLAGS += -Wall -DIN_EVDEV |
| 108 | frontend/menu.o: frontend/revision.h |
| 109 | |
| 110 | frontend/revision.h: FORCE |
| 111 | @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_ |
| 112 | @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@ |
| 113 | @rm $@_ |
| 114 | .PHONY: FORCE |
| 115 | |
| 116 | |
| 117 | $(TARGET): $(OBJS) |
| 118 | $(CC) -o $@ $^ $(LDFLAGS) -Wl,-Map=$@.map |
| 119 | |
| 120 | PLUGINS = plugins/spunull/spunull.so plugins/gpu_unai/gpuPCSX4ALL.so \ |
| 121 | plugins/gpu-gles/gpuGLES.so |
| 122 | |
| 123 | $(PLUGINS): |
| 124 | make -C $(dir $@) |
| 125 | |
| 126 | clean: |
| 127 | $(RM) $(TARGET) $(OBJS) $(TARGET).map |
| 128 | |
| 129 | clean_plugins: |
| 130 | for dir in $(PLUGINS) ; do \ |
| 131 | $(MAKE) -C $$(dirname $$dir) clean; done |
| 132 | |
| 133 | # ----------- release ----------- |
| 134 | |
| 135 | PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh |
| 136 | |
| 137 | VER ?= $(shell git describe master) |
| 138 | |
| 139 | rel: pcsx $(PLUGINS) \ |
| 140 | pandora/pcsx.sh pandora/pcsx.pxml pandora/pcsx.png \ |
| 141 | pandora/picorestore pandora/readme.txt skin COPYING |
| 142 | rm -rf out |
| 143 | mkdir -p out/plugins |
| 144 | cp -r $^ out/ |
| 145 | mv out/*.so out/plugins/ |
| 146 | $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x pandora/pcsx.pxml -i pandora/pcsx.png -c |