Module: Mesa
Branch: master
Commit: 9767d3b5ad08640737e9d8dd4feb046478ae1f4b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9767d3b5ad08640737e9d8dd4feb046478ae1f4b

Author: Chia-I Wu <o...@lunarg.com>
Date:   Sun Dec 26 18:02:59 2010 +0800

glapi: Fix OpenGL ES 1.1 and 2.0 interop.

Move _glapi_* symbols from libGLESv1_CM.so and libGLESv2.so to
libglapi.so.  This makes sure an app will get only one copy of glapi in
its address space.

Note that with this change, libGLES* and libglapi must be built from the
same source tree and distributed together.  This requirement comes from
the fact that the dispatch offsets used by these libraries are
re-assigned whenever GLAPI XMLs are changed.

---

 configs/autoconf.in            |    4 +
 configs/default                |    4 +
 configure.ac                   |   13 ++++
 src/mapi/es1api/Makefile       |  128 ++++++++++++++++++---------------------
 src/mapi/glapi/gen-es/Makefile |   61 +++++++++----------
 src/mapi/shared-glapi/Makefile |   61 +++++++++++++++++++
 6 files changed, 171 insertions(+), 100 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index ff5ea6f..93923c8 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -65,6 +65,7 @@ OSMESA_LIB = @OSMESA_LIB@
 GLESv1_CM_LIB = GLESv1_CM
 GLESv2_LIB = GLESv2
 VG_LIB = OpenVG
+GLAPI_LIB = glapi
 
 # Library names (actual file names)
 GL_LIB_NAME = @GL_LIB_NAME@
@@ -76,6 +77,7 @@ EGL_LIB_NAME = @EGL_LIB_NAME@
 GLESv1_CM_LIB_NAME = @GLESv1_CM_LIB_NAME@
 GLESv2_LIB_NAME = @GLESv2_LIB_NAME@
 VG_LIB_NAME = @VG_LIB_NAME@
+GLAPI_LIB_NAME = @GLAPI_LIB_NAME@
 
 # Globs used to install the lib and all symlinks
 GL_LIB_GLOB = @GL_LIB_GLOB@
@@ -87,6 +89,7 @@ EGL_LIB_GLOB = @EGL_LIB_GLOB@
 GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@
 GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@
 VG_LIB_GLOB = @VG_LIB_GLOB@
+GLAPI_LIB_GLOB = @GLAPI_LIB_GLOB@
 
 # Directories to build
 LIB_DIR = @LIB_DIR@
@@ -129,6 +132,7 @@ APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@
 GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv1_CM_LIB_DEPS@
 GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@
 VG_LIB_DEPS = $(EXTRA_LIB_PATH) @VG_LIB_DEPS@
+GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) @GLAPI_LIB_DEPS@
 
 # DRI dependencies
 DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
diff --git a/configs/default b/configs/default
index b969415..9030cf5 100644
--- a/configs/default
+++ b/configs/default
@@ -59,6 +59,7 @@ EGL_LIB = EGL
 GLESv1_CM_LIB = GLESv1_CM
 GLESv2_LIB = GLESv2
 VG_LIB = OpenVG
+GLAPI_LIB = glapi
 
 
 # Library names (actual file names)
@@ -71,6 +72,7 @@ EGL_LIB_NAME = lib$(EGL_LIB).so
 GLESv1_CM_LIB_NAME = lib$(GLESv1_CM_LIB).so
 GLESv2_LIB_NAME = lib$(GLESv2_LIB).so
 VG_LIB_NAME = lib$(VG_LIB).so
+GLAPI_LIB_NAME = lib$(GLAPI_LIB).so
 
 # globs used to install the lib and all symlinks
 GL_LIB_GLOB = $(GL_LIB_NAME)*
@@ -82,6 +84,7 @@ EGL_LIB_GLOB = $(EGL_LIB_NAME)*
 GLESv1_CM_LIB_GLOB = $(GLESv1_CM_LIB_NAME)*
 GLESv2_LIB_GLOB = $(GLESv2_LIB_NAME)*
 VG_LIB_GLOB = $(VG_LIB_NAME)*
+GLAPI_LIB_GLOB = $(GLAPI_LIB_NAME)*
 
 TALLOC_LIBS = `pkg-config --libs talloc`
 TALLOC_CFLAGS = `pkg-config --cflags talloc`
@@ -130,6 +133,7 @@ APP_LIB_DEPS    = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) 
-l$(GLUT_LIB) -l$(GLU_LI
 GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
 GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
 VG_LIB_DEPS    = $(EXTRA_LIB_PATH) -lpthread
+GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
 
 # Program dependencies - specific GL/glut libraries added in Makefiles
 APP_LIB_DEPS = -lm
diff --git a/configure.ac b/configure.ac
index f51ad9e..ba5e12e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -316,6 +316,7 @@ EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
 GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
 GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
 VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
+GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
 
 
GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
 
GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
@@ -327,6 +328,7 @@ 
EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTE
 
GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
 
GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
 
VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
+GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
 
 AC_SUBST([GL_LIB_NAME])
 AC_SUBST([GLU_LIB_NAME])
@@ -337,6 +339,7 @@ AC_SUBST([EGL_LIB_NAME])
 AC_SUBST([GLESv1_CM_LIB_NAME])
 AC_SUBST([GLESv2_LIB_NAME])
 AC_SUBST([VG_LIB_NAME])
+AC_SUBST([GLAPI_LIB_NAME])
 
 AC_SUBST([GL_LIB_GLOB])
 AC_SUBST([GLU_LIB_GLOB])
@@ -347,6 +350,7 @@ AC_SUBST([EGL_LIB_GLOB])
 AC_SUBST([GLESv1_CM_LIB_GLOB])
 AC_SUBST([GLESv2_LIB_GLOB])
 AC_SUBST([VG_LIB_GLOB])
+AC_SUBST([GLAPI_LIB_GLOB])
 
 dnl
 dnl Arch/platform-specific settings
@@ -585,6 +589,13 @@ GALLIUM_WINSYS_DIRS="sw"
 GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug noop identity"
 GALLIUM_STATE_TRACKERS_DIRS=""
 
+# build shared-glapi if OpenGL ES is enabled
+case "x$enable_gles1$enable_gles2" in
+x*yes*)
+    CORE_DIRS="$CORE_DIRS mapi/shared-glapi"
+    ;;
+esac
+
 # build glapi if OpenGL is enabled
 if test "x$enable_opengl" = xyes; then
     CORE_DIRS="$CORE_DIRS mapi/glapi"
@@ -792,6 +803,8 @@ AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
 AC_SUBST([GLESv2_LIB_DEPS])
 AC_SUBST([GLESv2_PC_LIB_PRIV])
 
+GLAPI_LIB_DEPS="-lpthread"
+AC_SUBST([GLAPI_LIB_DEPS])
 
 AC_SUBST([HAVE_XF86VIDMODE])
 
diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile
index 3659d64..4fa68e5 100644
--- a/src/mapi/es1api/Makefile
+++ b/src/mapi/es1api/Makefile
@@ -7,27 +7,27 @@ include $(TOP)/configs/current
 ifeq ($(ES),)
 ES := es1
 
-GLES_HEADER := GLES
-GLES_PC := glesv1_cm.pc
-
-GLES_LIB := $(GLESv1_CM_LIB)
-GLES_LIB_NAME := $(GLESv1_CM_LIB_NAME)
-GLES_LIB_GLOB := $(GLESv1_CM_LIB_GLOB)
-GLES_LIB_DEPS := $(GLESv1_CM_LIB_DEPS)
-GLES_LIB_MAJOR := 1
-GLES_LIB_MINOR := 1
-GLES_LIB_PATCH := 0
+esapi_HEADER := GLES
+esapi_PC := glesv1_cm.pc
+
+esapi_LIB := $(GLESv1_CM_LIB)
+esapi_LIB_NAME := $(GLESv1_CM_LIB_NAME)
+esapi_LIB_GLOB := $(GLESv1_CM_LIB_GLOB)
+esapi_LIB_DEPS := $(GLESv1_CM_LIB_DEPS)
+esapi_LIB_MAJOR := 1
+esapi_LIB_MINOR := 1
+esapi_LIB_PATCH := 0
 else
-GLES_HEADER := GLES2
-GLES_PC := glesv2.pc
-
-GLES_LIB := $(GLESv2_LIB)
-GLES_LIB_NAME := $(GLESv2_LIB_NAME)
-GLES_LIB_GLOB := $(GLESv2_LIB_GLOB)
-GLES_LIB_DEPS := $(GLESv2_LIB_DEPS)
-GLES_LIB_MAJOR := 2
-GLES_LIB_MINOR := 0
-GLES_LIB_PATCH := 0
+esapi_HEADER := GLES2
+esapi_PC := glesv2.pc
+
+esapi_LIB := $(GLESv2_LIB)
+esapi_LIB_NAME := $(GLESv2_LIB_NAME)
+esapi_LIB_GLOB := $(GLESv2_LIB_GLOB)
+esapi_LIB_DEPS := $(GLESv2_LIB_DEPS)
+esapi_LIB_MAJOR := 2
+esapi_LIB_MINOR := 0
+esapi_LIB_PATCH := 0
 endif
 
 ESAPI = $(ES)api
@@ -37,51 +37,40 @@ MAPI := $(TOP)/src/mapi/mapi
 # directory for generated sources/headers
 GEN := glapi
 
-include $(GLAPI)/sources.mak
-GLAPI_OBJECTS := $(GLAPI_SOURCES:.c=.o)
-GLAPI_SOURCES := $(addprefix $(GLAPI)/, $(GLAPI_SOURCES))
-GLAPI_ASM_OBJECTS := $(GLAPI_ASM_SOURCES:.S=.o)
-GLAPI_ASM_SOURCES := $(addprefix $(GEN)/, $(GLAPI_ASM_SOURCES))
+esapi_CPPFLAGS := \
+       -I$(TOP)/include \
+       -I$(TOP)/src/mapi \
+       -DMAPI_ABI_HEADER=\"$(ESAPI)/glapi_mapi_tmp.h\"
 
 include $(MAPI)/sources.mak
-MAPI_UTIL_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o)
-MAPI_UTIL_SOURCES := $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES))
+esapi_SOURCES := $(addprefix $(MAPI)/, $(MAPI_BRIDGE_SOURCES))
+esapi_OBJECTS := $(MAPI_BRIDGE_SOURCES:.c=.o)
+esapi_CPPFLAGS += -DMAPI_MODE_BRIDGE
 
-ESAPI_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_UTIL_OBJECTS)
-
-INCLUDE_DIRS = \
-       -I$(TOP)/include \
-       -I$(TOP)/src/mapi/$(ESAPI) \
-       -I$(TOP)/src/mapi \
-       -I$(TOP)/src/mesa
+esapi_LIB_DEPS := -L$(TOP)/$(LIB_DIR) -l$(GLAPI_LIB) $(esapi_LIB_DEPS)
 
 .PHONY: default
-default: depend $(TOP)/$(LIB_DIR)/$(GLES_LIB_NAME)
-
-$(TOP)/$(LIB_DIR)/$(GLES_LIB_NAME): $(ESAPI_OBJECTS)
-       $(MKLIB) -o $(GLES_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-               -major $(GLES_LIB_MAJOR) \
-               -minor $(GLES_LIB_MINOR) \
-               -patch $(GLES_LIB_PATCH) \
-               -id $(INSTALL_LIB_DIR)/lib$(GLES_LIB).$(GLES_LIB_MAJOR).dylib \
+default: depend $(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME)
+
+$(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME): $(esapi_OBJECTS)
+       $(MKLIB) -o $(esapi_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+               -major $(esapi_LIB_MAJOR) \
+               -minor $(esapi_LIB_MINOR) \
+               -patch $(esapi_LIB_PATCH) \
+               -id $(INSTALL_LIB_DIR)/lib$(esapi_LIB).$(esapi_LIB_MAJOR).dylib 
\
                $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
-               $(ESAPI_OBJECTS) $(GLES_LIB_DEPS)
+               $(esapi_OBJECTS) $(esapi_LIB_DEPS)
 
 # not used, but kept for completeness
-lib$(ESAPI).a: $(ESAPI_OBJECTS)
-       @$(MKLIB) -o $(ESAPI) -static $(ESAPI_OBJECTS)
-
-$(GLAPI_OBJECTS): %.o: $(GLAPI)/%.c
-       $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@
+lib$(ESAPI).a: $(esapi_OBJECTS)
+       @$(MKLIB) -o $(ESAPI) -static $(esapi_OBJECTS)
 
-$(GLAPI_ASM_OBJECTS): %.o: $(GEN)/%.S
-       $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
+$(esapi_OBJECTS): %.o: $(MAPI)/%.c
+       $(CC) -c $(esapi_CPPFLAGS) $(CFLAGS) $< -o $@
 
-$(MAPI_UTIL_OBJECTS): %.o: $(MAPI)/%.c
-       $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@
-
-$(GLAPI_SOURCES) $(GLAPI_ASM_SOURCES): | glapi-stamp
+$(esapi_SOURCES): | glapi-stamp
 
+.PHONY: glapi-stamp
 glapi-stamp:
        @# generate sources/headers
        @$(MAKE) -C $(GLAPI)/gen-es $(ES)
@@ -89,10 +78,10 @@ glapi-stamp:
 
 .PHONY: clean
 clean:
-       -rm -f $(GLES_PC)
-       -rm -f $(TOP)/$(LIB_DIR)/$(GLES_LIB_NAME)
+       -rm -f $(esapi_PC)
+       -rm -f $(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME)
        -rm -f lib$(ESAPI).a
-       -rm -f $(ESAPI_OBJECTS)
+       -rm -f $(esapi_OBJECTS)
        -rm -f depend depend.bak
        -rm -f glapi-stamp
        @# clean generated sources/headers
@@ -118,27 +107,28 @@ pcedit-es2 = \
        -e 's,@GLESv2_PC_CFLAGS@,$(GLESv2_PC_CFLAGS),' \
        -e 's,@GLESv2_LIB@,$(GLESv2_LIB),'
 
-$(GLES_PC): $(GLES_PC).in
+$(esapi_PC): $(esapi_PC).in
        @sed $(pcedit-$(ES)) $< > $@
 
 install-headers:
-       $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/$(GLES_HEADER)
-       $(INSTALL) -m 644 $(TOP)/include/$(GLES_HEADER)/*.h \
-               $(DESTDIR)$(INSTALL_INC_DIR)/$(GLES_HEADER)
+       $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/$(esapi_HEADER)
+       $(INSTALL) -m 644 $(TOP)/include/$(esapi_HEADER)/*.h \
+               $(DESTDIR)$(INSTALL_INC_DIR)/$(esapi_HEADER)
 
-install-pc: $(GLES_PC)
+install-pc: $(esapi_PC)
        $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
-       $(INSTALL) -m 644 $(GLES_PC) $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
+       $(INSTALL) -m 644 $(esapi_PC) $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
 
 install: default install-headers install-pc
        $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
-       $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLES_LIB_GLOB) \
+       $(MINSTALL) $(TOP)/$(LIB_DIR)/$(esapi_LIB_GLOB) \
                $(DESTDIR)$(INSTALL_LIB_DIR)
 
-depend: $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES)
+depend: $(esapi_SOURCES)
        @echo "running $(MKDEP)"
        @touch depend
-       @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(INCLUDE_DIRS) \
-               -DMAPI_MODE_UTIL $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) \
-               2>/dev/null | sed -e 's,^$(GLAPI)/,,' -e 's,^$(MAPI)/,,' \
-               > depend
+       @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(esapi_CPPFLAGS) \
+               $(esapi_SOURCES) 2>/dev/null | \
+               sed -e 's,^$(GLAPI)/,,' -e 's,^$(MAPI)/,,' > depend
+
+-include depend
diff --git a/src/mapi/glapi/gen-es/Makefile b/src/mapi/glapi/gen-es/Makefile
index 8375792..7a5bb35 100644
--- a/src/mapi/glapi/gen-es/Makefile
+++ b/src/mapi/glapi/gen-es/Makefile
@@ -1,18 +1,14 @@
 TOP = ../../../..
+MAPI = $(TOP)/src/mapi/mapi
 GLAPI = ../gen
 include $(TOP)/configs/current
 
 OUTPUTS :=                     \
-       glapi/glapitable.h      \
-       glapi/glapitemp.h       \
-       glapi/glprocs.h         \
-       glapi/glapi_sparc.S     \
-       glapi/glapi_x86-64.S    \
-       glapi/glapi_x86.S       \
+       glapi_mapi_tmp.h        \
        main/glapidispatch.h    \
        main/remap_helper.h
 
-COMMON = gl_XML.py glX_XML.py license.py typeexpr.py
+COMMON = gl_and_es_API.xml gl_XML.py glX_XML.py license.py typeexpr.py
 COMMON := $(addprefix $(GLAPI)/, $(COMMON))
 
 ES1_APIXML := es1_API.xml
@@ -28,41 +24,41 @@ ES2_DEPS = $(ES2_APIXML) base2_API.xml es2_EXT.xml 
es_EXT.xml \
 ES1_OUTPUTS := $(addprefix $(ES1_OUTPUT_DIR)/, $(OUTPUTS))
 ES2_OUTPUTS := $(addprefix $(ES2_OUTPUT_DIR)/, $(OUTPUTS))
 
-all: es1 es2
+SHARED_GLAPI_APIXML := $(GLAPI)/gl_and_es_API.xml
+SHARED_GLAPI_OUTPUT_DIR := $(TOP)/src/mapi/shared-glapi
+SHARED_GLAPI_DEPS := $(SHARED_GLAPI_APIXML)
+SHARED_GLAPI_OUTPUTS = $(SHARED_GLAPI_OUTPUT_DIR)/glapi_mapi_tmp.h
+
+all: es1 es2 shared-glapi
 
 es1: $(ES1_OUTPUTS)
 es2: $(ES2_OUTPUTS)
+shared-glapi: $(SHARED_GLAPI_OUTPUTS)
 
 $(ES1_OUTPUTS): APIXML := $(ES1_APIXML)
-$(ES2_OUTPUTS): APIXML := $(ES2_APIXML)
+$(ES1_OUTPUTS): PRINTER := es1api
 $(ES1_OUTPUTS): $(ES1_DEPS)
+
+$(ES2_OUTPUTS): APIXML := $(ES2_APIXML)
+$(ES2_OUTPUTS): PRINTER := es2api
 $(ES2_OUTPUTS): $(ES2_DEPS)
 
+$(SHARED_GLAPI_OUTPUTS): APIXML := $(SHARED_GLAPI_APIXML)
+$(SHARED_GLAPI_OUTPUTS): PRINTER := shared-glapi
+$(SHARED_GLAPI_OUTPUTS): $(SHARED_GLAPI_DEPS)
+
 define gen-glapi
        @mkdir -p $(dir $@)
        $(PYTHON2) $(PYTHON_FLAGS) $< -f $(APIXML) $(1) > $@
 endef
 
-%/glapidispatch.h: $(GLAPI)/gl_table.py $(COMMON)
-       $(call gen-glapi,-c -m remap_table)
-
-%/glapitable.h: $(GLAPI)/gl_table.py $(COMMON)
-       $(call gen-glapi,-c)
-
-%/glapitemp.h: $(GLAPI)/gl_apitemp.py $(COMMON)
-       $(call gen-glapi,-c)
-
-%/glprocs.h: $(GLAPI)/gl_procs.py $(COMMON)
-       $(call gen-glapi,-c)
-
-%/glapi_sparc.S: $(GLAPI)/gl_SPARC_asm.py $(COMMON)
-       $(call gen-glapi)
-
-%/glapi_x86-64.S: $(GLAPI)/gl_x86-64_asm.py $(COMMON)
-       $(call gen-glapi)
+%/glapi_mapi_tmp.h: $(MAPI)/mapi_abi.py $(COMMON)
+       @mkdir -p $(dir $@)
+       $(PYTHON2) $(PYTHON_FLAGS) $< \
+               --printer $(PRINTER) --mode lib $(GLAPI)/gl_and_es_API.xml > $@
 
-%/glapi_x86.S: $(GLAPI)/gl_x86_asm.py $(COMMON)
-       $(call gen-glapi)
+%/main/glapidispatch.h: $(GLAPI)/gl_table.py $(COMMON)
+       $(call gen-glapi,-c -m remap_table)
 
 %/main/remap_helper.h: $(GLAPI)/remap_helper.py $(COMMON)
        $(call gen-glapi)
@@ -81,12 +77,15 @@ verify_xml:
        @rm -f tmp.xml
 
 clean-es1:
-       -rm -rf $(ES1_OUTPUT_DIR)/glapi
+       -rm -f $(ES1_OUTPUTS)
        -rm -rf $(ES1_OUTPUT_DIR)/main
 
 clean-es2:
-       -rm -rf $(ES2_OUTPUT_DIR)/glapi
+       -rm -f $(ES2_OUTPUTS)
        -rm -rf $(ES2_OUTPUT_DIR)/main
 
-clean: clean-es1 clean-es2
+clean-shared-glapi:
+       -rm -f $(SHARED_GLAPI_OUTPUTS)
+
+clean: clean-es1 clean-es2 clean-shared-glapi
        -rm -f *~ *.pyc *.pyo
diff --git a/src/mapi/shared-glapi/Makefile b/src/mapi/shared-glapi/Makefile
new file mode 100644
index 0000000..b89c458
--- /dev/null
+++ b/src/mapi/shared-glapi/Makefile
@@ -0,0 +1,61 @@
+# src/mapi/shared-glapi/Makefile
+#
+# Used by OpenGL ES
+#
+
+TOP := ../../..
+include $(TOP)/configs/current
+
+GLAPI := $(TOP)/src/mapi/glapi
+MAPI := $(TOP)/src/mapi/mapi
+
+glapi_CPPFLAGS := \
+       -I$(TOP)/include \
+       -I$(TOP)/src/mapi \
+       -DMAPI_MODE_GLAPI \
+       -DMAPI_ABI_HEADER=\"shared-glapi/glapi_mapi_tmp.h\"
+
+include $(MAPI)/sources.mak
+glapi_SOURCES := $(addprefix $(MAPI)/, $(MAPI_GLAPI_SOURCES))
+glapi_OBJECTS := $(MAPI_GLAPI_SOURCES:.c=.o)
+
+.PHONY: default
+default: depend $(TOP)/$(LIB_DIR)/$(GLAPI_LIB_NAME)
+
+$(TOP)/$(LIB_DIR)/$(GLAPI_LIB_NAME): $(glapi_OBJECTS)
+       $(MKLIB) -o $(GLAPI_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+               -major 0 -minor 0 -patch 0 \
+               -id $(INSTALL_LIB_DIR)/lib$(GLAPI_LIB).0.dylib \
+               $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
+               $(glapi_OBJECTS) $(GLAPI_LIB_DEPS)
+
+$(glapi_OBJECTS): %.o: $(MAPI)/%.c
+       $(CC) -c $(glapi_CPPFLAGS) $(CFLAGS) $< -o $@
+
+$(glapi_SOURCES): glapi_mapi_tmp.h
+
+.PHONY: glapi_mapi_tmp.h
+glapi_mapi_tmp.h:
+       @$(MAKE) -C $(GLAPI)/gen-es shared-glapi
+
+.PHONY: clean
+clean:
+       -rm -f $(TOP)/$(LIB_DIR)/$(GLAPI_LIB_NAME)
+       -rm -f $(glapi_OBJECTS)
+       -rm -f depend depend.bak
+       @# clean generated sources/headers
+       @$(MAKE) -C $(GLAPI)/gen-es clean-shared-glapi
+
+install:
+       $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
+       $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLAPI_LIB_GLOB) \
+               $(DESTDIR)$(INSTALL_LIB_DIR)
+
+depend: $(glapi_SOURCES)
+       @echo "running $(MKDEP)"
+       @touch depend
+       @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(glapi_CPPFLAGS) \
+               $(glapi_SOURCES) 2>/dev/null | sed -e 's,^$(MAPI)/,,' \
+               > depend
+
+-include depend

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to