In other words, don't build src/gallium source code from within src/mesa/Makefile.
Also, allow to customize which gallium auxiliary dirs, driver driver, winsys
dirs get built from the config/* files.
# Directories to build
LIB_DIR = lib
-SRC_DIRS = gallium mesa glu glut/glx glw
+SRC_DIRS = gallium mesa gallium/winsys glu glut/glx glw
GLU_DIRS = sgi
-DRIVER_DIRS = x11 osmesa
+DRIVER_DIRS =
# Which subdirs under $(TOP)/progs/ to enter:
PROGRAM_DIRS = demos redbook samples glsl xdemos
+# Gallium directories and
+GALLIUM_AUXILIARY_DIRS = draw cso_cache pipebuffer tgsi util
+GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a)
+GALLIUM_DRIVER_DIRS = softpipe i915simple i965simple failover
+GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVER_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
+GALLIUM_WINSYS_DIRS = xlib
+
+
# Library/program dependencies
#EXTRA_LIB_PATH ?=
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
CONFIG_NAME = linux-cell
+GALLIUM_DRIVER_DIRS += cell
+
+
# Compiler and flags
CC = ppu32-gcc
CXX = ppu32-g++
# Directories
ifeq ($(USING_EGL), 1)
-SRC_DIRS = egl glx/x11 gallium mesa glu glut/glx glw
+SRC_DIRS := egl $(SRC_DIRS)
PROGRAM_DIRS = egl
-else
-SRC_DIRS = glx/x11 gallium mesa glu glut/glx glw
-PROGRAM_DIRS =
endif
DRIVER_DIRS = dri
WINDOW_SYSTEM=dri
+GALLIUM_WINSYS_DIRS = dri
# gamma are missing because they have not been converted to use the new
# interface.
CONFIG_NAME = linux-llvm
+GALLIUM_AUXILIARY_DIRS += llvm
+
OPT_FLAGS = -g -ansi -pedantic
DEFINES += -DDEBUG -DDEBUG_MATH -DMESA_LLVM=1
-I$(TOP)/src/gallium/auxiliary \
-I$(TOP)/src/gallium/drivers \
-I$(TOP)/src/mesa \
+ -I$(TOP)/src/mesa/main \
-I$(TOP)/include \
$(DRIVER_INCLUDES)
include $(TOP)/configs/current
-ifeq ($(CONFIG_NAME), linux-llvm)
-LLVM_DIR = llvm
-endif
-
-SUBDIRS = pipebuffer $(LLVM_DIR)
+SUBDIRS = $(GALLIUM_AUXILIARY_DIRS)
default: subdirs
--- /dev/null
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = cso_cache
+
+DRIVER_SOURCES = \
+ cso_cache.c \
+ cso_hash.c
+
+C_SOURCES = \
+ $(DRIVER_SOURCES)
+
+ASM_SOURCES =
+
+include ../../Makefile.template
+
+symlinks:
+
-default:
- cd ../../../mesa ; make
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = draw
+
+DRIVER_SOURCES = \
+ draw_clip.c \
+ draw_vs_exec.c \
+ draw_vs_sse.c \
+ draw_vs_llvm.c \
+ draw_context.c\
+ draw_cull.c \
+ draw_debug.c \
+ draw_flatshade.c \
+ draw_offset.c \
+ draw_prim.c \
+ draw_stipple.c \
+ draw_twoside.c \
+ draw_unfilled.c \
+ draw_validate.c \
+ draw_vbuf.c \
+ draw_vertex.c \
+ draw_vertex_cache.c \
+ draw_vertex_fetch.c \
+ draw_vertex_shader.c \
+ draw_vf.c \
+ draw_vf_generic.c \
+ draw_vf_sse.c \
+ draw_wide_prims.c
+
+C_SOURCES = \
+ $(DRIVER_SOURCES)
+
+ASM_SOURCES =
+
+include ../../Makefile.template
+
+symlinks:
+
-default:
- cd ../.. ; make
+
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = tgsi
+
+DRIVER_SOURCES = \
+ exec/tgsi_exec.c \
+ exec/tgsi_sse2.c \
+ util/tgsi_build.c \
+ util/tgsi_dump.c \
+ util/tgsi_parse.c \
+ util/tgsi_util.c
+
+C_SOURCES = \
+ $(DRIVER_SOURCES)
+
+ASM_SOURCES =
+
+include ../../Makefile.template
+
+symlinks:
+++ /dev/null
-default:
- cd ../../.. ; make
-
--- /dev/null
+
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = util
+
+DRIVER_SOURCES = \
+ p_debug.c \
+ p_tile.c \
+ p_util.c
+
+C_SOURCES = \
+ $(DRIVER_SOURCES)
+
+ASM_SOURCES =
+
+include ../../Makefile.template
+
+symlinks:
+
include $(TOP)/configs/current
-ifeq ($(CONFIG_NAME), linux-cell)
-CELL_DIR = cell
-endif
-
-SUBDIRS = softpipe i915simple i965simple failover pipebuffer $(CELL_DIR)
+SUBDIRS = softpipe i915simple i965simple failover
default: subdirs
--- /dev/null
+TOP = ../../..
+include $(TOP)/configs/current
+
+
+SUBDIRS = $(GALLIUM_WINSYS_DIRS)
+
+
+default: subdirs
+
+
+subdirs:
+ @for dir in $(SUBDIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE)) || exit 1 ; \
+ fi \
+ done
+
+
+clean:
+ rm -f `find . -name \*.[oa]`
# -*-makefile-*-
-MESA_MODULES = $(TOP)/src/mesa/libmesa.a
-
+MESA_MODULES = \
+ $(TOP)/src/mesa/libmesa.a \
+ $(GALLIUM_AUXILIARIES)
+
COMMON_GALLIUM_SOURCES = \
$(TOP)/src/mesa/drivers/dri/common/utils.c \
$(TOP)/src/mesa/drivers/dri/common/vblank.c \
--- /dev/null
+# src/mesa/Makefile
+
+TOP = ../../../..
+include $(TOP)/configs/current
+
+
+INCLUDE_DIRS = \
+ -I$(TOP)/include \
+ -I$(TOP)/src/mesa \
+ -I$(TOP)/src/mesa/main \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/gallium/auxiliary
+
+X11_DRIVER_SOURCES = \
+ glxapi.c \
+ fakeglx.c \
+ xfonts.c \
+ xm_api.c \
+ xm_winsys.c \
+ xm_winsys_aub.c \
+ brw_aub.c
+
+
+GL_MAJOR = 1
+GL_MINOR = 5
+GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
+
+
+PIPE_LIB = \
+ $(GALLIUM_DRIVERS) \
+ $(TOP)/src/mesa/libglapi.a \
+ $(TOP)/src/mesa/libmesa.a \
+ $(GALLIUM_AUXILIARIES)
+
+ifeq ($(CONFIG_NAME), linux-cell)
+CELL_LIB = $(TOP)/src/gallium/drivers/cell/ppu/libcell.a
+CELL_LIB_SPU = $(TOP)/src/gallium/drivers/cell/spu/g3d_spu.a
+endif
+
+ifeq ($(CONFIG_NAME), linux-llvm)
+LLVM_LIB = $(TOP)/src/gallium/auxiliary/llvm/libgallivm.a
+endif
+
+
+.SUFFIXES : .cpp
+
+.c.o:
+ $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
+
+.cpp.o:
+ $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@
+
+.S.o:
+ $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
+
+
+default: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
+
+
+######################################################################
+# Stand-alone Mesa libGL and libOSMesa
+STAND_ALONE_DRIVER_SOURCES = \
+ $(X11_DRIVER_SOURCES)
+
+STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o)
+
+STAND_ALONE_OBJECTS = \
+ $(STAND_ALONE_DRIVER_OBJECTS)
+
+# Make the GL library
+$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) $(LLVM_LIB) $(PIPE_LIB) $(CELL_LIB) $(CELL_LIB_SPU)
+ $(TOP)/bin/mklib -o $(GL_LIB) \
+ -linker "$(CC)" \
+ -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \
+ -install $(TOP)/$(LIB_DIR) \
+ $(MKLIB_OPTIONS) $(STAND_ALONE_OBJECTS) \
+ --start-group $(PIPE_LIB) $(LLVM_LIB) --end-group $(CELL_LIB) $(CELL_LIB_SPU) $(GL_LIB_DEPS)
+
+
+######################################################################
+# Generic stuff
+
+depend: $(ALL_SOURCES)
+ @ echo "running $(MKDEP)"
+ @ rm -f depend # workaround oops on gutsy?!?
+ @ touch depend
+ @ $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
+ > /dev/null 2>/dev/null
+
+
+install: default
+ $(INSTALL) -d $(INSTALL_DIR)/include/GL
+ $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(INSTALL_DIR)/include/GL
+ @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
+ $(INSTALL) $(TOP)/$(LIB_DIR)/libGL* $(INSTALL_DIR)/$(LIB_DIR); \
+ fi
+
+## NOT INSTALLED YET:
+## $(INSTALL) -d $(INSTALL_DIR)/include/GLES
+## $(INSTALL) -m 644 include/GLES/*.h $(INSTALL_DIR)/include/GLES
+
+
+# Emacs tags
+tags:
+ etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
+
+clean:
+ -rm -f *.o
+
+
+include depend
GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
-PIPE_LIB = \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
- $(TOP)/src/gallium/drivers/i965simple/libi965simple.a
-
-ifeq ($(CONFIG_NAME), linux-cell)
-CELL_LIB = $(TOP)/src/gallium/drivers/cell/ppu/libcell.a
-CELL_LIB_SPU = $(TOP)/src/gallium/drivers/cell/spu/g3d_spu.a
-endif
-
-ifeq ($(CONFIG_NAME), linux-llvm)
-LLVM_LIB = $(TOP)/src/gallium/auxiliary/llvm/libgallivm.a
-endif
-
.SUFFIXES : .cpp
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-# Figure out what to make here
-default:
- @if [ "${DRIVER_DIRS}" = "dri" ] ; then \
- $(MAKE) linux-solo ; \
- elif [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
- $(MAKE) osmesa-only ; \
- elif [ "$(DRIVER_DIRS)" = "beos" ]; then \
- $(MAKE) beos ; \
- elif [ "$(DRIVER_DIRS)" = "directfb" ]; then \
- $(MAKE) directfb ; \
- elif [ "$(DRIVER_DIRS)" = "fbdev osmesa" ]; then \
- $(MAKE) fbdev ; $(MAKE) osmesa-only ; \
- else \
- $(MAKE) stand-alone ; \
- fi
-
+default: depend subdirs libmesa.a
-######################################################################
-# BeOS driver target
-
-beos: depend subdirs libmesa.a
- cd drivers/beos; $(MAKE)
+ifneq ($(DRIVER_DIRS),dri)
+default: libglapi.a
+endif
######################################################################
-# Linux DRI drivers
-
# Make archive of core object files
libmesa.a: $(SOLO_OBJECTS)
@ $(TOP)/bin/mklib -o mesa -static $(SOLO_OBJECTS);
mimeset -f "$@" ; \
fi
-linux-solo: depend subdirs libmesa.a
- cd $(TOP)/src/gallium/winsys/dri ; $(MAKE)
-
-
-#####################################################################
-# Stand-alone Mesa libGL, no built-in drivers (DirectFB)
-
-libgl-core: $(CORE_OBJECTS)
- @ $(TOP)/bin/mklib -o $(GL_LIB) \
- -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
- -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(CORE_OBJECTS) \
- $(GL_LIB_DEPS)
-
-directfb: depend subdirs libgl-core
- cd drivers/directfb ; $(MAKE)
-
-
-#####################################################################
-# fbdev Mesa driver (libGL.so)
-
-fbdev: $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) $(COMMON_DRIVER_OBJECTS)
- @ $(TOP)/bin/mklib -o $(GL_LIB) \
- -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
- -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
- $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) \
- $(COMMON_DRIVER_OBJECTS) $(GL_LIB_DEPS)
+libglapi.a: $(GLAPI_OBJECTS)
+ @ $(TOP)/bin/mklib -o glapi -static $(GLAPI_OBJECTS)
######################################################################
@if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
$(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* $(INSTALL_DIR)/$(LIB_DIR); \
fi
- @if [ "${DRIVER_DIRS}" = "dri" ] ; then \
- cd $(TOP)/gallium/winsys/dri ; $(MAKE) install ; \
- fi
## NOT INSTALLED YET:
## $(INSTALL) -d $(INSTALL_DIR)/include/GLES
clean:
-rm -f */*.o
-rm -f */*/*.o
- -rm -f depend depend.bak libmesa.a
+ -rm -f depend depend.bak libmesa.a libglapi.a
-rm -f drivers/*/*.o
- (cd drivers/dri && $(MAKE) clean)
(cd x86 && $(MAKE) clean)
(cd x86-64 && $(MAKE) clean)
vf/vf_generic.c \
vf/vf_sse.c
-
-DRAW_SOURCES = \
- $(TOP)/src/gallium/auxiliary/draw/draw_clip.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_vs_exec.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_vs_sse.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_vs_llvm.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_context.c\
- $(TOP)/src/gallium/auxiliary/draw/draw_cull.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_debug.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_flatshade.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_offset.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_prim.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_stipple.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_twoside.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_unfilled.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_validate.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_vbuf.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_vertex.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_vertex_cache.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_vertex_fetch.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_vertex_shader.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_vf.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_vf_generic.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_vf_sse.c \
- $(TOP)/src/gallium/auxiliary/draw/draw_wide_prims.c
-
-TGSIEXEC_SOURCES = \
- $(TOP)/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c \
- $(TOP)/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
-
-TGSIUTIL_SOURCES = \
- $(TOP)/src/gallium/auxiliary/tgsi/util/tgsi_build.c \
- $(TOP)/src/gallium/auxiliary/tgsi/util/tgsi_dump.c \
- $(TOP)/src/gallium/auxiliary/tgsi/util/tgsi_parse.c \
- $(TOP)/src/gallium/auxiliary/tgsi/util/tgsi_util.c
-
-STATECACHE_SOURCES = \
- $(TOP)/src/gallium/auxiliary/cso_cache/cso_hash.c \
- $(TOP)/src/gallium/auxiliary/cso_cache/cso_cache.c
-
-PIPEUTIL_SOURCES = \
- $(TOP)/src/gallium/auxiliary/util/p_debug.c \
- $(TOP)/src/gallium/auxiliary/util/p_tile.c \
- $(TOP)/src/gallium/auxiliary/util/p_util.c
-
STATETRACKER_SOURCES = \
state_tracker/st_atom.c \
state_tracker/st_atom_blend.c \
state_tracker/st_cb_readpixels.c \
state_tracker/st_cb_strings.c \
state_tracker/st_cb_texture.c \
- state_tracker/st_cache.c \
+ state_tracker/st_cache.c \
state_tracker/st_context.c \
state_tracker/st_debug.c \
state_tracker/st_draw.c \
__COMMON_DRIVER_SOURCES = \
drivers/common/driverfuncs.c
-X11_DRIVER_SOURCES = \
- $(TOP)/src/gallium/winsys/xlib/glxapi.c \
- $(TOP)/src/gallium/winsys/xlib/fakeglx.c \
- $(TOP)/src/gallium/winsys/xlib/xfonts.c \
- $(TOP)/src/gallium/winsys/xlib/xm_api.c \
- $(TOP)/src/gallium/winsys/xlib/xm_winsys.c \
- $(TOP)/src/gallium/winsys/xlib/xm_winsys_aub.c \
- $(TOP)/src/gallium/winsys/xlib/brw_aub.c
-
OSMESA_DRIVER_SOURCES = \
drivers/osmesa/osmesa.c