summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-05-24 13:59:21 -0700
committerEric Anholt <[email protected]>2012-05-29 12:39:48 -0700
commitf9d1562f356a66b70f13324e3360d63e8602a35f (patch)
treec1c9d0f0ce872528488dee7010fdd1b038162a05 /src/mesa
parente86c40a84d241b954594f5ae7df9b9c3fc797a4e (diff)
automake: Convert dricore building to automake.
This is performed in a subdirectory to avoid needing to convert all of src/mesa/Makefile in one go. I can now cherry-pick a commit containing glapi XML changes, do "(cd src/mapi/glapi/gen && make) && make", and get a working driver. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/Makefile54
-rw-r--r--src/mesa/libdricore/.gitignore2
-rw-r--r--src/mesa/libdricore/Makefile.am79
3 files changed, 93 insertions, 42 deletions
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index 2d5b7274273..dab1c376820 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -7,13 +7,11 @@ MESA_LIBS := libmesa.a libmesagallium.a
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))
@@ -23,18 +21,13 @@ MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES)
# 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 $@)
@@ -55,18 +48,9 @@ $(MESA_OBJ_DIR)/%.o: %.cpp
$(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
@@ -111,6 +95,11 @@ program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
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:
@@ -118,20 +107,16 @@ program/lex.yy.c: program/program_lexer.l
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)/[email protected] \
- $(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))
@@ -146,7 +131,6 @@ asm_subdirs:
(cd x86-64 && $(MAKE)) || exit 1 ; \
fi
-
######################################################################
# Dependency generation
@@ -155,8 +139,6 @@ depend: $(ALL_FILES)
@ 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
@@ -165,10 +147,6 @@ depend: $(ALL_FILES)
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 \
@@ -234,22 +212,14 @@ install-osmesa: default osmesa.pc
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
diff --git a/src/mesa/libdricore/.gitignore b/src/mesa/libdricore/.gitignore
new file mode 100644
index 00000000000..282522db034
--- /dev/null
+++ b/src/mesa/libdricore/.gitignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/src/mesa/libdricore/Makefile.am b/src/mesa/libdricore/Makefile.am
new file mode 100644
index 00000000000..6fc4bbe80f7
--- /dev/null
+++ b/src/mesa/libdricore/Makefile.am
@@ -0,0 +1,79 @@
+# 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)