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@
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@
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@
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@
GLESv1_CM_LIB = GLESv1_CM
GLESv2_LIB = GLESv2
VG_LIB = OpenVG
+GLAPI_LIB = glapi
# Library names (actual file names)
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)*
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`
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
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}'*'
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])
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])
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
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"
AC_SUBST([GLESv2_LIB_DEPS])
AC_SUBST([GLESv2_PC_LIB_PRIV])
+GLAPI_LIB_DEPS="-lpthread"
+AC_SUBST([GLAPI_LIB_DEPS])
AC_SUBST([HAVE_XF86VIDMODE])
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
# 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)
.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
-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
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
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)
@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
--- /dev/null
+# 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