st/egl: One driver per hardware.
authorChia-I Wu <olv@lunarg.com>
Thu, 17 Jun 2010 15:45:41 +0000 (23:45 +0800)
committerChia-I Wu <olv@lunarg.com>
Tue, 29 Jun 2010 09:16:19 +0000 (17:16 +0800)
Merge multiple egl_<platform>_<pipe>.so into a single
egl_gallium_<pipe>.so.  The environment variable EGL_PLATFORM is now
used to modify the return value of _eglGetNativePlatform.

16 files changed:
src/egl/main/Makefile
src/egl/main/SConscript
src/egl/main/egldisplay.c
src/egl/main/egldisplay.h
src/egl/main/egldriver.c
src/egl/main/egldriver.h
src/gallium/state_trackers/egl/Makefile
src/gallium/state_trackers/egl/SConscript
src/gallium/state_trackers/egl/common/egl_g3d.c
src/gallium/state_trackers/egl/common/egl_g3d.h
src/gallium/state_trackers/egl/common/native.h
src/gallium/state_trackers/egl/fbdev/native_fbdev.c
src/gallium/state_trackers/egl/gdi/native_gdi.c
src/gallium/state_trackers/egl/kms/native_kms.c
src/gallium/state_trackers/egl/x11/native_x11.c
src/gallium/targets/Makefile.egl

index be27d9450f4bc5d64df43aff948baa7ec6e91188..3834a5dbfa187bec47d4e433d2909edc13985472 100644 (file)
@@ -51,8 +51,6 @@ OBJECTS = $(SOURCES:.c=.o)
 # use dl*() to load drivers
 LOCAL_CFLAGS = -D_EGL_OS_UNIX=1
 
-EGL_DEFAULT_PLATFORM = $(firstword $(EGL_PLATFORMS))
-
 # translate --with-egl-platforms to _EGLPlatformType
 EGL_NATIVE_PLATFORM=_EGL_INVALID_PLATFORM
 ifeq ($(firstword $(EGL_PLATFORMS)),x11)
@@ -67,7 +65,6 @@ endif
 
 LOCAL_CFLAGS += \
        -D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \
-       -D_EGL_DEFAULT_PLATFORM=\"$(EGL_DEFAULT_PLATFORM)\" \
        -D_EGL_DRIVER_SEARCH_DIR=\"$(EGL_DRIVER_INSTALL_DIR)\"
 
 .c.o:
index fad0671f38aacba45e8bb0024a4a2f4dec270351..69ad873bd6698b345fca8542925bb08b62424f13 100644 (file)
@@ -10,7 +10,6 @@ if env['platform'] != 'winddk':
 
        env.Append(CPPDEFINES = [
                '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS',
-               '_EGL_DEFAULT_PLATFORM=\\"gdi\\"',
                '_EGL_DRIVER_SEARCH_DIR=\\"\\"',
                '_EGL_OS_WINDOWS',
                'KHRONOS_DLL_EXPORTS',
index d666bdabe02a2093a8e4ba63cc669d016033e3d0..9980356c4aa4d594f547e993239662d6250fc3ce 100644 (file)
 #include "egllog.h"
 
 
+/**
+ * Return the native platform by parsing EGL_PLATFORM.
+ */
+static _EGLPlatformType
+_eglGetNativePlatformFromEnv(void)
+{
+   /* map --with-egl-platforms names to platform types */
+   static const struct {
+      _EGLPlatformType platform;
+      const char *name;
+   } egl_platforms[_EGL_NUM_PLATFORMS] = {
+      { _EGL_PLATFORM_WINDOWS, "gdi" },
+      { _EGL_PLATFORM_X11, "x11" },
+      { _EGL_PLATFORM_DRM, "kms" },
+      { _EGL_PLATFORM_FBDEV, "fbdev" }
+   };
+   _EGLPlatformType plat = _EGL_INVALID_PLATFORM;
+   const char *plat_name;
+   EGLint i;
+
+   plat_name = getenv("EGL_PLATFORM");
+   /* try deprecated env variable */
+   if (!plat_name || !plat_name[0])
+      plat_name = getenv("EGL_DISPLAY");
+   if (!plat_name || !plat_name[0])
+      return _EGL_INVALID_PLATFORM;
+
+   for (i = 0; i < _EGL_NUM_PLATFORMS; i++) {
+      if (strcmp(egl_platforms[i].name, plat_name) == 0) {
+         plat = egl_platforms[i].platform;
+         break;
+      }
+   }
+
+   return plat;
+}
+
+
+/**
+ * Return the native platform.  It is the platform of the EGL native types.
+ */
+_EGLPlatformType
+_eglGetNativePlatform(void)
+{
+   static _EGLPlatformType native_platform = _EGL_INVALID_PLATFORM;
+
+   if (native_platform == _EGL_INVALID_PLATFORM) {
+      native_platform = _eglGetNativePlatformFromEnv();
+      if (native_platform == _EGL_INVALID_PLATFORM)
+         native_platform = _EGL_NATIVE_PLATFORM;
+   }
+
+   return native_platform;
+}
+
+
 /**
  * Finish display management.
  */
index 0b325f7cf0314f006c5ce774f353f613705ef3b5..5a1caa9cc6571434f5afc862ecb561a700093e8b 100644 (file)
@@ -101,6 +101,10 @@ struct _egl_display
 };
 
 
+extern _EGLPlatformType
+_eglGetNativePlatform(void);
+
+
 extern void
 _eglFiniDisplay(void);
 
index db7b4a7471e32b641249a8350964514b28d59019..c65df286454859a59520679dfe886c1c4f53ebee 100644 (file)
@@ -39,7 +39,7 @@
 
 /* XXX Need to decide how to do dynamic name lookup on Windows */
 static const char *DefaultDriverNames[] = {
-   "egl_gdi_swrast"
+   "egl_gallium_swrast"
 };
 
 typedef HMODULE lib_handle;
@@ -464,36 +464,16 @@ _eglPreloadUserDriver(void)
 
 
 /**
- * Preload platform drivers.
- *
- * Platform drivers are a set of drivers that support a certain window system.
- * The window system may be specified by EGL_PLATFORM.
+ * Preload Gallium drivers.
  *
  * FIXME This makes libEGL a memory hog if an user driver is not specified and
- * there are many platform drivers.
+ * there are many Gallium drivers
  */
 static EGLBoolean
-_eglPreloadPlatformDrivers(void)
+_eglPreloadGalliumDrivers(void)
 {
-   const char *dpy;
-   char prefix[32];
-   int ret;
-
-   dpy = getenv("EGL_PLATFORM");
-   /* try deprecated env variable */
-   if (!dpy || !dpy[0])
-      dpy = getenv("EGL_DISPLAY");
-   if (!dpy || !dpy[0])
-      dpy = _EGL_DEFAULT_PLATFORM;
-   if (!dpy || !dpy[0])
-      return EGL_FALSE;
-
-   ret = _eglsnprintf(prefix, sizeof(prefix), "egl_%s_", dpy);
-   if (ret < 0 || ret >= sizeof(prefix))
-      return EGL_FALSE;
-
    return (_eglPreloadForEach(_eglGetSearchPath(),
-            _eglLoaderPattern, (void *) prefix) > 0);
+            _eglLoaderPattern, (void *) "egl_gallium_") > 0);
 }
 
 
@@ -518,7 +498,7 @@ _eglPreloadDrivers(void)
    }
 
    loaded = (_eglPreloadUserDriver() ||
-             _eglPreloadPlatformDrivers());
+             _eglPreloadGalliumDrivers());
 
    _eglUnlockMutex(_eglGlobal.Mutex);
 
@@ -580,16 +560,6 @@ _eglLoadDefaultDriver(EGLDisplay dpy, EGLint *major, EGLint *minor)
 }
 
 
-/**
- * Return the native platform.  It is the platform of the EGL native types.
- */
-_EGLPlatformType
-_eglGetNativePlatform(void)
-{
-   return _EGL_NATIVE_PLATFORM;
-}
-
-
 /**
  * Plug all the available fallback routines into the given driver's
  * dispatch table.
index 6a5237476473b25fc0849bf3761b12f1c16e7e51..8b34c43b924dcba4873dbf479ea163cbd1b9815d 100644 (file)
@@ -3,7 +3,6 @@
 
 
 #include "egltypedefs.h"
-#include "egldisplay.h"
 #include "eglapi.h"
 
 
@@ -89,10 +88,6 @@ extern _EGLDriver *
 _eglLoadDefaultDriver(EGLDisplay dpy, EGLint *major, EGLint *minor);
 
 
-extern _EGLPlatformType
-_eglGetNativePlatform(void);
-
-
 PUBLIC void
 _eglInitDriverFallbacks(_EGLDriver *drv);
 
index fec178ffb30a2e39796b2cb0350d60f2d9d3194e..7bb53492b4926c738fc78f700bf5106df050eae7 100644 (file)
@@ -38,23 +38,30 @@ fbdev_OBJECTS = $(fbdev_SOURCES:.c=.o)
 
 ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(kms_INCLUDES) $(fbdev_INCLUDES)
 ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(kms_SOURCES) $(fbdev_SOURCES)
-ALL_OBJECTS = $(common_OBJECTS) $(x11_OBJECTS) $(kms_OBJECTS) $(fbdev_OBJECTS)
 
-##### TARGETS #####
-
-EGL_PLATFORMS_MODS = $(foreach plat, $(EGL_PLATFORMS), libegl$(plat).a)
-
-default: depend $(EGL_PLATFORMS_MODS)
+EGL_OBJECTS = $(common_OBJECTS)
+EGL_CPPFLAGS = $(common_INCLUDES)
+
+# add backends
+ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
+EGL_OBJECTS += $(x11_OBJECTS)
+EGL_CPPFLAGS += -DHAVE_X11_BACKEND
+endif
+ifneq ($(findstring kms, $(EGL_PLATFORMS)),)
+EGL_OBJECTS += $(kms_OBJECTS)
+EGL_CPPFLAGS += -DHAVE_KMS_BACKEND
+endif
+ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
+EGL_OBJECTS += $(fbdev_OBJECTS)
+EGL_CPPFLAGS += -DHAVE_FBDEV_BACKEND
+endif
 
+##### TARGETS #####
 
-libeglx11.a: $(x11_OBJECTS) $(common_OBJECTS) Makefile
-       $(MKLIB) -o eglx11 -static $(x11_OBJECTS) $(common_OBJECTS)
-
-libeglkms.a: $(kms_OBJECTS) $(common_OBJECTS) Makefile
-       $(MKLIB) -o eglkms -static $(kms_OBJECTS) $(common_OBJECTS)
+default: depend libegl.a
 
-libeglfbdev.a: $(fbdev_OBJECTS) $(common_OBJECTS) Makefile
-       $(MKLIB) -o eglfbdev -static $(fbdev_OBJECTS) $(common_OBJECTS)
+libegl.a: $(EGL_OBJECTS) Makefile
+       $(MKLIB) -o egl -static $(EGL_OBJECTS)
 
 depend: 
        rm -f depend
@@ -62,8 +69,8 @@ depend:
        $(MKDEP) $(MKDEP_OPTIONS) $(ALL_INCLUDES) $(ALL_SOURCES) 2> /dev/null
 
 clean:
-       rm -f $(ALL_OBJECTS)
-       rm -f $(EGL_PLATFORMS_MODS)
+       rm -f libegl.a
+       rm -f $(EGL_OBJECTS)
        rm -f depend depend.bak
 
 # Dummy target
@@ -72,16 +79,20 @@ install:
 
 ##### RULES #####
 
+define egl-cc
+$(CC) -c $(common_INCLUDES) $($(1)_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
+endef
+
 $(common_OBJECTS): %.o: %.c
-       $(CC) -c $(common_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
+       $(CC) -c $(EGL_CPPFLAGS) $(DEFINES) $(CFLAGS) $< -o $@
 
 $(x11_OBJECTS): %.o: %.c
-       $(CC) -c $(common_INCLUDES) $(x11_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
+       $(call egl-cc,x11)
 
 $(kms_OBJECTS): %.o: %.c
-       $(CC) -c $(common_INCLUDES) $(kms_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
+       $(call egl-cc,kms)
 
 $(fbdev_OBJECTS): %.o: %.c
-       $(CC) -c $(common_INCLUDES) $(fbdev_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
+       $(call egl-cc,fbdev)
 
 sinclude depend
index c4d01d6b2876412e48990c51d1e5d603d0ed3291..e71aec35b7351911433b8831fbbe17f8a21f971c 100644 (file)
@@ -12,6 +12,9 @@ if 'egl' in env['statetrackers']:
        '#/src/gallium/winsys/sw',
        '.',
     ])
+    env.Append(CPPDEFINES = [
+       'HAVE_GDI_BACKEND',
+    ])
 
     common_sources = [
         'common/egl_g3d.c',
index 6b54ee365c6fb89301c955e0e3f0bfdcd0fb1e63..36354dd42ed53a20cba78cdda306ce3719d36ec5 100644 (file)
@@ -66,14 +66,50 @@ egl_g3d_init_st(_EGLDriver *drv)
  * Get the native platform.
  */
 static const struct native_platform *
-egl_g3d_get_platform(_EGLDriver *drv)
+egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType plat)
 {
    struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
 
-   if (!gdrv->platform)
-      gdrv->platform = native_get_platform();
+   if (!gdrv->platforms[plat]) {
+      const char *plat_name = NULL;
+      const struct native_platform *nplat = NULL;
 
-   return gdrv->platform;
+      switch (plat) {
+      case _EGL_PLATFORM_WINDOWS:
+         plat_name = "Windows";
+#ifdef HAVE_GDI_BACKEND
+         nplat = native_get_gdi_platform();
+#endif
+         break;
+      case _EGL_PLATFORM_X11:
+         plat_name = "X11";
+#ifdef HAVE_X11_BACKEND
+         nplat = native_get_x11_platform();
+#endif
+         break;
+      case _EGL_PLATFORM_DRM:
+         plat_name = "DRM";
+#ifdef HAVE_KMS_BACKEND
+         nplat = native_get_kms_platform();
+#endif
+         break;
+      case _EGL_PLATFORM_FBDEV:
+         plat_name = "FBDEV";
+#ifdef HAVE_FBDEV_BACKEND
+         nplat = native_get_fbdev_platform();
+#endif
+         break;
+      default:
+         break;
+      }
+
+      if (!nplat)
+         _eglLog(_EGL_WARNING, "unsupported platform %s", plat_name);
+
+      gdrv->platforms[plat] = nplat;
+   }
+
+   return gdrv->platforms[plat];
 }
 
 /**
@@ -88,7 +124,7 @@ egl_g3d_get_probe_result(_EGLDriver *drv, _EGLDisplay *dpy)
    struct native_probe *nprobe;
    const struct native_platform *nplat;
 
-   nplat = egl_g3d_get_platform(drv);
+   nplat = egl_g3d_get_platform(drv, dpy->Platform);
    if (!nplat || !nplat->create_probe)
       return NATIVE_PROBE_UNKNOWN;
 
@@ -484,7 +520,7 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
    /* the probe object is unlikely to be needed again */
    egl_g3d_destroy_probe(drv, dpy);
 
-   nplat = egl_g3d_get_platform(drv);
+   nplat = egl_g3d_get_platform(drv, dpy->Platform);
    if (!nplat)
       return EGL_FALSE;
 
index 26043169ff8aebebc3bd46bc7ed44a8cbcb98140..a498dcf6f637962a22a92ed4dbc8ff1810401ee7 100644 (file)
@@ -47,7 +47,7 @@ struct egl_g3d_driver {
    struct st_api *stapis[ST_API_COUNT];
    EGLint api_mask;
 
-   const struct native_platform *platform;
+   const struct native_platform *platforms[_EGL_NUM_PLATFORMS];
    EGLint probe_key;
 };
 
index 941adfc03ff9ff694b996836432c9e0a3df31e20..c4d23bf54157b21bda3eaea962ce51ec2f15caf5 100644 (file)
@@ -229,6 +229,15 @@ struct native_platform {
 };
 
 const struct native_platform *
-native_get_platform(void);
+native_get_gdi_platform(void);
+
+const struct native_platform *
+native_get_x11_platform(void);
+
+const struct native_platform *
+native_get_kms_platform(void);
+
+const struct native_platform *
+native_get_fbdev_platform(void);
 
 #endif /* _NATIVE_H_ */
index ffd32fa46e5678960f18a87df4a359c1524e6526..c0bc7b2462d97683ec3ea5386fc8783785970814 100644 (file)
@@ -458,7 +458,7 @@ static const struct native_platform fbdev_platform = {
 };
 
 const struct native_platform *
-native_get_platform(void)
+native_get_fbdev_platform(void)
 {
    return &fbdev_platform;
 }
index ba4ddff23202855821db9451b42cc37c2aa7df45..4ec229a3f2a2602629bb6c4066c38919b173112a 100644 (file)
@@ -394,7 +394,7 @@ static const struct native_platform gdi_platform = {
 };
 
 const struct native_platform *
-native_get_platform(void)
+native_get_gdi_platform(void)
 {
    return &gdi_platform;
 }
index 8ee80996a4ff051247ec7aaab48b3f2290775fca..dd4ea71140592833a08aec44ed095c822bd490d5 100644 (file)
@@ -800,7 +800,7 @@ kms_init_platform(struct native_platform *nplat)
 static struct native_platform kms_platform;
 
 const struct native_platform *
-native_get_platform(void)
+native_get_kms_platform(void)
 {
    kms_init_platform(&kms_platform);
    return &kms_platform;
index 6c0201c26f9835c156ee9ee886b02ff96adc3119..7eec563bdfe1ba5f248d5a9fa830a98e933091f0 100644 (file)
@@ -149,7 +149,7 @@ x11_init_platform(struct native_platform *nplat)
 static struct native_platform x11_platform;
 
 const struct native_platform *
-native_get_platform(void)
+native_get_x11_platform(void)
 {
    x11_init_platform(&x11_platform);
    return &x11_platform;
index 315856014b72293e6226b2d23ff9abd791818a1c..7934f257205b72ba6c696f2cda04c00e8235796b 100644 (file)
 EGL_DRIVER_OBJECTS = $(EGL_DRIVER_SOURCES:.c=.o)
 
 common_LIBS = -ldrm -lm -ldl
-
-# ximage backend calls gallium_wrap_screen, which requires libidentity.a and
-# libtrace.a
-x11_ST = $(TOP)/src/gallium/state_trackers/egl/libeglx11.a \
-        $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a \
-        $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
-        $(TOP)/src/gallium/drivers/identity/libidentity.a \
-        $(TOP)/src/gallium/drivers/trace/libtrace.a \
-        $(TOP)/src/gallium/drivers/rbug/librbug.a
-
-x11_LIBS = $(common_LIBS) -lX11 -lXext -lXfixes
-
-kms_ST = $(TOP)/src/gallium/state_trackers/egl/libeglkms.a
-kms_LIBS = $(common_LIBS)
-
-fbdev_ST = \
-       $(TOP)/src/gallium/state_trackers/egl/libeglfbdev.a \
-       $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a \
+common_ST = \
+       $(TOP)/src/gallium/state_trackers/egl/libegl.a \
        $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
        $(TOP)/src/gallium/drivers/identity/libidentity.a \
        $(TOP)/src/gallium/drivers/trace/libtrace.a \
        $(TOP)/src/gallium/drivers/rbug/librbug.a
-fbdev_LIBS = $(common_LIBS)
 
 ifeq ($(MESA_LLVM),1)
-x11_ST += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
-x11_LIBS += $(LLVM_LIBS)
-fbdev_ST += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
-fbdev_LIBS += $(LLVM_LIBS)
+common_ST += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
+common_LIBS += $(LLVM_LIBS)
 LDFLAGS += $(LLVM_LDFLAGS)
 endif
 
+ifeq ($(findstring x11, $(EGL_PLATFORMS)),x11)
+common_LIBS += -lX11 -lXext -lXfixes
+common_ST += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
+endif
+
+ifeq ($(findstring kms, $(EGL_PLATFORMS)),kms)
+endif
+
+ifeq ($(findstring fbdev, $(EGL_PLATFORMS)),fbdev)
+common_ST += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a
+endif
+
 ### Include directories
 INCLUDES = \
        -I$(TOP)/include \
@@ -62,47 +55,32 @@ INCLUDES = \
 
 ##### TARGETS #####
 
-ifeq ($(EGL_DRIVER_NAME),swrast)
-EGL_PLATFORMS := $(filter-out kms, $(EGL_PLATFORMS))
-else
-EGL_PLATFORMS := $(filter-out fbdev, $(EGL_PLATFORMS))
-endif
-
-EGL_PLATFORM_DRIVERS = $(foreach plat, $(EGL_PLATFORMS), egl_$(plat)_$(EGL_DRIVER_NAME).so)
+EGL_LIB_DIR = $(TOP)/$(LIB_DIR)/egl
 
-EGL_PLATFORM_LIBS = $(foreach drv, $(EGL_PLATFORM_DRIVERS), $(TOP)/$(LIB_DIR)/egl/$(drv))
-
-default: $(EGL_PLATFORM_LIBS)
-
-$(EGL_PLATFORM_LIBS): $(TOP)/$(LIB_DIR)/egl/%.so: %.so
-       @$(INSTALL) -d $(TOP)/$(LIB_DIR)/egl
-       $(INSTALL) $< $(TOP)/$(LIB_DIR)/egl
-
-define mklib-egl
-$(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-       $(MKLIB_OPTIONS) $(EGL_DRIVER_OBJECTS) \
-       -Wl,--start-group $($(1)_ST) $(EGL_DRIVER_PIPES) \
-       $(GALLIUM_AUXILIARIES) -Wl,--end-group \
-       $($(1)_LIBS) $(EGL_DRIVER_LIBS) -L$(TOP)/$(LIB_DIR) -l$(EGL_LIB)
-endef
+# do not build the driver if the platform is KMS only and the driver is swrast
+ifneq ($(EGL_PLATFORMS)-$(EGL_DRIVER_NAME),kms-swrast)
+EGL_DRIVER = egl_gallium_$(EGL_DRIVER_NAME).so
+endif
 
-egl_x11_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(x11_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
-       $(call mklib-egl,x11)
+default: $(EGL_LIB_DIR)/$(EGL_DRIVER)
 
-egl_kms_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(kms_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
-       $(call mklib-egl,kms)
+$(EGL_LIB_DIR)/$(EGL_DRIVER): $(EGL_DRIVER)
+       @$(INSTALL) -d $(EGL_LIB_DIR)
+       $(INSTALL) $< $(EGL_LIB_DIR)
 
-egl_fbdev_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(fbdev_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
-       $(call mklib-egl,fbdev)
+$(EGL_DRIVER): $(EGL_DRIVER_OBJECTS) $(common_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
+       $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+               $(MKLIB_OPTIONS) $(EGL_DRIVER_OBJECTS) \
+               -Wl,--start-group $(common_ST) $(EGL_DRIVER_PIPES) \
+               $(GALLIUM_AUXILIARIES) -Wl,--end-group \
+               $(common_LIBS) $(EGL_DRIVER_LIBS) -L$(TOP)/$(LIB_DIR) -l$(EGL_LIB)
 
 clean:
        -rm -f $(EGL_DRIVER_OBJECTS)
-       -rm -f $(EGL_PLATFORM_DRIVERS)
+       -rm -f $(EGL_DRIVER)
 
-install: $(EGL_PLATFORM_LIBS)
+install: $(EGL_LIB_DIR)/$(EGL_DRIVER)
        $(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
-       for lib in $(EGL_PLATFORM_LIBS); do \
-               $(MINSTALL) -m 755 "$$lib" $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR); \
-       done
+       $(MINSTALL) -m 755 $< $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
 
 depend: