AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
+AM_PROG_AS
AC_CHECK_PROGS([MAKE], [gmake make])
AC_CHECK_PROGS([PYTHON2], [python2 python])
AC_PROG_SED
DRI_CFLAGS='$(CFLAGS_NOVISIBILITY) -DUSE_DRICORE'
DRI_CXXFLAGS='$(CXXFLAGS_NOVISIBILITY) -DUSE_DRICORE'
MESA_MODULES='$(DRICORE_LIBS) $(DRICORE_GLSL_LIBS)'
+ HAVE_DRICORE=yes
fi
+AM_CONDITIONAL(HAVE_DRICORE, test x$HAVE_DRICORE = xyes)
AC_SUBST([DRICORE_LIBS])
AC_SUBST([DRICORE_GLSL_LIBS])
AC_SUBST([DRICORE_LIB_DEPS])
AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = xyes)
AC_SUBST([GALLIUM_MAKE_DIRS])
+AM_CONDITIONAL(HAVE_X11_DRIVER, echo "$DRIVER_DIRS" | grep 'x11' >/dev/null 2>&1)
+AM_CONDITIONAL(HAVE_DRI_DRIVER, echo "$DRIVER_DIRS" | grep 'dri' >/dev/null 2>&1)
+AM_CONDITIONAL(HAVE_OSMESA_DRIVER, echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1)
+
+AM_CONDITIONAL(HAVE_X86_ASM, echo "$ASM_FLAGS" | grep 'X86_ASM' >/dev/null 2>&1)
+AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$ASM_FLAGS" | grep 'X86_64_ASM' >/dev/null 2>&1)
+AM_CONDITIONAL(HAVE_SPARC_ASM, echo "$ASM_FLAGS" | grep 'SPARC_ASM' >/dev/null 2>&1)
+
dnl prepend CORE_DIRS to SRC_DIRS
SRC_DIRS="$CORE_DIRS $SRC_DIRS"
src/glx/Makefile
src/mapi/shared-glapi/Makefile
src/gtest/Makefile
+ src/mesa/libdricore/Makefile
src/mesa/drivers/dri/dri.pc
src/mesa/drivers/dri/Makefile
src/mesa/drivers/dri/common/Makefile
DEPENDS := depend
MESA_OBJ_DIR := .
-DRICORE_OBJ_DIR := objs-dricore
SRCDIR = .
include sources.mak
# adjust object dirs
-DRICORE_OBJECTS := $(addprefix $(DRICORE_OBJ_DIR)/, $(MESA_OBJECTS))
MESA_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, $(MESA_OBJECTS))
MESA_GALLIUM_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS))
# append include dirs
MESA_CPPFLAGS += $(INCLUDE_DIRS)
-DRICORE_CPPFLAGS = $(MESA_CPPFLAGS)
-
# tidy compiler flags
CFLAGS := $(filter-out $(DEFINES), $(CFLAGS))
CXXFLAGS := $(filter-out $(DEFINES), $(CXXFLAGS))
# LLVM is needed for the state tracker
MESA_CFLAGS := $(LLVM_CFLAGS) $(CFLAGS)
-DRICORE_CFLAGS := $(LLVM_CFLAGS) $(DRI_CFLAGS)
-
MESA_CXXFLAGS := $(LLVM_CFLAGS) $(CXXFLAGS)
-DRICORE_CXXFLAGS := $(LLVM_CFLAGS) $(DRI_CXXFLAGS)
define mesa-cc-c
@mkdir -p $(dir $@)
$(MESA_OBJ_DIR)/%.o: %.S
$(call mesa-cc-c,MESA)
-$(DRICORE_OBJ_DIR)/%.o: %.c
- $(call mesa-cc-c,DRICORE)
-
-$(DRICORE_OBJ_DIR)/%.o: %.cpp
- $(call mesa-cxx-c,DRICORE)
-
-$(DRICORE_OBJ_DIR)/%.o: %.S
- $(call mesa-cc-c,DRICORE)
-
# Default: build dependencies, then asm_subdirs, GLSL built-in lib,
# then convenience libs (.a) and finally the device drivers:
-default: $(DEPENDS) asm_subdirs $(MESA_LIBS) $(DRICORE_LIBS) driver_subdirs
+default: $(DEPENDS) asm_subdirs $(MESA_LIBS) driver_subdirs
# include glapi_gen.mk for generating glapi headers for GLES
GLAPI := $(TOP)/src/mapi/glapi/gen
program/lex.yy.c: program/program_lexer.l
$(FLEX) --never-interactive --outfile=$@ $<
+ifneq (,$(DRICORE_LIBS))
+DRICORE_TARGET = dricore
+DRICORE_INSTALL_TARGET = install-dricore
+endif
+
######################################################################
# Helper libraries used by many drivers:
libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS)
@ $(MKLIB) -o mesa -static $(MESA_OBJECTS) $(GLSL_LIBS)
-# Shared dricore library for classic DRI drivers
-$(TOP)/$(LIB_DIR)/libdricore.so: $(DRICORE_OBJECTS) $(DRICORE_GLSL_LIBS)
- @$(MKLIB) -o $@ -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
- -cplusplus -noprefix \
- -install $(TOP)/$(LIB_DIR) -id $(DRI_DRIVER_INSTALL_DIR)/$@.dylib \
- $(DRICORE_LIB_DEPS) $(DRICORE_OBJECTS)
-
# Make archive of subset of core mesa object files for gallium
libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
@ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
+dricore: $(BUILT_SOURCES)
+ @ (cd libdricore && $(MAKE))
+
######################################################################
# Device drivers
-driver_subdirs: $(MESA_LIBS) $(DRICORE_LIBS)
+driver_subdirs: $(MESA_LIBS) $(DRICORE_TARGET)
@ (cd drivers && $(MAKE))
(cd x86-64 && $(MAKE)) || exit 1 ; \
fi
-
######################################################################
# Dependency generation
@ touch depend
@$(MKDEP) $(MKDEP_OPTIONS) -p$(MESA_OBJ_DIR)/ $(MESA_CPPFLAGS) \
$(ALL_FILES) > /dev/null 2>/dev/null
- @$(MKDEP) $(MKDEP_OPTIONS) -a -p$(DRICORE_OBJ_DIR)/ $(MESA_CPPFLAGS) \
- $(ALL_FILES) > /dev/null 2>/dev/null
######################################################################
# Installation rules
new_install:
(cd drivers && $(MAKE) install)
-ifneq (,$(DRICORE_LIBS))
-DRICORE_INSTALL_TARGET = install-dricore
-endif
-
# XXX replace this with new_install above someday
install: default $(DRICORE_INSTALL_TARGET)
@for driver in $(DRIVER_DIRS) ; do \
install-dri: default
cd drivers/dri && $(MAKE) install
-# We don't need MINSTALL here because we're not installing symbolic links
install-dricore: default
- $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
- $(INSTALL) -m 755 $(DRICORE_LIBS) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
-
+ @ (cd libdricore && $(MAKE) install)
# Emacs tags
tags:
etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
-clean-dricore:
- -rm -f libdricore.so
- -rm -f $(DRICORE_LIBS)
- -rm -rf $(DRICORE_OBJ_DIR)
-
-clean: clean-dricore
+clean:
-rm -f */*.o
-rm -f */*/*.o
-rm -f depend depend.bak libmesa.a libmesagallium.a
--- /dev/null
+Makefile
+Makefile.in
--- /dev/null
+# Copyright © 2012 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+TOP=$(top_srcdir)
+SRCDIR = $(srcdir)/..
+include ../sources.mak
+
+noinst_PROGRAMS =
+
+AM_CPPFLAGS = \
+ $(INCLUDE_DIRS) \
+ $(API_DEFINES) \
+ $(DEFINES)
+
+dridir = $(libdir)/dri
+
+AM_CFLAGS = $(CFLAGS_NOVISIBILITY) $(ASM_FLAGS) -DUSE_DRICORE
+AM_CXXFLAGS = $(CXXFLAGS_NOVISIBILITY) $(ASM_FLAGS) -DUSE_DRICORE
+AM_CCASFLAGS = $(CFLAGS_NOVISIBILITY) $(ASM_FLAGS) -DUSE_DRICORE
+
+libdricore_la_SOURCES = \
+ $(MESA_FILES) \
+ $(MESA_CXX_FILES)
+libdricore_la_LDFLAGS = -module -avoid-version -shared
+libdricore_la_LIBADD = libdricore-asm.la
+
+# This is separated from libdricore to avoid conflics in object
+# outputs between main/clip.c and sparc/clip.c. The documented way to
+# do this is with the automake option subdir-objects, except that
+# option is broken in the presence of variable expansion in *_SOURCES.
+# I have no idea how that option is supposed to be usable as is.
+libdricore_asm_la_SOURCES =
+libdricore_asm_la_CCASFLAGS = $(AM_CCASFLAGS) -DWORKAROUND_AUTOMAKE_OBJ_FILE_CONFLICTS
+
+if HAVE_X86_ASM
+libdricore_asm_la_SOURCES += $(X86_FILES)
+endif
+
+if HAVE_X86_64_ASM
+libdricore_asm_la_SOURCES += $(X86_64_FILES)
+endif
+
+if HAVE_SPARC_ASM
+libdricore_asm_la_SOURCES += $(SPARC_FILES)
+endif
+
+if HAVE_DRICORE
+noinst_LTLIBRARIES = libdricore-asm.la
+dri_LTLIBRARIES = libdricore.la
+
+# Provide compatibility with scripts for the old Mesa build system for
+# a while by putting a link to the driver into /lib of the build tree.
+all-local: libdricore.la
+ $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
+ ln -f .libs/libdricore.so $(top_builddir)/$(LIB_DIR)/libdricore.so;
+endif
+
+CLEANFILES = \
+ $(top_builddir)/$(LIB_DIR)/libdricore.so
+
+-include $(DEPENDS)