From 7048095513f8e91db26736eee0343b1a00d18f6f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 11 Dec 2010 03:27:54 +0800 Subject: [PATCH] mapi: Clean up sources.mk. Rename MAPI_GLAPI_SOURCES to MAPI_UTIL_SOURCES. Rename macro MAPI_GLAPI_CURRENT to MAPI_MODE_UTIL. Update the comments to make it clear that mapi may be used in two ways and how. --- src/mapi/es1api/Makefile | 16 ++++++++-------- src/mapi/glapi/Makefile | 16 ++++++++-------- src/mapi/glapi/SConscript | 2 +- src/mapi/mapi/sources.mak | 14 ++++++++------ src/mapi/mapi/u_current.c | 2 +- src/mapi/mapi/u_current.h | 6 +++--- 6 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile index 1e2b5e523b0..3659d6486a8 100644 --- a/src/mapi/es1api/Makefile +++ b/src/mapi/es1api/Makefile @@ -44,10 +44,10 @@ GLAPI_ASM_OBJECTS := $(GLAPI_ASM_SOURCES:.S=.o) GLAPI_ASM_SOURCES := $(addprefix $(GEN)/, $(GLAPI_ASM_SOURCES)) include $(MAPI)/sources.mak -MAPI_GLAPI_OBJECTS := $(MAPI_GLAPI_SOURCES:.c=.o) -MAPI_GLAPI_SOURCES := $(addprefix $(MAPI)/, $(MAPI_GLAPI_SOURCES)) +MAPI_UTIL_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o) +MAPI_UTIL_SOURCES := $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES)) -ESAPI_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_GLAPI_OBJECTS) +ESAPI_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_UTIL_OBJECTS) INCLUDE_DIRS = \ -I$(TOP)/include \ @@ -72,13 +72,13 @@ lib$(ESAPI).a: $(ESAPI_OBJECTS) @$(MKLIB) -o $(ESAPI) -static $(ESAPI_OBJECTS) $(GLAPI_OBJECTS): %.o: $(GLAPI)/%.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@ + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@ $(GLAPI_ASM_OBJECTS): %.o: $(GEN)/%.S $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ -$(MAPI_GLAPI_OBJECTS): %.o: $(MAPI)/%.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@ +$(MAPI_UTIL_OBJECTS): %.o: $(MAPI)/%.c + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@ $(GLAPI_SOURCES) $(GLAPI_ASM_SOURCES): | glapi-stamp @@ -135,10 +135,10 @@ install: default install-headers install-pc $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLES_LIB_GLOB) \ $(DESTDIR)$(INSTALL_LIB_DIR) -depend: $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES) +depend: $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) @echo "running $(MKDEP)" @touch depend @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(INCLUDE_DIRS) \ - -DMAPI_GLAPI_CURRENT $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES) \ + -DMAPI_MODE_UTIL $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) \ 2>/dev/null | sed -e 's,^$(GLAPI)/,,' -e 's,^$(MAPI)/,,' \ > depend diff --git a/src/mapi/glapi/Makefile b/src/mapi/glapi/Makefile index acd8429778a..a9ab07903c1 100644 --- a/src/mapi/glapi/Makefile +++ b/src/mapi/glapi/Makefile @@ -12,10 +12,10 @@ GLAPI_OBJECTS = $(GLAPI_SOURCES:.c=.o) GLAPI_ASM_OBJECTS = $(GLAPI_ASM_SOURCES:.S=.o) include $(MAPI)/sources.mak -MAPI_GLAPI_OBJECTS := $(MAPI_GLAPI_SOURCES:.c=.o) -MAPI_GLAPI_SOURCES := $(addprefix $(MAPI)/, $(MAPI_GLAPI_SOURCES)) +MAPI_UTIL_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o) +MAPI_UTIL_SOURCES := $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES)) -TARGET_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_GLAPI_OBJECTS) +TARGET_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_UTIL_OBJECTS) INCLUDE_DIRS = \ -I$(TOP)/include \ @@ -28,13 +28,13 @@ lib$(TARGET).a: $(TARGET_OBJECTS) @$(MKLIB) -o $(TARGET) -static $(TARGET_OBJECTS) $(GLAPI_OBJECTS): %.o: %.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@ + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@ $(GLAPI_ASM_OBJECTS): %.o: %.S $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ -$(MAPI_GLAPI_OBJECTS): %.o: $(MAPI)/%.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@ +$(MAPI_UTIL_OBJECTS): %.o: $(MAPI)/%.c + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@ install: @@ -43,11 +43,11 @@ clean: -rm -f lib$(TARGET).a -rm -f depend depend.bak -depend: $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES) +depend: $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) @ echo "running $(MKDEP)" @ touch depend @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(INCLUDE_DIRS) \ - -DMAPI_GLAPI_CURRENT $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES) \ + -DMAPI_MODE_UTIL $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) \ 2>/dev/null | sed -e 's,^$(MAPI)/,,' > depend -include depend diff --git a/src/mapi/glapi/SConscript b/src/mapi/glapi/SConscript index 27258f808a5..4057991ec8d 100644 --- a/src/mapi/glapi/SConscript +++ b/src/mapi/glapi/SConscript @@ -9,7 +9,7 @@ if env['platform'] != 'winddk': env = env.Clone() env.Append(CPPDEFINES = [ - 'MAPI_GLAPI_CURRENT', + 'MAPI_MODE_UTIL', ]) if env['platform'] == 'windows': diff --git a/src/mapi/mapi/sources.mak b/src/mapi/mapi/sources.mak index 5f327f3df62..ed36e1af486 100644 --- a/src/mapi/mapi/sources.mak +++ b/src/mapi/mapi/sources.mak @@ -1,12 +1,14 @@ # src/mapi/mapi/sources.mak # -# When MAPI_GLAPI_CURRENT is defined, MAPI_GLAPI_SOURCES can be built without -# MAPI_SOURCES and it is used by glapi. +# mapi may be used in several ways # -# Otherwise, MAPI_ABI_HEADER must be defined. It should expand to the header -# generated by mapi_abi.py. +# - In default mode, mapi implements the interface defined by mapi.h. To use +# this mode, compile MAPI_SOURCES. +# +# - In util mode, mapi provides utility functions for use with glapi. To use +# this mode, compile MAPI_UTIL_SOURCES with MAPI_MODE_UTIL defined. -MAPI_GLAPI_SOURCES = \ +MAPI_UTIL_SOURCES = \ u_current.c \ u_execmem.c \ u_thread.c @@ -16,4 +18,4 @@ MAPI_SOURCES = \ mapi.c \ stub.c \ table.c \ - $(MAPI_GLAPI_SOURCES) + $(MAPI_UTIL_SOURCES) diff --git a/src/mapi/mapi/u_current.c b/src/mapi/mapi/u_current.c index d84520f313d..7946d2a2741 100644 --- a/src/mapi/mapi/u_current.c +++ b/src/mapi/mapi/u_current.c @@ -51,7 +51,7 @@ #include "u_current.h" #include "u_thread.h" -#ifndef MAPI_GLAPI_CURRENT +#ifndef MAPI_MODE_UTIL #include "table.h" #include "stub.h" diff --git a/src/mapi/mapi/u_current.h b/src/mapi/mapi/u_current.h index 373d48fb939..061fccc9495 100644 --- a/src/mapi/mapi/u_current.h +++ b/src/mapi/mapi/u_current.h @@ -1,7 +1,7 @@ #ifndef _U_CURRENT_H_ #define _U_CURRENT_H_ -#ifdef MAPI_GLAPI_CURRENT +#ifdef MAPI_MODE_UTIL #include "glapi/glapi.h" @@ -21,7 +21,7 @@ #define u_current_table_tsd _gl_DispatchTSD -#else /* MAPI_GLAPI_CURRENT */ +#else /* MAPI_MODE_UTIL */ #include "u_compiler.h" @@ -42,7 +42,7 @@ extern void *u_current_user; #endif /* GLX_USE_TLS */ -#endif /* MAPI_GLAPI_CURRENT */ +#endif /* MAPI_MODE_UTIL */ void u_current_init(void); -- 2.30.2