MESA := ..
include $(TOP)/configs/current
-include sources.mak
ES1_LIBS := libes1gallium.a
ES2_LIBS := libes2gallium.a
ES1_OBJ_DIR := objs-es1
ES2_OBJ_DIR := objs-es2
-# adjust output dirs
-ES1_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(ES1_OBJECTS))
-ES1_GALLIUM_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(ES1_GALLIUM_OBJECTS))
+include $(MESA)/sources.mak
+
+# TODO Make core mesa more feature-aware and remove the omit list
+VBO_OMITTED := \
+ vbo/vbo_save.c \
+ vbo/vbo_save_api.c \
+ vbo/vbo_save_draw.c \
+ vbo/vbo_save_loopback.c
+VBO_SOURCES := $(filter-out $(VBO_OMITTED), $(VBO_SOURCES))
+
+SHADER_OMITTED := \
+ shader/atifragshader.c
+SHADER_SOURCES := $(filter-out $(SHADER_OMITTED), $(SHADER_SOURCES))
+
+# adjust source dir
+ES_SOURCES := $(addprefix $(MESA)/, $(MESA_SOURCES))
+ES_GALLIUM_SOURCES := $(addprefix $(MESA)/, $(MESA_GALLIUM_SOURCES))
+
+# adjust object dirs
+ES1_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(MESA_OBJECTS))
+ES1_GALLIUM_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS))
+
+ES2_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(MESA_OBJECTS))
+ES2_GALLIUM_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS))
+
+# adjust include dirs
+ES1_INCLUDES := -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS)
+ES2_INCLUDES := -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS)
-ES2_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(ES2_OBJECTS))
-ES2_GALLIUM_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(ES2_GALLIUM_OBJECTS))
# compile either ES1 or ES2 sources
define es-compile
$(CC) -c $(CFLAGS) $(ES$(1)_CPPFLAGS) $(ES$(1)_INCLUDES) -o $@ $<
endef
-$(ES1_OBJ_DIR)/%.o: %.c
- $(call es-compile,1)
-
-$(ES1_OBJ_DIR)/%.o: %.S
- $(call es-compile,1)
-
$(ES1_OBJ_DIR)/%.o: $(MESA)/%.c
$(call es-compile,1)
$(ES1_OBJ_DIR)/%.o: $(MESA)/%.S
$(call es-compile,1)
-$(ES2_OBJ_DIR)/%.o: %.c
- $(call es-compile,2)
-
-$(ES2_OBJ_DIR)/%.o: %.S
- $(call es-compile,2)
-
$(ES2_OBJ_DIR)/%.o: $(MESA)/%.c
$(call es-compile,2)
@$(MKLIB) -o es1 -static $(ES1_OBJECTS) $(GLSL_LIBS)
libes2.a: $(ES2_OBJECTS) $(GLSL_LIBS)
- @$(MKLIB) -o es2 -static $(ES1_OBJECTS) $(GLSL_LIBS)
+ @$(MKLIB) -o es2 -static $(ES2_OBJECTS) $(GLSL_LIBS)
libes1gallium.a: $(ES1_GALLIUM_OBJECTS) $(GLSL_LIBS)
@$(MKLIB) -o es1gallium -static $(ES1_GALLIUM_OBJECTS) $(GLSL_LIBS)
@$(MAKE) -C $(MESA) glsl_builtin
# sort to avoid duplicates
-ALL_SOURCES := $(sort $(ES1_ALL_SOURCES) $(ES2_ALL_SOURCES))
+ES_ALL_SOURCES := $(sort $(ES_SOURCES) $(ES_GALLIUM_SOURCES))
-depend: $(ALL_SOURCES)
+depend: $(ES_ALL_SOURCES)
@echo "running $(MKDEP)"
@touch depend
@# MESA is "..", but luckily, directories are longer than 2 characters
@$(MKDEP) -f- -p$(ES1_OBJ_DIR)/ $(DEFINES) $(ES1_CFLAGS) \
- $(ES1_INCLUDES) $(ES1_ALL_SOURCES) 2>/dev/null | \
+ $(ES1_INCLUDES) $(ES_ALL_SOURCES) 2>/dev/null | \
sed -e 's,^$(ES1_OBJ_DIR)/$(MESA)/,$(ES1_OBJ_DIR)/,' > depend
@$(MKDEP) -f- -p$(ES2_OBJ_DIR)/ $(DEFINES) $(ES2_CFLAGS) \
- $(ES2_INCLUDES) $(ES2_ALL_SOURCES) 2>/dev/null | \
+ $(ES2_INCLUDES) $(ES_ALL_SOURCES) 2>/dev/null | \
sed -e 's,^$(ES2_OBJ_DIR)/$(MESA)/,$(ES2_OBJ_DIR)/,' >> depend
ifneq ($(MAKECMDGOALS),clean)
+++ /dev/null
-# TODO Make core mesa more feature-aware and remove this file
-
-include $(MESA)/sources.mak
-
-LOCAL_ES1_INCLUDES := \
- -I. \
- -I$(TOP)/src/mapi/es1api \
- -I$(MESA)/state_tracker
-
-LOCAL_ES2_INCLUDES := $(subst es1,es2, $(LOCAL_ES1_INCLUDES))
-
-# MESA sources
-
-VBO_OMITTED := \
- vbo/vbo_save.c \
- vbo/vbo_save_api.c \
- vbo/vbo_save_draw.c \
- vbo/vbo_save_loopback.c
-VBO_SOURCES := $(filter-out $(VBO_OMITTED), $(VBO_SOURCES))
-
-SHADER_OMITTED := \
- shader/atifragshader.c
-SHADER_SOURCES := $(filter-out $(SHADER_OMITTED), $(SHADER_SOURCES))
-
-MESA_ES1_SOURCES := \
- $(MAIN_SOURCES) \
- $(MATH_SOURCES) \
- $(MATH_XFORM_SOURCES) \
- $(VBO_SOURCES) \
- $(TNL_SOURCES) \
- $(SHADER_SOURCES) \
- $(SWRAST_SOURCES) \
- $(SWRAST_SETUP_SOURCES) \
- $(COMMON_DRIVER_SOURCES) \
- $(ASM_C_SOURCES) \
- $(SLANG_SOURCES)
-
-MESA_ES1_GALLIUM_SOURCES := \
- $(MAIN_SOURCES) \
- $(MATH_SOURCES) \
- $(VBO_SOURCES) \
- $(STATETRACKER_SOURCES) \
- $(SHADER_SOURCES) \
- ppc/common_ppc.c \
- x86/common_x86.c \
- $(SLANG_SOURCES)
-
-MESA_ES1_INCLUDES := $(INCLUDE_DIRS)
-
-# right now es2 and es1 share MESA sources
-MESA_ES2_SOURCES := $(MESA_ES1_SOURCES)
-MESA_ES2_GALLIUM_SOURCES := $(MESA_ES1_GALLIUM_SOURCES)
-
-MESA_ES2_INCLUDES := $(MESA_ES1_INCLUDES)
-
-# asm is shared by any ES version and any library
-MESA_ES_ASM := $(MESA_ASM_SOURCES)
-
-# collect sources, adjust the pathes
-ES1_SOURCES := $(addprefix $(MESA)/,$(MESA_ES1_SOURCES))
-ES1_GALLIUM_SOURCES := $(addprefix $(MESA)/,$(MESA_ES1_GALLIUM_SOURCES))
-
-ES2_SOURCES := $(addprefix $(MESA)/,$(MESA_ES2_SOURCES))
-ES2_GALLIUM_SOURCES := $(addprefix $(MESA)/,$(MESA_ES2_GALLIUM_SOURCES))
-
-# collect includes
-ES1_INCLUDES := $(LOCAL_ES1_INCLUDES) $(MESA_ES1_INCLUDES)
-ES2_INCLUDES := $(LOCAL_ES2_INCLUDES) $(MESA_ES2_INCLUDES)
-
-# collect objects, including asm
-ES1_OBJECTS := \
- $(MESA_ES1_SOURCES:.c=.o) \
- $(MESA_ES_ASM:.S=.o)
-
-ES1_GALLIUM_OBJECTS := \
- $(MESA_ES1_GALLIUM_SOURCES:.c=.o) \
- $(MESA_ES_ASM:.S=.o)
-
-ES2_OBJECTS := \
- $(MESA_ES2_SOURCES:.c=.o) \
- $(MESA_ES_ASM:.S=.o)
-
-ES2_GALLIUM_OBJECTS := \
- $(MESA_ES2_GALLIUM_SOURCES:.c=.o) \
- $(MESA_ES_ASM:.S=.o)
-
-# collect sources for makedepend
-ES1_ALL_SOURCES := $(ES1_SOURCES) $(ES1_GALLIUM_SOURCES)
-ES2_ALL_SOURCES := $(ES2_SOURCES) $(ES2_GALLIUM_SOURCES)
-
-# sort to remove duplicates
-ES1_ALL_SOURCES := $(sort $(ES1_ALL_SOURCES))
-ES2_ALL_SOURCES := $(sort $(ES2_ALL_SOURCES))