automatically build plugins
authornotaz <notasas@gmail.com>
Mon, 30 Apr 2012 21:39:05 +0000 (00:39 +0300)
committernotaz <notasas@gmail.com>
Sun, 27 May 2012 17:11:00 +0000 (20:11 +0300)
Makefile
configure
frontend/main.c
frontend/menu.c
plugins/gpulib/Makefile
plugins/gpulib/gpulib.mak
plugins/spunull/Makefile

index aa97b12..527ddd9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ endif
 #DRC_DBG = 1
 #PCNT = 1
 
 #DRC_DBG = 1
 #PCNT = 1
 
-all: config.mak $(TARGET)
+all: config.mak $(TARGET) plugins_
 
 ifneq ($(wildcard config.mak),)
 config.mak: ./configure
 
 ifneq ($(wildcard config.mak),)
 config.mak: ./configure
@@ -118,14 +118,14 @@ OBJS += maemo/hildon.o maemo/main.o
 maemo/%.o: maemo/%.c
 else
 OBJS += frontend/menu.o frontend/linux/in_evdev.o
 maemo/%.o: maemo/%.c
 else
 OBJS += frontend/menu.o frontend/linux/in_evdev.o
-OBJS += frontend/common/input.o frontend/linux/xenv.o
+OBJS += frontend/common/input.o
 
 ifeq "$(PLATFORM)" "generic"
 OBJS += frontend/plat_sdl.o frontend/common/in_sdl.o
 endif
 ifeq "$(PLATFORM)" "pandora"
 OBJS += frontend/linux/fbdev.o
 
 ifeq "$(PLATFORM)" "generic"
 OBJS += frontend/plat_sdl.o frontend/common/in_sdl.o
 endif
 ifeq "$(PLATFORM)" "pandora"
 OBJS += frontend/linux/fbdev.o
-OBJS += frontend/plat_omap.o
+OBJS += frontend/plat_omap.o frontend/linux/xenv.o
 OBJS += frontend/plat_pandora.o
 endif
 ifeq "$(PLATFORM)" "caanoo"
 OBJS += frontend/plat_pandora.o
 endif
 ifeq "$(PLATFORM)" "caanoo"
@@ -163,30 +163,44 @@ frontend/revision.h: FORCE
 $(TARGET): $(OBJS)
        $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map
 
 $(TARGET): $(OBJS)
        $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map
 
-clean: $(PLAT_CLEAN)
+clean: $(PLAT_CLEAN) clean_plugins
        $(RM) $(TARGET) $(OBJS) $(TARGET).map
 
 ifneq ($(PLUGINS),)
        $(RM) $(TARGET) $(OBJS) $(TARGET).map
 
 ifneq ($(PLUGINS),)
+plugins_: $(PLUGINS)
+
 $(PLUGINS):
 $(PLUGINS):
-       make -C plugins/gpulib/ clean
        make -C $(dir $@)
 
 clean_plugins:
        make -C plugins/gpulib/ clean
        for dir in $(PLUGINS) ; do \
                $(MAKE) -C $$(dirname $$dir) clean; done
        make -C $(dir $@)
 
 clean_plugins:
        make -C plugins/gpulib/ clean
        for dir in $(PLUGINS) ; do \
                $(MAKE) -C $$(dirname $$dir) clean; done
+else
+plugins_:
+clean_plugins:
 endif
 
 # ----------- release -----------
 
 VER ?= $(shell git describe master)
 
 endif
 
 # ----------- release -----------
 
 VER ?= $(shell git describe master)
 
+ifeq "$(PLATFORM)" "generic"
+OUT = pcsx_rearmed_$(VER)
+
+rel: pcsx $(PLUGINS) \
+               frontend/pandora/skin readme.txt COPYING
+       rm -rf $(OUT)
+       mkdir -p $(OUT)/plugins
+       mkdir -p $(OUT)/bios
+       cp -r $^ $(OUT)/
+       mv $(OUT)/*.so* $(OUT)/plugins/
+       zip -9 -r $(OUT).zip $(OUT)
+endif
+
 ifeq "$(PLATFORM)" "pandora"
 PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
 
 ifeq "$(PLATFORM)" "pandora"
 PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
 
-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 \
                frontend/pandora/picorestore frontend/pandora/skin readme.txt COPYING
 rel: pcsx $(PLUGINS) \
                frontend/pandora/pcsx.sh frontend/pandora/pcsx.pxml.templ frontend/pandora/pcsx.png \
                frontend/pandora/picorestore frontend/pandora/skin readme.txt COPYING
@@ -208,9 +222,6 @@ PLAT_CLEAN = caanoo_clean
 caanoo_clean:
        $(RM) frontend/320240/pollux_set
 
 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 \
 rel: pcsx $(PLUGINS) \
                frontend/320240/caanoo.gpe frontend/320240/pcsx26.png \
                frontend/320240/pcsxb.png frontend/320240/skin \
index 7cfd626..4aed26a 100755 (executable)
--- a/configure
+++ b/configure
@@ -28,6 +28,8 @@ platform_list="generic pandora maemo caanoo"
 platform="generic"
 sound_driver_list="oss alsa none"
 sound_driver="alsa"
 platform="generic"
 sound_driver_list="oss alsa none"
 sound_driver="alsa"
+plugins="plugins/spunull/spunull.so \
+plugins/dfxvideo/gpu_peops.so plugins/gpu_unai/gpu_unai.so"
 ram_fixed="no"
 drc_cache_base="no"
 have_armv6=""
 ram_fixed="no"
 drc_cache_base="no"
 have_armv6=""
@@ -219,6 +221,25 @@ EOF
   fi
 fi
 
   fi
 fi
 
+# check for GLES headers
+cat > $TMPC <<EOF
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+#include <EGL/egl.h>
+void *test(void) {
+  return eglGetDisplay( (EGLNativeDisplayType)0 );
+}
+EOF
+if compile_object; then
+  plugins="$plugins plugins/gpu-gles/gpu_gles.so"
+fi
+
+# short plugin list for display
+for p in $plugins; do
+  p1=`basename $p`
+  plugins_short="$p1 $plugins_short"
+done
+
 # set things that failed to autodetect to "no"
 test "x$have_armv6" != "x" || have_armv6="no"
 test "x$have_armv7" != "x" || have_armv7="no"
 # set things that failed to autodetect to "no"
 test "x$have_armv6" != "x" || have_armv6="no"
 test "x$have_armv7" != "x" || have_armv7="no"
@@ -227,6 +248,7 @@ test "x$have_arm_neon" != "x" || have_arm_neon="no"
 echo "architecture        $ARCH"
 echo "platform            $platform"
 echo "sound driver        $sound_driver"
 echo "architecture        $ARCH"
 echo "platform            $platform"
 echo "sound driver        $sound_driver"
+echo "plugins             $plugins_short"
 echo "C compiler          $CC"
 echo "C compiler flags    $CFLAGS"
 echo "linker flags        $LDFLAGS"
 echo "C compiler          $CC"
 echo "C compiler flags    $CFLAGS"
 echo "linker flags        $LDFLAGS"
@@ -263,6 +285,15 @@ none)
   echo "USE_NO_SOUND = 1" >> $config_mak
   ;;
 esac
   echo "USE_NO_SOUND = 1" >> $config_mak
   ;;
 esac
+if [ "$ARCH" = "arm" ]; then
+  echo "PLUGINS = $plugins" >> $config_mak
+else
+  echo -n "PLUGINS =" >> $config_mak
+  for p in $plugins; do
+    echo -n " ${p}.${ARCH}" >> $config_mak
+  done
+  echo >> $config_mak
+fi
 if [ "$have_armv6" = "yes" ]; then
   echo "HAVE_ARMV6 = 1" >> $config_mak
 fi
 if [ "$have_armv6" = "yes" ]; then
   echo "HAVE_ARMV6 = 1" >> $config_mak
 fi
index 4ebcf34..8df9036 100644 (file)
@@ -131,7 +131,7 @@ static void set_default_paths(void)
        strcpy(Config.Pad2, "builtin_pad");
        strcpy(Config.Net, "Disabled");
 #if defined(__arm__) && !defined(__ARM_ARCH_7A__) /* XXX */
        strcpy(Config.Pad2, "builtin_pad");
        strcpy(Config.Net, "Disabled");
 #if defined(__arm__) && !defined(__ARM_ARCH_7A__) /* XXX */
-       strcpy(Config.Gpu, "gpuPCSX4ALL.so");
+       strcpy(Config.Gpu, "gpu_unai.so");
 #endif
 
        snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "." PATCHES_DIR);
 #endif
 
        snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "." PATCHES_DIR);
@@ -732,7 +732,7 @@ void *SysLoadLibrary(const char *lib) {
        // convenience hack
        if (strstr(lib, ".x86") == NULL) {
                char name[MAXPATHLEN];
        // convenience hack
        if (strstr(lib, ".x86") == NULL) {
                char name[MAXPATHLEN];
-               snprintf(name, sizeof(name), "%s.x86", lib);
+               snprintf(name, sizeof(name), "%s.x86_64", lib);
                lib = name;
        }
 #endif
                lib = name;
        }
 #endif
index b3b7177..57156d5 100644 (file)
@@ -489,6 +489,10 @@ fail:
 
        menu_sync_config();
 
 
        menu_sync_config();
 
+       // caanoo old config compat hack
+       if (strcmp(Config.Gpu, "gpuPCSX4ALL.so") == 0)
+               strcpy(Config.Gpu, "gpu_unai.so");
+
        // sync plugins
        for (i = bios_sel = 0; bioses[i] != NULL; i++)
                if (strcmp(Config.Bios, bioses[i]) == 0)
        // sync plugins
        for (i = bios_sel = 0; bioses[i] != NULL; i++)
                if (strcmp(Config.Bios, bioses[i]) == 0)
index 2739e5c..4a45aa2 100644 (file)
@@ -23,15 +23,28 @@ OBJS += cspace.o
 endif
 CFLAGS += $(PLUGIN_CFLAGS)
 
 endif
 CFLAGS += $(PLUGIN_CFLAGS)
 
+# need to compile to another dir, same files are compiled
+# into main binary without PIC
+OBJS2 = $(patsubst %.o,obj/%.o,$(OBJS)) 
+
 TARGET = gpulib.$(EXT)
 
 TARGET = gpulib.$(EXT)
 
-all: ../../config.mak $(TARGET)
+all: ../../config.mak obj $(TARGET)
 
 
-$(TARGET): $(OBJS)
+$(TARGET): $(OBJS2)
        $(AR) crs $@ $^
 
        $(AR) crs $@ $^
 
+obj/%.o: %.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
+
+obj/%.o: %.s
+       $(AS) $(ASFLAGS) -o $@ $^
+
 clean:
 clean:
-       $(RM) $(TARGET) $(OBJS)
+       $(RM) $(TARGET) $(OBJS2)
+
+obj:
+       mkdir -p $@
 
 ../../config.mak:
        @echo "Please run ./configure before running make!"
 
 ../../config.mak:
        @echo "Please run ./configure before running make!"
index 48e73cb..349a0c8 100644 (file)
@@ -25,6 +25,9 @@ endif
 CC_STANDLALONE = $(CC)
 CC_GPULIB = $(CC)
 
 CC_STANDLALONE = $(CC)
 CC_GPULIB = $(CC)
 
+WD = $(shell pwd)
+PLUGINDIR = $(shell basename $(WD))
+
 all: ../../config.mak $(TARGETS)
 
 ifdef BIN_STANDLALONE
 all: ../../config.mak $(TARGETS)
 
 ifdef BIN_STANDLALONE
@@ -33,6 +36,7 @@ CC_STANDLALONE = $(CXX)
 endif
 $(BIN_STANDLALONE)$(EXT): $(SRC) $(SRC_STANDALONE) $(GPULIB_A)
        $(CC_STANDLALONE) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_STANDALONE)
 endif
 $(BIN_STANDLALONE)$(EXT): $(SRC) $(SRC_STANDALONE) $(GPULIB_A)
        $(CC_STANDLALONE) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_STANDALONE)
+       ln -fs $(PLUGINDIR)/$@ ../
 endif
 
 ifdef BIN_GPULIB
 endif
 
 ifdef BIN_GPULIB
@@ -41,6 +45,7 @@ CC_GPULIB = $(CXX)
 endif
 $(BIN_GPULIB)$(EXT): $(SRC) $(SRC_GPULIB) $(GPULIB_A)
        $(CC_GPULIB) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_GPULIB)
 endif
 $(BIN_GPULIB)$(EXT): $(SRC) $(SRC_GPULIB) $(GPULIB_A)
        $(CC_GPULIB) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_GPULIB)
+       ln -fs $(PLUGINDIR)/$@ ../
 endif
 
 $(GPULIB_A):
 endif
 
 $(GPULIB_A):
index eb81cab..dcd25ea 100644 (file)
@@ -1,12 +1,20 @@
-all: ../../config.mak spunull.so
-
 include ../../config.mak
 
 include ../../config.mak
 
-spunull.so: spunull.c
+ifneq "$(ARCH)" "arm"
+ EXT = .$(ARCH)
+endif
+TARGET = spunull.so$(EXT)
+WD = $(shell pwd)
+PLUGINDIR = $(shell basename $(WD))
+
+all: ../../config.mak $(TARGET)
+
+$(TARGET): spunull.c
        $(CC) $(CFLAGS) -shared -fPIC -ggdb -O2 -o $@ $^
        $(CC) $(CFLAGS) -shared -fPIC -ggdb -O2 -o $@ $^
+       ln -fs $(PLUGINDIR)/$(TARGET) ../
 
 clean:
 
 clean:
-       $(RM) spunull.so
+       $(RM) $(TARGET)
 
 ../../config.mak:
        @echo "Please run ./configure before running make!"
 
 ../../config.mak:
        @echo "Please run ./configure before running make!"