From 4132e8ca13b6395f8a9ef7ec7d01cbdcc19c037d Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 20 Apr 2012 02:28:55 +0300 Subject: [PATCH] bring in configure build system not using autotools, trying to do something similar like qemu instead. --- Makefile | 134 ++++++++------ Makefile.caanoo | 37 ---- Makefile.maemo | 22 --- configure | 277 ++++++++++++++++++++++++++++ libpcsxcore/new_dynarec/assem_arm.h | 4 - plugins/dfxvideo/Makefile | 20 ++ plugins/gpu-gles/Makefile | 6 +- plugins/gpu_neon/Makefile | 16 +- plugins/gpu_unai/Makefile | 8 +- plugins/gpulib/Makefile | 26 ++- plugins/gpulib/gpulib.mak | 23 +-- plugins/spunull/Makefile | 10 +- 12 files changed, 404 insertions(+), 179 deletions(-) delete mode 100644 Makefile.caanoo delete mode 100644 Makefile.maemo create mode 100755 configure create mode 100644 plugins/dfxvideo/Makefile diff --git a/Makefile b/Makefile index f08d9d76..5b5ffe16 100644 --- a/Makefile +++ b/Makefile @@ -1,50 +1,29 @@ -#CROSS_COMPILE= -AS = $(CROSS_COMPILE)as -GCC = $(CROSS_COMPILE)gcc -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)ld -ifdef CC_OVERRIDE -CC = $(CC_OVERRIDE) -endif - -ARM926 ?= 0 -ARM_CORTEXA8 ?= 1 -PLATFORM ?= pandora -USE_OSS ?= 1 -RAM_FIXED ?= 1 -#USE_ALSA = 1 -#DRC_DBG = 1 -#PCNT = 1 -TARGET = pcsx +# Makefile for PCSX ReARMed --include Makefile.local - -ARCH = $(shell $(GCC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}') +TARGET = pcsx +# default CFLAGS go here, so that config can override them CFLAGS += -Wall -ggdb -Ifrontend -ffast-math -LDFLAGS += -lpthread -ldl -lpng -lz -lm +LDLIBS += -lpthread -ldl -lpng -lz -lm ifndef DEBUG CFLAGS += -O2 -DNDEBUG endif -CFLAGS += $(EXTRA_CFLAGS) - -ifeq "$(ARCH)" "arm" -ifeq "$(ARM_CORTEXA8)" "1" -GCC_CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ASFLAGS += -mcpu=cortex-a8 -mfpu=neon -endif -ifeq "$(ARM926)" "1" -GCC_CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s -ASFLAGS += -mcpu=arm926ej-s -mfloat-abi=softfp -endif -endif -CFLAGS += $(GCC_CFLAGS) +#DRC_DBG = 1 +#PCNT = 1 -# detect armv7 and NEON from the specified CPU -HAVE_NEON = $(shell $(GCC) -E -dD $(GCC_CFLAGS) frontend/config.h | grep -q '__ARM_NEON__ 1' && echo 1) -HAVE_ARMV7 = $(shell $(GCC) -E -dD $(GCC_CFLAGS) frontend/config.h | grep -q '__ARM_ARCH_7A__ 1' && echo 1) +all: config.mak $(TARGET) -all: $(TARGET) +ifneq ($(wildcard config.mak),) +config.mak: ./configure + @echo $@ is out-of-date, running configure + @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh +include config.mak +else +config.mak: + @echo "Please run ./configure before running make!" + @exit 1 +endif +-include Makefile.local # core OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \ @@ -64,7 +43,7 @@ libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull # dynarec -ifndef NO_NEW_DRC +ifeq "$(USE_DYNAREC)" "1" OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o OBJS += libpcsxcore/new_dynarec/pcsxmem.o endif @@ -76,8 +55,8 @@ ifdef DRC_DBG libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64 CFLAGS += -DDRC_DBG endif -ifeq "$(RAM_FIXED)" "1" -CFLAGS += -DRAM_FIXED +ifeq "$(DRC_CACHE_BASE)" "1" +libpcsxcore/new_dynarec/%.o: CFLAGS += -DBASE_ADDR_FIXED=1 endif # spu @@ -95,7 +74,10 @@ endif ifeq "$(USE_ALSA)" "1" plugins/dfsound/%.o: CFLAGS += -DUSEALSA OBJS += plugins/dfsound/alsa.o -LDFLAGS += -lasound +LDLIBS += -lasound +endif +ifeq "$(USE_NO_SOUND)" "1" +OBJS += plugins/dfsound/nullsnd.o endif # gpu @@ -113,7 +95,7 @@ plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c OBJS += plugins/dfxvideo/gpulib_if.o endif ifdef X11 -LDFLAGS += -lX11 `sdl-config --libs` +LDLIBS += -lX11 `sdl-config --libs` OBJS += plugins/gpulib/vout_sdl.o plugins/gpulib/vout_sdl.o: CFLAGS += `sdl-config --cflags` else @@ -130,28 +112,27 @@ OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o OBJS += frontend/main.o frontend/plugin.o OBJS += frontend/plugin_lib.o frontend/common/readpng.o OBJS += frontend/common/fonts.o frontend/linux/plat.o -ifeq "$(USE_GTK)" "1" +ifeq "$(PLATFORM)" "maemo" OBJS += maemo/hildon.o maemo/main.o maemo/%.o: maemo/%.c else OBJS += frontend/menu.o frontend/linux/in_evdev.o OBJS += frontend/common/input.o frontend/linux/xenv.o +ifeq "$(PLATFORM)" "generic" +OBJS += frontend/plat_dummy.o +endif ifeq "$(PLATFORM)" "pandora" frontend/%.o: CFLAGS += -DVOUT_FBDEV OBJS += frontend/linux/fbdev.o OBJS += frontend/plat_omap.o OBJS += frontend/plat_pandora.o -else +endif ifeq "$(PLATFORM)" "caanoo" OBJS += frontend/plat_pollux.o frontend/in_tsbutton.o frontend/blit320.o OBJS += frontend/gp2x/in_gp2x.o frontend/warm/warm.o -else -OBJS += frontend/plat_dummy.o -endif endif - -endif # !USE_GTK +endif # !maemo ifdef X11 frontend/%.o: CFLAGS += -DX11 @@ -160,11 +141,10 @@ endif ifdef PCNT CFLAGS += -DPCNT endif -ifndef NO_TSLIB +ifeq "$(HAVE_TSLIB)" "1" frontend/%.o: CFLAGS += -DHAVE_TSLIB OBJS += frontend/pl_gun_ts.o endif -%.o: ASFLAGS += --defsym HAVE_ARMV7=$(HAVE_ARMV7) frontend/%.o: CFLAGS += -DIN_EVDEV frontend/menu.o: frontend/revision.h @@ -181,28 +161,31 @@ frontend/revision.h: FORCE $(CC) $(CFLAGS) -c $^ -o $@ $(TARGET): $(OBJS) - $(CC) -o $@ $^ $(LDFLAGS) -Wl,-Map=$@.map + $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map -PLUGINS ?= plugins/spunull/spunull.so plugins/gpu-gles/gpu_gles.so \ - plugins/gpu_unai/gpu_unai.so plugins/dfxvideo/gpu_peops.so +clean: $(PLAT_CLEAN) + $(RM) $(TARGET) $(OBJS) $(TARGET).map +ifneq ($(PLUGINS),) $(PLUGINS): make -C plugins/gpulib/ clean make -C $(dir $@) -clean: $(PLAT_CLEAN) - $(RM) $(TARGET) $(OBJS) $(TARGET).map - clean_plugins: make -C plugins/gpulib/ clean for dir in $(PLUGINS) ; do \ $(MAKE) -C $$(dirname $$dir) clean; done +endif # ----------- release ----------- +VER ?= $(shell git describe master) + +ifeq "$(PLATFORM)" "pandora" PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh -VER ?= $(shell git describe master) +PLUGINS ?= plugins/spunull/spunull.so plugins/gpu-gles/gpu_gles.so \ + plugins/gpu_unai/gpu_unai.so plugins/dfxvideo/gpu_peops.so rel: pcsx $(PLUGINS) \ frontend/pandora/pcsx.sh frontend/pandora/pcsx.pxml.templ frontend/pandora/pcsx.png \ @@ -217,3 +200,34 @@ rel: pcsx $(PLUGINS) \ mv out/plugins/gpu_gles.so out/plugins/gpuGLES.so mv out/plugins/gpu_peops.so out/plugins/gpuPEOPS.so $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x out/pcsx.pxml -i frontend/pandora/pcsx.png -c +endif + +ifeq "$(PLATFORM)" "caanoo" +PLAT_CLEAN = caanoo_clean + +caanoo_clean: + $(RM) frontend/320240/pollux_set + +PLUGINS ?= plugins/spunull/spunull.so plugins/gpu_unai/gpu_unai.so \ + plugins/gpu-gles/gpu_gles.so + +rel: pcsx $(PLUGINS) \ + frontend/320240/caanoo.gpe frontend/320240/pcsx26.png \ + frontend/320240/pcsxb.png frontend/320240/skin \ + frontend/warm/bin/warm_2.6.24.ko frontend/320240/pollux_set \ + frontend/320240/pcsx_rearmed.ini frontend/320240/haptic_w.cfg \ + frontend/320240/haptic_s.cfg \ + readme.txt COPYING + rm -rf out + mkdir -p out/pcsx_rearmed/plugins + cp -r $^ out/pcsx_rearmed/ + mv out/pcsx_rearmed/gpu_unai.so out/pcsx_rearmed/gpuPCSX4ALL.so + mv out/pcsx_rearmed/gpu_gles.so out/pcsx_rearmed/gpuGLES.so + mv out/pcsx_rearmed/*.so out/pcsx_rearmed/plugins/ + mv out/pcsx_rearmed/caanoo.gpe out/pcsx_rearmed/pcsx.gpe + mv out/pcsx_rearmed/pcsx_rearmed.ini out/ + mkdir out/pcsx_rearmed/lib/ + cp ./lib/libbz2.so.1 out/pcsx_rearmed/lib/ + mkdir out/pcsx_rearmed/bios/ + cd out && zip -9 -r ../pcsx_rearmed_$(VER)_caanoo.zip * +endif diff --git a/Makefile.caanoo b/Makefile.caanoo deleted file mode 100644 index 77e8e4b6..00000000 --- a/Makefile.caanoo +++ /dev/null @@ -1,37 +0,0 @@ -export ARM926=1 -export ARM_CORTEXA8=0 -# caanoo also covers Wiz -export PLATFORM=caanoo - -PLAT_CLEAN = caanoo_clean - -include Makefile - -caanoo_clean: - $(RM) frontend/320240/pollux_set - -PLUGINS = plugins/spunull/spunull.so plugins/gpu_unai/gpu_unai.so \ - plugins/gpu-gles/gpu_gles.so - -# ----------- release ----------- - -rel_caanoo: pcsx $(PLUGINS) \ - frontend/320240/caanoo.gpe frontend/320240/pcsx26.png \ - frontend/320240/pcsxb.png frontend/320240/skin \ - frontend/warm/bin/warm_2.6.24.ko frontend/320240/pollux_set \ - frontend/320240/pcsx_rearmed.ini frontend/320240/haptic_w.cfg \ - frontend/320240/haptic_s.cfg \ - readme.txt COPYING - rm -rf out - mkdir -p out/pcsx_rearmed/plugins - cp -r $^ out/pcsx_rearmed/ - mv out/pcsx_rearmed/gpu_unai.so out/pcsx_rearmed/gpuPCSX4ALL.so - mv out/pcsx_rearmed/gpu_gles.so out/pcsx_rearmed/gpuGLES.so - mv out/pcsx_rearmed/*.so out/pcsx_rearmed/plugins/ - mv out/pcsx_rearmed/caanoo.gpe out/pcsx_rearmed/pcsx.gpe - mv out/pcsx_rearmed/pcsx_rearmed.ini out/ - mkdir out/pcsx_rearmed/lib/ - cp ./lib/libbz2.so.1 out/pcsx_rearmed/lib/ - mkdir out/pcsx_rearmed/bios/ - cd out && zip -9 -r ../pcsx_rearmed_$(VER)_caanoo.zip * - diff --git a/Makefile.maemo b/Makefile.maemo deleted file mode 100644 index 0c2e49f3..00000000 --- a/Makefile.maemo +++ /dev/null @@ -1,22 +0,0 @@ -USE_GTK=1 -USE_ALSA=1 -USE_OSS=0 -PLATFORM=generic -NO_TSLIB=1 - -export MAEMO=1 -LDFLAGS += $(shell pkg-config --libs hildon-1 libpulse) -EXTRA_CFLAGS += -march=armv7-a -O3 -mfpu=neon -funsafe-math-optimizations \ - -mstructure-size-boundary=32 -falign-functions=32 -falign-loops \ - -DMAEMO -DMAEMO_CHANGES $(shell pkg-config --cflags hildon-1) - -#EXTRA_CFLAGS += -Imaemo/i/gtk-2.0 -Imaemo/i/hildon -Imaemo/i/glib-2.0 -Imaemo/i/cairo \ - -Imaemo/i/pango-1.0 -Imaemo/i/atk-1.0 -DMAEMO -DMAEMO_CHANGES - -include Makefile - -maemo: pcsx plugins/spunull/spunull.so - rm -rf out - mkdir -p out/plugins - cp -r plugins/spunull/spunull.so . - strip pcsx spunull.so diff --git a/configure b/configure new file mode 100755 index 00000000..47c68b8e --- /dev/null +++ b/configure @@ -0,0 +1,277 @@ +#!/bin/sh +# some elements originated from qemu configure +set -e + +TMPC="/tmp/pcsx-conf-${RANDOM}-$$-${RANDOM}.c" +TMPO="/tmp/pcsx-conf-${RANDOM}-$$-${RANDOM}.o" +trap "rm -f $TMPC $TMPO" EXIT INT QUIT TERM +rm -f config.log + +compile_object() +{ + c="$CC $CFLAGS -c $TMPC -o $TMPO $1" + echo $c >> config.log + $c >> config.log 2>&1 +} + +check_define() +{ + echo "" > $TMPC + $CC -E -dD $CFLAGS $TMPC | grep -q $1 || return 1 + return 0 +} + +# setting options to "yes" or "no" will make that choice default, +# "" means "autodetect". + +platform_list="generic pandora maemo caanoo" +platform="generic" +sound_driver_list="oss alsa none" +sound_driver="alsa" +ram_fixed="no" +drc_cache_base="no" +have_armv6="" +have_armv7="" +have_arm_neon="" +have_tslib="" +enable_dynarec="yes" +# these are for known platforms +optimize_cortexa8="no" +optimize_arm926ej="no" + +# hardcoded stuff +CC="${CC-${CROSS_COMPILE}gcc}" +AS="${AS-${CROSS_COMPILE}as}" +AR="${AS-${CROSS_COMPILE}ar}" +config_mak="config.mak" + +# call during arg parsing, so that cmd line can override platform defaults +set_platform() +{ + platform=$1 + case "$platform" in + generic) + ;; + pandora) + sound_driver="oss" + ram_fixed="yes" + drc_cache_base="yes" + optimize_cortexa8="yes" + have_arm_neon="yes" + ;; + maemo) + ram_fixed="yes" + drc_cache_base="yes" + optimize_cortexa8="yes" + have_arm_neon="yes" + ;; + caanoo) + sound_driver="oss" + ram_fixed="yes" + drc_cache_base="yes" + optimize_arm926ej="yes" + ;; + *) + echo "unsupported platform: $platform" + exit 1 + ;; + esac +} + +for opt do + optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` || true + case "$opt" in + --help|-h) show_help="yes" + ;; + --platform=*) set_platform "$optarg" + ;; + --sound-driver=*) sound_driver="$optarg" + ;; + --enable-neon) have_arm_neon="yes" + ;; + --disable-neon) have_arm_neon="no" + ;; + --disable-dynarec) enable_dynarec="no" + ;; + *) echo "ERROR: unknown option $opt"; show_help="yes" + ;; + esac +done + +if [ "$show_help" = "yes" ]; then + echo "options:" + echo " --help print this message" + echo " --platform=NAME target platform [$platform]" + echo " available: $platform_list" + echo " --sound-driver=NAME sound output driver [$sound_driver]" + echo " available: $sound_driver_list" + echo " --enable-neon" + echo " --disable-neon enable/disable ARM NEON optimizations [guessed]" + echo " --disable-dynarec disable dynamic recompiler" + echo " (dynarec is only available and enabled on ARM)" + echo "influential environment variables:" + echo " CROSS_COMPILE CC AS AR CFLAGS ASFLAGS LDFLAGS LDLIBS" + exit 1 +fi + +case "$sound_driver" in +oss|alsa|none) + ;; +*) + echo "unsupported sound driver: $sound_driver" + exit 1 + ;; +esac + +if [ -z "$ARCH" ]; then + ARCH=`$CC -v 2>&1 | grep -i 'target:' | awk '{print $2}' \ + | awk -F '-' '{print $1}'` +fi + +# ARM stuff +if [ "$ARCH" = "arm" ]; then + if [ "$optimize_cortexa8" = "yes" ]; then + # both: -mfpu=neon + CFLAGS="$CFLAGS -mcpu=cortex-a8 -mtune=cortex-a8" + ASFLAGS="$ASFLAGS -mcpu=cortex-a8" + fi + if [ "$optimize_arm926ej" = "yes" ]; then + CFLAGS="$CFLAGS -mcpu=arm926ej-s -mtune=arm926ej-s" + ASFLAGS="$ASFLAGS -mcpu=arm926ej-s -mfloat-abi=softfp" + fi + + if [ "x$have_arm_neon" = "x" ]; then + # detect NEON from user-supplied cflags to enable asm code + have_arm_neon=`check_define __ARM_NEON__ && echo yes` || true + fi + if [ "x$have_armv6" = "x" ]; then + have_armv6=`check_define __ARM_ARCH_6 && echo yes` || true + fi + if [ "x$have_armv7" = "x" ]; then + if check_define __ARM_ARCH_7A__; then + have_armv6="yes" + have_armv7="yes" + fi + fi + + # set mfpu and mfloat-abi if they are not set + if [ "$have_arm_neon" = "yes" ]; then + echo "$CFLAGS" | grep -q -- '-mfpu=' || CFLAGS="$CFLAGS -mfpu=neon" + echo "$ASFLAGS" | grep -q -- '-mfpu=' || ASFLAGS="$ASFLAGS -mfpu=neon" + elif [ "$have_armv6" = "yes" ]; then + echo "$CFLAGS" | grep -q -- '-mfpu=' || CFLAGS="$CFLAGS -mfpu=vfp" + echo "$ASFLAGS" | grep -q -- '-mfpu=' || ASFLAGS="$ASFLAGS -mfpu=vfp" + fi + if [ "$have_armv6" = "yes" ]; then + echo "$CFLAGS" | grep -q -- '-mfloat-abi=' || CFLAGS="$CFLAGS -mfloat-abi=softfp" + echo "$ASFLAGS" | grep -q -- '-mfloat-abi=' || ASFLAGS="$ASFLAGS -mfloat-abi=softfp" + fi + + if [ "$have_armv7" = "yes" ]; then + ASFLAGS="$ASFLAGS --defsym HAVE_ARMV7=1" + else + ASFLAGS="$ASFLAGS --defsym HAVE_ARMV7=0" + fi +else + # dynarec only available on ARM + enable_dynarec="no" +fi + +if [ "$ARCH" = "x86_64" ]; then + # currently we are full of 32bit assumptions, + # at least savestate compatibility will break without these + CFLAGS="$CFLAGS -m32" + LDFLAGS="$LDFLAGS -m32" +fi + +# supposedly we can avoid -fPIC on armv5 for slightly better performace? +if [ "$ARCH" != "arm" -o "$have_armv6" = "yes" ]; then + PLUGIN_CFLAGS="$PLUGIN_CFLAGS -fPIC" +fi + +if [ "$ram_fixed" = "yes" ]; then + CFLAGS="$CFLAGS -DRAM_FIXED" +fi + +if [ "$platform" = "maemo" ]; then + maemo_cflags=`pkg-config --cflags hildon-1` + maemo_ldlibs=`pkg-config --libs hildon-1` + CFLAGS="$CFLAGS -DMAEMO -DMAEMO_CHANGES $maemo_cflags" + LDFLAGS="$LDFLAGS $maemo_ldlibs" +fi + +# check for tslib (only headers needed) +if [ "x$have_tslib" = "x" ]; then + cat > $TMPC < + void test(struct ts_sample sample) {} +EOF + if compile_object; then + have_tslib="yes" + else + have_tslib="no" + fi +fi + +# set things that failed to autodetect to "no" +test "x$have_armv6" != "x" || have_armv6="no" +test "x$have_armv7" != "x" || have_armv7="no" +test "x$have_arm_neon" != "x" || have_arm_neon="no" + +echo "architecture $ARCH" +echo "platform $platform" +echo "sound driver $sound_driver" +echo "C compiler $CC" +echo "C compiler flags $CFLAGS" +echo "enable dynarec $enable_dynarec" +echo "ARMv7 optimizations $have_armv7" +echo "enable ARM NEON $have_arm_neon" +echo "tslib support $have_tslib" + +echo "# Automatically generated by configure" > $config_mak +printf "# Configured with:" >> $config_mak +printf " '%s'" "$0" "$@" >> $config_mak +echo >> $config_mak + +echo "CC = $CC" >> $config_mak +echo "AS = $AS" >> $config_mak +echo "CFLAGS += $CFLAGS" >> $config_mak +echo "ASFLAGS += $ASFLAGS" >> $config_mak +echo "LDFLAGS += $LDFLAGS" >> $config_mak +echo "LDLIBS += $LDLIBS" >> $config_mak +echo "PLUGIN_CFLAGS += $PLUGIN_CFLAGS" >> $config_mak +echo >> $config_mak + +echo "ARCH = $ARCH" >> $config_mak +echo "PLATFORM = $platform" >> $config_mak +case "$sound_driver" in +oss) + echo "USE_OSS = 1" >> $config_mak + ;; +alsa) + echo "USE_ALSA = 1" >> $config_mak + ;; +none) + echo "USE_NO_SOUND = 1" >> $config_mak + ;; +esac +if [ "$have_armv6" = "yes" ]; then + echo "HAVE_ARMV6 = 1" >> $config_mak +fi +if [ "$have_armv7" = "yes" ]; then + echo "HAVE_ARMV7 = 1" >> $config_mak +fi +if [ "$have_arm_neon" = "yes" ]; then + echo "HAVE_NEON = 1" >> $config_mak +fi +if [ "$have_tslib" = "yes" ]; then + echo "HAVE_TSLIB = 1" >> $config_mak +fi +if [ "$enable_dynarec" = "yes" ]; then + echo "USE_DYNAREC = 1" >> $config_mak +fi +if [ "$drc_cache_base" = "yes" ]; then + echo "DRC_CACHE_BASE = 1" >> $config_mak +fi + +# vim:shiftwidth=2:expandtab diff --git a/libpcsxcore/new_dynarec/assem_arm.h b/libpcsxcore/new_dynarec/assem_arm.h index 0148a953..2d9efe13 100644 --- a/libpcsxcore/new_dynarec/assem_arm.h +++ b/libpcsxcore/new_dynarec/assem_arm.h @@ -23,12 +23,8 @@ #endif #ifndef BASE_ADDR_FIXED -#ifndef __ANDROID__ -#define BASE_ADDR_FIXED 1 -#else #define BASE_ADDR_FIXED 0 #endif -#endif #ifdef FORCE32 #define REG_SHIFT 2 diff --git a/plugins/dfxvideo/Makefile b/plugins/dfxvideo/Makefile new file mode 100644 index 00000000..b6cc756d --- /dev/null +++ b/plugins/dfxvideo/Makefile @@ -0,0 +1,20 @@ +CFLAGS += -Wall -ggdb -O2 +CFLAGS += -fno-strict-aliasing -ffast-math +# ugh +CFLAGS += -I../../libpcsxcore + +include ../../config.mak + +SRC_STANDALONE += gpu.c +SRC_GPULIB += gpulib_if.c + +ifeq "$(ARCH)" "arm" +SRC_STANDALONE += draw_fb.c +else +SRC_STANDALONE += draw.c +LDLIBS_STANDALONE += -lX11 -lXv +endif + +BIN_STANDLALONE = gpuPEOPS.so +BIN_GPULIB = gpu_peops.so +include ../gpulib/gpulib.mak diff --git a/plugins/gpu-gles/Makefile b/plugins/gpu-gles/Makefile index 06552ed3..894daec5 100644 --- a/plugins/gpu-gles/Makefile +++ b/plugins/gpu-gles/Makefile @@ -1,9 +1,7 @@ -CC = $(CROSS_COMPILE)gcc - -ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}') - CFLAGS += -ggdb -fPIC -O2 # -Wall +include ../../config.mak + SRC_STANDALONE += gpuDraw.c gpuFps.c gpuPlugin.c gpuPrim.c gpuTexture.c SRC_GPULIB += gpulib_if.c diff --git a/plugins/gpu_neon/Makefile b/plugins/gpu_neon/Makefile index 93839d23..8a7342bd 100644 --- a/plugins/gpu_neon/Makefile +++ b/plugins/gpu_neon/Makefile @@ -1,18 +1,6 @@ -CC = $(CROSS_COMPILE)gcc +CFLAGS += -ggdb -Wall -O2 -ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}') - -HAVE_NEON = $(shell $(CC) -E -dD $(CFLAGS_) ../gpulib/gpu.h | grep -q '__ARM_NEON__ 1' && echo 1) - -# FIXME: rework NEON detection to get rid of this -ifeq "$(ARCH)" "arm" - ARM_CORTEXA8 ?= 1 - ifeq "$(ARM_CORTEXA8)" "1" - CFLAGS_ += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp - endif -endif - -CFLAGS += -ggdb -Wall -fPIC -O2 +include ../../config.mak SRC += psx_gpu_if.c diff --git a/plugins/gpu_unai/Makefile b/plugins/gpu_unai/Makefile index 57a03711..cf2e5d25 100644 --- a/plugins/gpu_unai/Makefile +++ b/plugins/gpu_unai/Makefile @@ -1,9 +1,7 @@ -CC = $(CROSS_COMPILE)g++ - -ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}') - -CFLAGS += -DREARMED CFLAGS += -ggdb -Wall -O3 -ffast-math +CFLAGS += -DREARMED + +include ../../config.mak SRC_STANDALONE += gpu.cpp SRC_GPULIB += gpulib_if.cpp diff --git a/plugins/gpulib/Makefile b/plugins/gpulib/Makefile index e65d81b2..9ed992f2 100644 --- a/plugins/gpulib/Makefile +++ b/plugins/gpulib/Makefile @@ -1,41 +1,37 @@ -CC = $(CROSS_COMPILE)gcc -AS = $(CROSS_COMPILE)as -AR = $(CROSS_COMPILE)ar - -ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}') - CFLAGS += -ggdb -Wall ifndef DEBUG CFLAGS += -O2 endif +include ../../config.mak + OBJS += gpu.o ifeq "$(ARCH)" "arm" -ARM_CORTEXA8 ?= 1 -ifeq "$(ARM_CORTEXA8)" "1" -CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -ASFLAGS += -mcpu=cortex-a8 -mfpu=neon +ifeq "$(HAVE_NEON)" "1" OBJS += cspace_neon.o else -CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s -ASFLAGS += -mcpu=arm926ej-s -mfloat-abi=softfp OBJS += cspace.o endif OBJS += vout_fb.o EXT = a else -CFLAGS += `sdl-config --cflags` -m32 +CFLAGS += `sdl-config --cflags` OBJS += vout_sdl.o -EXT = x86.a +EXT = $(ARCH).a endif +CFLAGS += $(PLUGIN_CFLAGS) TARGET = gpulib.$(EXT) -all: $(TARGET) +all: ../../config.mak $(TARGET) $(TARGET): $(OBJS) $(AR) crs $@ $^ clean: $(RM) $(TARGET) $(OBJS) + +../../config.mak: + @echo "Please run ./configure before running make!" + @exit 1 diff --git a/plugins/gpulib/gpulib.mak b/plugins/gpulib/gpulib.mak index 3a7f7cd7..c82607af 100644 --- a/plugins/gpulib/gpulib.mak +++ b/plugins/gpulib/gpulib.mak @@ -1,25 +1,16 @@ # depends on ARCH definition # always adding gpulib to deps in case cspace is needed +# users must include ../../config.mak LDFLAGS += -shared +CFLAGS += $(PLUGIN_CFLAGS) ifeq "$(ARCH)" "arm" - ARM_CORTEXA8 ?= 1 - ifeq "$(ARM_CORTEXA8)" "1" - CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon \ - -fPIC -mfloat-abi=softfp - ASFLAGS += -mcpu=cortex-a8 -mfpu=neon - else - CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s - ASFLAGS += -mcpu=arm926ej-s -mfloat-abi=softfp - endif EXT = else - CFLAGS += -m32 - LDFLAGS += -m32 LDLIBS_GPULIB += `sdl-config --libs` - EXT = .x86 + EXT = .$(ARCH) endif -ifdef MAEMO +ifeq "$(PLATFORM)" "maemo" CFLAGS += -DMAEMO endif ifdef DEBUG @@ -35,7 +26,7 @@ ifdef BIN_GPULIB TARGETS += $(BIN_GPULIB)$(EXT) endif -all: $(TARGETS) +all: ../../config.mak $(TARGETS) ifdef BIN_STANDLALONE $(BIN_STANDLALONE)$(EXT): $(SRC) $(SRC_STANDALONE) $(GPULIB_A) @@ -52,3 +43,7 @@ $(GPULIB_A): clean: $(RM) $(TARGETS) + +../../config.mak: + @echo "Please run ./configure before running make!" + @exit 1 diff --git a/plugins/spunull/Makefile b/plugins/spunull/Makefile index f9b76ed9..eb81cab3 100644 --- a/plugins/spunull/Makefile +++ b/plugins/spunull/Makefile @@ -1,11 +1,13 @@ -CC = $(CROSS_COMPILE)gcc +all: ../../config.mak spunull.so -all: spunull.so - --include Makefile.local +include ../../config.mak spunull.so: spunull.c $(CC) $(CFLAGS) -shared -fPIC -ggdb -O2 -o $@ $^ clean: $(RM) spunull.so + +../../config.mak: + @echo "Please run ./configure before running make!" + @exit 1 -- 2.39.5