From cbecd958a7e36736a4447ebe65e5017e5c0ea4a0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 29 Jan 2014 11:40:25 -0800 Subject: [PATCH] build: Share the all-local rule for linking libraries into the build dir MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This consolidates how we link the libraries into the build directory. It works for lib_LTLIBRARIES but not custom shared libraries like DRI drivers or gallium state trackers which needs special casing (cf dri mega drivers, for example) Signed-off-by: Kristian Høgsberg Reviewed-by: Matt Turner --- install-lib-links.mk | 14 ++++++++++++++ src/egl/main/Makefile.am | 7 +------ src/gbm/Makefile.am | 5 +---- src/glx/Makefile.am | 7 +------ src/mapi/es1api/Makefile.am | 8 +------- src/mapi/es2api/Makefile.am | 8 +------- src/mapi/shared-glapi/Makefile.am | 6 +----- src/mapi/vgapi/Makefile.am | 8 +------- 8 files changed, 21 insertions(+), 42 deletions(-) create mode 100644 install-lib-links.mk diff --git a/install-lib-links.mk b/install-lib-links.mk new file mode 100644 index 00000000000..73d9e14e6f3 --- /dev/null +++ b/install-lib-links.mk @@ -0,0 +1,14 @@ +# 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 : .libs/install-mesa-links + +.libs/install-mesa-links : $(lib_LTLIBRARIES) + $(MKDIR_P) $(top_builddir)/$(LIB_DIR) + for f in $(lib_LTLIBRARIES:%.la=.libs/%.so*); do \ + if test -h .libs/$$f; then \ + cp -d $$f $(top_builddir)/$(LIB_DIR); \ + else \ + ln -f $$f $(top_builddir)/$(LIB_DIR); \ + fi; \ + done && touch $@ diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am index e12aeae59b9..4c20d1215ee 100644 --- a/src/egl/main/Makefile.am +++ b/src/egl/main/Makefile.am @@ -115,12 +115,7 @@ libEGL_la_LIBADD += ../drivers/dri2/libegl_dri2.la libEGL_la_LIBADD += $(DLOPEN_LIBS) $(LIBDRM_LIBS) endif -# 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: libEGL.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR); - ln -f .libs/libEGL.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libEGL.so.1 - ln -sf libEGL.so.1 $(top_builddir)/$(LIB_DIR)/libEGL.so +include $(top_srcdir)/install-lib-links.mk pkgconfigdir = $(libdir)/pkgconfig diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am index de5126c0243..eacb96a38e6 100644 --- a/src/gbm/Makefile.am +++ b/src/gbm/Makefile.am @@ -47,7 +47,4 @@ libgbm_la_LIBADD += \ libgbm_dri.la $(top_builddir)/src/mapi/shared-glapi/libglapi.la $(LIBDRM_LIBS) endif -all-local: libgbm.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR); - ln -f .libs/libgbm.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libgbm.so - ln -f .libs/libgbm.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libgbm.so.1 +include $(top_srcdir)/install-lib-links.mk diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am index 54a0cc027da..c8dfb8651b6 100644 --- a/src/glx/Makefile.am +++ b/src/glx/Makefile.am @@ -118,9 +118,4 @@ lib@GL_LIB@_la_SOURCES = lib@GL_LIB@_la_LIBADD = $(GL_LIBS) lib@GL_LIB@_la_LDFLAGS = $(GL_LDFLAGS) -# 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: lib@GL_LIB@.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR); - ln -f .libs/lib@GL_LIB@.so.1.2.0 $(top_builddir)/$(LIB_DIR)/lib@GL_LIB@.so.1 - ln -sf lib@GL_LIB@.so.1 $(top_builddir)/$(LIB_DIR)/lib@GL_LIB@.so +include $(top_srcdir)/install-lib-links.mk diff --git a/src/mapi/es1api/Makefile.am b/src/mapi/es1api/Makefile.am index eb98f165aa9..b61f9cb1f66 100644 --- a/src/mapi/es1api/Makefile.am +++ b/src/mapi/es1api/Makefile.am @@ -57,10 +57,4 @@ glapi_mapi_tmp.h: ../glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps) BUILT_SOURCES = glapi_mapi_tmp.h CLEANFILES = $(BUILT_SOURCES) -# 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: libGLESv1_CM.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR); - ln -f .libs/libGLESv1_CM.so $(top_builddir)/$(LIB_DIR)/libGLESv1_CM.so - ln -f .libs/libGLESv1_CM.so.1 $(top_builddir)/$(LIB_DIR)/libGLESv1_CM.so.1 - ln -f .libs/libGLESv1_CM.so.1.1.0 $(top_builddir)/$(LIB_DIR)/libGLESv1_CM.so.1.1.0 +include $(top_srcdir)/install-lib-links.mk diff --git a/src/mapi/es2api/Makefile.am b/src/mapi/es2api/Makefile.am index c6b0ca4ac3c..a9444937505 100644 --- a/src/mapi/es2api/Makefile.am +++ b/src/mapi/es2api/Makefile.am @@ -61,10 +61,4 @@ glapi_mapi_tmp.h: ../glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps) BUILT_SOURCES = glapi_mapi_tmp.h CLEANFILES = $(BUILT_SOURCES) -# 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: libGLESv2.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR); - ln -f .libs/libGLESv2.so $(top_builddir)/$(LIB_DIR)/libGLESv2.so - ln -f .libs/libGLESv2.so.2 $(top_builddir)/$(LIB_DIR)/libGLESv2.so.2 - ln -f .libs/libGLESv2.so.2.0.0 $(top_builddir)/$(LIB_DIR)/libGLESv2.so.2.0.0 +include $(top_srcdir)/install-lib-links.mk diff --git a/src/mapi/shared-glapi/Makefile.am b/src/mapi/shared-glapi/Makefile.am index e18c30a2271..b4703be010d 100644 --- a/src/mapi/shared-glapi/Makefile.am +++ b/src/mapi/shared-glapi/Makefile.am @@ -27,8 +27,4 @@ AM_CPPFLAGS = \ -DMAPI_MODE_GLAPI \ -DMAPI_ABI_HEADER=\"shared-glapi/glapi_mapi_tmp.h\" -all-local: libglapi.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR) - ln -f .libs/libglapi.so.0.0.0 $(top_builddir)/$(LIB_DIR)/libglapi.so.0.0.0 - ln -sf libglapi.so.0.0.0 $(top_builddir)/$(LIB_DIR)/libglapi.so.0 - ln -sf libglapi.so.0 $(top_builddir)/$(LIB_DIR)/libglapi.so +include $(top_srcdir)/install-lib-links.mk diff --git a/src/mapi/vgapi/Makefile.am b/src/mapi/vgapi/Makefile.am index 0af7115eb70..8952df01af3 100644 --- a/src/mapi/vgapi/Makefile.am +++ b/src/mapi/vgapi/Makefile.am @@ -52,10 +52,4 @@ vgapi_tmp.h: $(srcdir)/vgapi.csv $(top_srcdir)/src/mapi/mapi_abi.py BUILT_SOURCES = vgapi_tmp.h CLEANFILES = $(BUILT_SOURCES) -# 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: libOpenVG.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR); - ln -f .libs/libOpenVG.so $(top_builddir)/$(LIB_DIR)/libOpenVG.so - ln -f .libs/libOpenVG.so.1 $(top_builddir)/$(LIB_DIR)/libOpenVG.so.1 - ln -f .libs/libOpenVG.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libOpenVG.so.1.0.0 +include $(top_srcdir)/install-lib-links.mk -- 2.30.2