targets/pipe-loader: Convert to automake

C++ linking (controlled by the nodist_EXTRA idiom) is needed

unconditionally for:
	nouveau (uses C++ in the driver)
	r300 (since LLVM is always required)
	radeonsi (since LLVM is always required)
	swrast (if builting LLVM pipe)

and conditionally (depends whether LLVM is enabled) for
	i915
	r600
	vmwgfx

and never needed for swrast (softpipe).

Unfortunately, automake seems to *always* link with C++ if nodist_EXTRA
is specified, even inside a false conditional. Not sure if this is a
bug, but it does seem to be weird behavior.

v2: Johannes Obermayr <johannesobermayr@gmx.de>
    - Fix some undefined symbols.

v3: Johannes Obermayr <johannesobermayr@gmx.de>
    - Install pipe_* to $(libdir)/gallium-pipe.

v4: Johannes Obermayr <johannesobermayr@gmx.de>
    - Build it only once on --enable-gallium-gbm / --enable-opencl.
This commit is contained in:
Matt Turner 2012-09-13 10:45:01 -07:00 committed by Andreas Boll
parent 53c62d3fb0
commit 45270fb0fd
7 changed files with 182 additions and 187 deletions

View File

@ -1493,6 +1493,10 @@ if test "x$enable_opencl" = xyes; then
enable_gallium_loader=yes
fi
if test "x$enable_gallium_gbm" = xyes || test "x$enable_opencl" = xyes; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS pipe-loader"
fi
dnl
dnl Gallium configuration
dnl
@ -2078,6 +2082,7 @@ AC_CONFIG_FILES([configs/current
src/gallium/targets/egl-static/Makefile
src/gallium/targets/gbm/Makefile
src/gallium/targets/opencl/Makefile
src/gallium/targets/pipe-loader/Makefile
src/gallium/targets/libgl-xlib/Makefile
src/gallium/targets/vdpau-nouveau/Makefile
src/gallium/targets/vdpau-r300/Makefile

View File

@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = subdir-objects
AM_CPPFLAGS = \
$(GALLIUM_PIPE_LOADER_DEFINES) \
-DMESA_VERSION=\"$(MESA_VERSION)\" \
-DPIPE_SEARCH_DIR=\"$(OPENCL_LIB_INSTALL_DIR)\" \
-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\" \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/gallium/include \
-I$(top_srcdir)/src/gallium/drivers \

View File

@ -30,7 +30,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/gbm/main \
-I$(top_srcdir)/src/gallium/winsys \
$(GALLIUM_PIPE_LOADER_DEFINES) \
-DPIPE_SEARCH_DIR=\"$(gbmdir)\"
-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
AM_CFLAGS = \
$(GALLIUM_CFLAGS) \

View File

@ -41,12 +41,6 @@ all-local: libOpenCL.la
$(MKDIR_P) $(top_builddir)/$(LIB_DIR)
ln -f .libs/libOpenCL.so* $(top_builddir)/$(LIB_DIR)/
install-exec-local:
@$(MAKE) -C $(PIPE_SRC_DIR) PIPE_INSTALL_DIR=$(OPENCL_LIB_INSTALL_DIR) install
clean-local:
@$(MAKE) -C $(PIPE_SRC_DIR) clean
# FIXME: Remove when the rest of Gallium is converted to automake.
TOP=$(top_builddir)
default: all

View File

@ -0,0 +1 @@
Makefile

View File

@ -1,179 +0,0 @@
# Makefile for building pipe driver shared libraries.
#
# Input variables: PIPE_INSTALL_DIR, PIPE_PREFIX (optional)
#
TOP = ../../../..
include $(TOP)/configs/current
PIPE_PREFIX ?= pipe_
PIPE_CPPFLAGS = \
-DGALLIUM_RBUG \
-DGALLIUM_TRACE \
-DGALLIUM_GALAHAD \
-I$(TOP)/include \
-I$(TOP)/src/gallium/auxiliary \
-I$(TOP)/src/gallium/drivers \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/winsys
PIPE_LIBS = \
$(TOP)/src/gallium/drivers/identity/libidentity.a \
$(TOP)/src/gallium/drivers/galahad/libgalahad.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/rbug/librbug.a \
$(GALLIUM_AUXILIARIES)
PIPE_SYS = $(LIBDRM_LIBS) -lm -lpthread $(CLOCK_LIB) $(DLOPEN_LIBS)
PIPE_CFLAGS = $(LIBDRM_CFLAGS)
PIPE_LDFLAGS = -Wl,--no-undefined
# i915 pipe driver
i915_LIBS = \
$(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
$(TOP)/src/gallium/drivers/i915/libi915.a
i915_SYS = $(INTEL_LIBS)
# nouveau pipe driver
nouveau_LIBS = \
$(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
$(TOP)/src/gallium/drivers/nv30/libnv30.a \
$(TOP)/src/gallium/drivers/nv50/libnv50.a \
$(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
$(TOP)/src/gallium/drivers/nouveau/libnouveau.a
nouveau_SYS = $(NOUVEAU_LIBS)
# r300 pipe driver
r300_LIBS = \
$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/r300/libr300-helper.a \
$(TOP)/src/gallium/drivers/r300/libr300.a
r300_SYS += $(RADEON_LIBS)
# r600 pipe driver
r600_LIBS = \
$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/r600/libr600.a
r600_SYS += $(RADEON_LIBS)
# radeonsi pipe driver
radeonsi_LIBS = \
$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/radeonsi/libradeonsi.a
radeonsi_SYS += $(RADEON_LIBS)
# vmwgfx pipe driver
vmwgfx_LIBS = \
$(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
$(TOP)/src/gallium/drivers/svga/libsvga.a
ifneq ($(findstring llvmpipe,$(GALLIUM_DRIVERS_DIRS)),)
swrast_LIBS = $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
PIPE_CFLAGS += -DGALLIUM_LLVMPIPE
else ifneq ($(findstring softpipe,$(GALLIUM_DRIVERS_DIRS)),)
swrast_LIBS = $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
PIPE_CFLAGS += -DGALLIUM_SOFTPIPE
endif
# LLVM
ifeq ($(MESA_LLVM),1)
PIPE_SYS += $(LLVM_LIBS)
PIPE_LDFLAGS += $(LLVM_LDFLAGS)
endif
# determine the targets/sources
_PIPE_TARGETS_CC =
_PIPE_TARGETS_CXX =
PIPE_SOURCES =
ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
_PIPE_TARGETS_CC += $(PIPE_PREFIX)i915.so
PIPE_SOURCES += pipe_i915.c
endif
ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
_PIPE_TARGETS_CXX += $(PIPE_PREFIX)nouveau.so
PIPE_SOURCES += pipe_nouveau.c
endif
ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
ifneq ($(findstring r300,$(GALLIUM_DRIVERS_DIRS)),)
_PIPE_TARGETS_CC += $(PIPE_PREFIX)r300.so
PIPE_SOURCES += pipe_r300.c
endif
endif
ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
ifneq ($(findstring r600,$(GALLIUM_DRIVERS_DIRS)),)
_PIPE_TARGETS_CC += $(PIPE_PREFIX)r600.so
PIPE_SOURCES += pipe_r600.c
endif
endif
ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
ifneq ($(findstring radeonsi,$(GALLIUM_DRIVERS_DIRS)),)
_PIPE_TARGETS_CC += $(PIPE_PREFIX)radeonsi.so
PIPE_SOURCES += pipe_radeonsi.c
endif
endif
ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
_PIPE_TARGETS_CC += $(PIPE_PREFIX)vmwgfx.so
PIPE_SOURCES += pipe_vmwgfx.c
endif
ifneq ($(filter llvmpipe softpipe,$(GALLIUM_DRIVERS_DIRS)),)
_PIPE_TARGETS_CC += $(PIPE_PREFIX)swrast.so
PIPE_SOURCES += pipe_swrast.c
endif
PIPE_OBJECTS := $(PIPE_SOURCES:.c=.o)
ifeq ($(MESA_LLVM),1)
PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX) $(_PIPE_TARGETS_CC)
PIPE_TARGETS_CC =
else
PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX)
PIPE_TARGETS_CC = $(_PIPE_TARGETS_CC)
endif
PIPE_TARGETS = $(PIPE_TARGETS_CC) $(PIPE_TARGETS_CXX)
default: depend $(PIPE_TARGETS)
.SECONDEXPANSION:
$(PIPE_TARGETS_CC): $(PIPE_PREFIX)%.so: pipe_%.o $(PIPE_LIBS) $$(%_LIBS)
$(MKLIB) -o $@ -noprefix -linker '$(CC)' \
-ldflags '-L$(TOP)/$(LIB_DIR) $(PIPE_LDFLAGS) $(LDFLAGS)' \
$(MKLIB_OPTIONS) $< \
-Wl,--start-group $(PIPE_LIBS) $($*_LIBS) -Wl,--end-group \
$(PIPE_SYS) $($*_SYS)
$(PIPE_TARGETS_CXX): $(PIPE_PREFIX)%.so: pipe_%.o $(PIPE_LIBS) $$(%_LIBS)
$(MKLIB) -o $@ -noprefix -linker '$(CXX)' \
-ldflags '-L$(TOP)/$(LIB_DIR) $(PIPE_LDFLAGS) $(LDFLAGS)' \
$(MKLIB_OPTIONS) $< \
-Wl,--start-group $(PIPE_LIBS) $($*_LIBS) -Wl,--end-group \
$(PIPE_SYS) $($*_SYS)
$(PIPE_OBJECTS): %.o: %.c
$(CC) -c -o $@ $< $(PIPE_CPPFLAGS) $(PIPE_CFLAGS) $(CFLAGS)
install: $(PIPE_TARGETS)
$(INSTALL) -d $(DESTDIR)/$(PIPE_INSTALL_DIR)
for tgt in $(PIPE_TARGETS); do \
$(MINSTALL) "$$tgt" $(DESTDIR)/$(PIPE_INSTALL_DIR); \
done
clean:
rm -f $(PIPE_TARGETS) $(PIPE_OBJECTS) depend depend.bak
depend: $(PIPE_SOURCES)
rm -f depend
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(PIPE_CPPFLAGS) $(PIPE_SOURCES) 2>/dev/null
sinclude depend

View File

@ -0,0 +1,174 @@
# 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.
include $(top_srcdir)/src/gallium/Automake.inc
AM_CPPFLAGS = \
$(GALLIUM_CFLAGS) \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/gallium/drivers \
-I$(top_srcdir)/src/gallium/winsys \
$(LIBDRM_CFLAGS) \
-DGALLIUM_RBUG \
-DGALLIUM_TRACE \
-DGALLIUM_GALAHAD
pipedir = $(libdir)/gallium-pipe
pipe_LTLIBRARIES =
PIPE_LIBS = \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
$(DLOPEN_LIBS) \
$(CLOCK_LIB) \
-lpthread \
-lm
if HAVE_GALAHAD_GALLIUM
PIPE_LIBS += $(top_builddir)/src/gallium/drivers/galahad/libgalahad.la
endif
if HAVE_GALLIUM_I915
pipe_LTLIBRARIES += pipe_i915.la
pipe_i915_la_SOURCES = pipe_i915.c
pipe_i915_la_LIBADD = \
$(PIPE_LIBS) \
$(top_builddir)/src/gallium/winsys/i915/drm/libi915drm.la \
$(top_builddir)/src/gallium/drivers/i915/libi915.la \
$(LIBDRM_LIBS) \
$(INTEL_LIBS)
pipe_i915_la_LDFLAGS = -no-undefined -avoid-version -module
if HAVE_MESA_LLVM
nodist_EXTRA_pipe_i915_la_SOURCES = dummy.cpp
pipe_i915_la_LIBADD += $(LLVM_LIBS)
pipe_i915_la_LDFLAGS += $(LLVM_LDFLAGS)
endif
endif
if HAVE_GALLIUM_NOUVEAU
pipe_LTLIBRARIES += pipe_nouveau.la
pipe_nouveau_la_SOURCES = pipe_nouveau.c
nodist_EXTRA_pipe_nouveau_la_SOURCES = dummy.cpp
pipe_nouveau_la_LIBADD = \
$(PIPE_LIBS) \
$(top_builddir)/src/gallium/winsys/nouveau/drm/libnouveaudrm.la \
$(top_builddir)/src/gallium/drivers/nv30/libnv30.la \
$(top_builddir)/src/gallium/drivers/nv50/libnv50.la \
$(top_builddir)/src/gallium/drivers/nvc0/libnvc0.la \
$(top_builddir)/src/gallium/drivers/nouveau/libnouveau.la \
$(NOUVEAU_LIBS)
pipe_nouveau_la_LDFLAGS = -no-undefined -avoid-version -module
if HAVE_MESA_LLVM
pipe_nouveau_la_LIBADD += $(LLVM_LIBS)
pipe_nouveau_la_LDFLAGS += $(LLVM_LDFLAGS)
endif
endif
if HAVE_GALLIUM_R300
pipe_LTLIBRARIES += pipe_r300.la
pipe_r300_la_SOURCES = pipe_r300.c
nodist_EXTRA_pipe_r300_la_SOURCES = dummy.cpp
pipe_r300_la_LIBADD = \
$(PIPE_LIBS) \
$(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
$(top_builddir)/src/gallium/drivers/r300/libr300-helper.la \
$(top_builddir)/src/gallium/drivers/r300/libr300.la \
$(LIBDRM_LIBS) \
$(RADEON_LIBS)
pipe_r300_la_LDFLAGS = -no-undefined -avoid-version -module
if HAVE_MESA_LLVM
pipe_r300_la_LIBADD += $(LLVM_LIBS)
pipe_r300_la_LDFLAGS += $(LLVM_LDFLAGS)
endif
endif
if HAVE_GALLIUM_R600
pipe_LTLIBRARIES += pipe_r600.la
pipe_r600_la_SOURCES = pipe_r600.c
pipe_r600_la_LIBADD = \
$(PIPE_LIBS) \
$(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
$(top_builddir)/src/gallium/drivers/r600/libr600.la \
$(LIBDRM_LIBS) \
$(RADEON_LIBS)
pipe_r600_la_LDFLAGS = -no-undefined -avoid-version -module
if HAVE_MESA_LLVM
nodist_EXTRA_pipe_r600_la_SOURCES = dummy.cpp
pipe_r600_la_LIBADD += $(LLVM_LIBS)
pipe_r600_la_LDFLAGS += $(LLVM_LDFLAGS)
endif
endif
if HAVE_GALLIUM_RADEONSI
pipe_LTLIBRARIES += pipe_radeonsi.la
pipe_radeonsi_la_SOURCES = pipe_radeonsi.c
nodist_EXTRA_pipe_radeonsi_la_SOURCES = dummy.cpp
pipe_radeonsi_la_LIBADD = \
$(PIPE_LIBS) \
$(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
$(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
$(LIBDRM_LIBS) \
$(RADEON_LIBS)
pipe_radeonsi_la_LDFLAGS = -no-undefined -avoid-version -module
if HAVE_MESA_LLVM
pipe_radeonsi_la_LIBADD += $(LLVM_LIBS)
pipe_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS)
endif
endif
if HAVE_GALLIUM_SVGA
pipe_LTLIBRARIES += pipe_vmwgfx.la
pipe_vmwgfx_la_SOURCES = pipe_vmwgfx.c
pipe_vmwgfx_la_LIBADD = \
$(PIPE_LIBS) \
$(top_builddir)/src/gallium/winsys/svga/drm/libsvgadrm.la \
$(top_builddir)/src/gallium/drivers/svga/libsvga.la \
$(LIBDRM_LIBS)
pipe_vmwgfx_la_LDFLAGS = -no-undefined -avoid-version -module
if HAVE_MESA_LLVM
nodist_EXTRA_pipe_vmwgfx_la_SOURCES = dummy.cpp
pipe_vmwgfx_la_LIBADD += $(LLVM_LIBS)
pipe_vmwgfx_la_LDFLAGS += $(LLVM_LDFLAGS)
endif
endif
if HAVE_GALLIUM_LLVMPIPE
pipe_LTLIBRARIES += pipe_swrast.la
pipe_swrast_la_SOURCES = pipe_swrast.c
nodist_EXTRA_pipe_swrast_la_SOURCES = dummy.cpp
pipe_swrast_la_LIBADD = \
$(PIPE_LIBS) \
$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la \
$(LLVM_LIBS)
pipe_swrast_la_LDFLAGS = -no-undefined -avoid-version -module $(LLVM_LDFLAGS)
else
if HAVE_GALLIUM_SOFTPIPE
pipe_LTLIBRARIES += pipe_swrast.la
pipe_swrast_la_SOURCES = pipe_swrast.c
pipe_swrast_la_LIBADD = \
$(PIPE_LIBS) \
$(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la
pipe_swrast_la_LDFLAGS = -no-undefined -avoid-version -module
endif
endif