summaryrefslogtreecommitdiffstats
path: root/src/mapi/glapi/Makefile
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-12-26 18:24:13 +0800
committerChia-I Wu <[email protected]>2011-01-20 17:15:50 +0800
commite8c7d7598fb48237508f566204c71ba8f74d544f (patch)
tree7265601e9bddd2d5afd6e55637ae9efcf42b7fa2 /src/mapi/glapi/Makefile
parent9767d3b5ad08640737e9d8dd4feb046478ae1f4b (diff)
glapi: Fix OpenGL and OpenGL ES interop.
When --enable-shared-glapi is specified, libGL will share libglapi with OpenGL ES instead of defining its own copy of glapi. This makes sure an app will get only one copy of glapi in its address space. The new option is disabled by default. When enabled, libGL 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. For GLX, indirect rendering for has_different_protocol() functions is tricky. A has_different_protocol() function is assigned only one dispatch offset, yet each entry point needs a different protocol opcode. It cannot be supported by the shared glapi. The fix to this is to make glXGetProcAddress handle such functions specially before calling _glapi_get_proc_address. Note that these files are automatically generated/re-generated src/glx/indirect.c src/glx/indirect.h src/mapi/glapi/glapi_mapi_tmp.h
Diffstat (limited to 'src/mapi/glapi/Makefile')
-rw-r--r--src/mapi/glapi/Makefile58
1 files changed, 36 insertions, 22 deletions
diff --git a/src/mapi/glapi/Makefile b/src/mapi/glapi/Makefile
index a9ab07903c1..203a8abd018 100644
--- a/src/mapi/glapi/Makefile
+++ b/src/mapi/glapi/Makefile
@@ -8,46 +8,60 @@ TARGET = glapi
MAPI = $(TOP)/src/mapi/mapi
include sources.mak
-GLAPI_OBJECTS = $(GLAPI_SOURCES:.c=.o)
-GLAPI_ASM_OBJECTS = $(GLAPI_ASM_SOURCES:.S=.o)
-
include $(MAPI)/sources.mak
-MAPI_UTIL_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o)
-MAPI_UTIL_SOURCES := $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES))
-
-TARGET_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_UTIL_OBJECTS)
-INCLUDE_DIRS = \
+glapi_CPPFLAGS := \
-I$(TOP)/include \
-I$(TOP)/src/mapi \
- -I$(TOP)/src/mesa
+ -I$(TOP)/src/mesa \
+ -DMAPI_ABI_HEADER=\"glapi/glapi_mapi_tmp.h\"
+
+ifeq ($(SHARED_GLAPI),1)
+glapi_CPPFLAGS += -DMAPI_MODE_BRIDGE
+glapi_SOURCES := $(addprefix $(MAPI)/, $(MAPI_BRIDGE_SOURCES))
+
+glapi_GLAPI_OBJECTS :=
+glapi_ASM_OBJECTS :=
+glapi_MAPI_OBJECTS := $(MAPI_BRIDGE_SOURCES:.c=.o)
+else
+glapi_CPPFLAGS += -DMAPI_MODE_UTIL
+glapi_SOURCES := $(GLAPI_SOURCES) $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES))
+
+glapi_GLAPI_OBJECTS := $(GLAPI_SOURCES:.c=.o)
+glapi_ASM_OBJECTS := $(GLAPI_ASM_SOURCES:.S=.o)
+glapi_MAPI_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o)
+endif # SHARED_GLAPI
+
+glapi_OBJECTS := \
+ $(glapi_GLAPI_OBJECTS) \
+ $(glapi_ASM_OBJECTS) \
+ $(glapi_MAPI_OBJECTS)
default: depend lib$(TARGET).a
-lib$(TARGET).a: $(TARGET_OBJECTS)
- @$(MKLIB) -o $(TARGET) -static $(TARGET_OBJECTS)
+lib$(TARGET).a: $(glapi_OBJECTS)
+ @$(MKLIB) -o $(TARGET) -static $(glapi_OBJECTS)
-$(GLAPI_OBJECTS): %.o: %.c
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@
+$(glapi_GLAPI_OBJECTS): %.o: %.c
+ $(CC) -c $(glapi_CPPFLAGS) $(CFLAGS) $< -o $@
-$(GLAPI_ASM_OBJECTS): %.o: %.S
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
+$(glapi_ASM_OBJECTS): %.o: %.S
+ $(CC) -c $(glapi_CPPFLAGS) $(CFLAGS) $< -o $@
-$(MAPI_UTIL_OBJECTS): %.o: $(MAPI)/%.c
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@
+$(glapi_MAPI_OBJECTS): %.o: $(MAPI)/%.c
+ $(CC) -c $(glapi_CPPFLAGS) $(CFLAGS) $< -o $@
install:
clean:
- -rm -f $(TARGET_OBJECTS)
+ -rm -f $(glapi_OBJECTS)
-rm -f lib$(TARGET).a
-rm -f depend depend.bak
-depend: $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES)
+depend: $(glapi_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,^$(MAPI)/,,' > depend
+ @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(glapi_CPPFLAGS) \
+ $(glapi_SOURCES) 2>/dev/null | sed -e 's,^$(MAPI)/,,' > depend
-include depend