summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2011-01-07 16:30:08 +0800
committerChia-I Wu <[email protected]>2011-01-10 11:50:34 +0800
commitc98ea26e16b6458b4385d6558936696e4d099455 (patch)
treeca75d5d0355fe29e95375db7683e13e26e80fc5b /src/egl/drivers
parent15f0223931e32ef5ff82b39a2b6c433400edbd9d (diff)
egl: Make egl_dri2 and egl_glx built-in drivers.
These two drivers are small in size. Making them built-in should simplify packaging.
Diffstat (limited to 'src/egl/drivers')
-rw-r--r--src/egl/drivers/Makefile.template30
-rw-r--r--src/egl/drivers/dri2/Makefile5
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c2
-rw-r--r--src/egl/drivers/glx/Makefile5
-rw-r--r--src/egl/drivers/glx/egl_glx.c2
5 files changed, 32 insertions, 12 deletions
diff --git a/src/egl/drivers/Makefile.template b/src/egl/drivers/Makefile.template
index 47709e3c59f..76dbe260c6b 100644
--- a/src/egl/drivers/Makefile.template
+++ b/src/egl/drivers/Makefile.template
@@ -2,6 +2,7 @@
#
# Drivers should define
#
+# EGL_BUILTIN, the driver is built-in or external
# EGL_DRIVER, the driver name
# EGL_SOURCES, the driver sources
# EGL_INCLUDES, the include pathes
@@ -12,32 +13,45 @@
#
-EGL_DRIVER_PATH = $(TOP)/$(LIB_DIR)/egl/$(EGL_DRIVER)
+EGL_DRIVER_PATH = $(TOP)/$(LIB_DIR)/egl/$(EGL_DRIVER).so
EGL_OBJECTS = $(EGL_SOURCES:.c=.o)
+# built-in or external
+ifeq ($(EGL_BUILTIN),true)
+EGL_TARGET = lib$(EGL_DRIVER).a
+EGL_INSTALL =
+else
+EGL_TARGET = $(EGL_DRIVER_PATH)
+EGL_INSTALL = install-so
+endif
-default: depend $(EGL_DRIVER_PATH)
+default: depend $(EGL_TARGET)
-$(EGL_DRIVER_PATH): $(EGL_DRIVER)
+$(EGL_DRIVER_PATH): $(EGL_DRIVER).so
@$(INSTALL) -d $(TOP)/$(LIB_DIR)/egl
$(INSTALL) $< $(TOP)/$(LIB_DIR)/egl
-$(EGL_DRIVER): $(EGL_OBJECTS) Makefile $(TOP)/src/egl/drivers/Makefile.template
- @$(MKLIB) -o $(EGL_DRIVER) -noprefix \
+$(EGL_DRIVER).so: $(EGL_OBJECTS) Makefile $(TOP)/src/egl/drivers/Makefile.template
+ @$(MKLIB) -o $(EGL_DRIVER).so -noprefix \
-linker '$(CC)' -ldflags '-L$(TOP)/$(LIB_DIR) $(LDFLAGS)' \
$(MKLIB_OPTIONS) \
$(EGL_OBJECTS) $(EGL_LIBS) -l$(EGL_LIB)
+lib$(EGL_DRIVER).a: $(EGL_OBJECTS) Makefile $(TOP)/src/egl/drivers/Makefile.template
+ @$(MKLIB) -o $(EGL_DRIVER) -static $(EGL_OBJECTS)
+
.c.o:
$(CC) -c $(EGL_INCLUDES) $(CFLAGS) $(EGL_CFLAGS) $< -o $@
-
-install: $(EGL_DRIVER_PATH)
+install-so: $(EGL_DRIVER_PATH)
$(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
$(MINSTALL) $(EGL_DRIVER_PATH) $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
+install: $(EGL_INSTALL)
+
clean:
- rm -f $(EGL_DRIVER)
+ rm -f $(EGL_DRIVER).so
+ rm -f lib$(EGL_DRIVER).a
rm -f $(EGL_OBJECTS)
rm -f depend depend.bak
diff --git a/src/egl/drivers/dri2/Makefile b/src/egl/drivers/dri2/Makefile
index ec4d1bcd9be..553ee8771f8 100644
--- a/src/egl/drivers/dri2/Makefile
+++ b/src/egl/drivers/dri2/Makefile
@@ -3,7 +3,7 @@
TOP = ../../../..
include $(TOP)/configs/current
-EGL_DRIVER = egl_dri2.so
+EGL_DRIVER = egl_dri2
EGL_SOURCES = egl_dri2.c
EGL_INCLUDES = \
@@ -17,4 +17,7 @@ EGL_INCLUDES = \
EGL_LIBS = $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB)
+EGL_CFLAGS = -D_EGL_MAIN=_eglBuiltInDriverDRI2
+EGL_BUILTIN = true
+
include ../Makefile.template
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 52232980207..8967969c924 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2372,7 +2372,7 @@ dri2_load(_EGLDriver *drv)
* Create a new _EGLDriver object and init its dispatch table.
*/
_EGLDriver *
-_eglMain(const char *args)
+_EGL_MAIN(const char *args)
{
struct dri2_egl_driver *dri2_drv;
diff --git a/src/egl/drivers/glx/Makefile b/src/egl/drivers/glx/Makefile
index 89981e6c3a7..a1e6b731fe9 100644
--- a/src/egl/drivers/glx/Makefile
+++ b/src/egl/drivers/glx/Makefile
@@ -3,7 +3,7 @@
TOP = ../../../..
include $(TOP)/configs/current
-EGL_DRIVER = egl_glx.so
+EGL_DRIVER = egl_glx
EGL_SOURCES = egl_glx.c
EGL_INCLUDES = \
@@ -13,4 +13,7 @@ EGL_INCLUDES = \
EGL_CFLAGS = $(X11_CFLAGS)
EGL_LIBS = $(X11_LIBS) $(DLOPEN_LIBS)
+EGL_CFLAGS += -D_EGL_MAIN=_eglBuiltInDriverGLX
+EGL_BUILTIN = true
+
include ../Makefile.template
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index db9109dacc5..5fce06d66df 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -1115,7 +1115,7 @@ fail:
* Create a new _EGLDriver object and init its dispatch table.
*/
_EGLDriver *
-_eglMain(const char *args)
+_EGL_MAIN(const char *args)
{
struct GLX_egl_driver *GLX_drv = CALLOC_STRUCT(GLX_egl_driver);