[PATCH xserver 1/5] hw: use links in git to share source files due to upcoming automake changes

Gaetan Nadon memsize at videotron.ca
Mon Feb 17 14:33:10 PST 2014


Automake 1.14 gives us warning about source code specified in *_SOURCES
that comes from directories other than the current one. It suggests to enable
the subdir-objects feature which only supports code in sub directories.

Automake is warning us because 2.0 version will turn on this feature by default
and cannot be turned off. It assumes the object is to be generated in the
subdirs and triggers the subdir-objects feature. There are two problems.

First, the $(top_srcdir) variable is not expanded, dependency tracking
is broken, and the build stops.
Second, the object code that is now written where the source file is gets
overwritten by the next DDX that shares the source file in its Makefile.
An example would hw/dmx and Xext for the panoramiX object code.
(It is not a problem today because without subdir-objects being enabled
the object code is generated where the Makefile is).

The solution the patch proposes is to use links in git to share the source
files. So in hw/dmx,
    miinitext.c -> ../../mi/miinitext.c

The Makefile will simply lists "miinitext.c" as opposed to
    $(top_srcdir)/mi/miinitext.c.
The will not trigger the subdir-objects feature, even in automake 2.0.

A side-effect of using links is that the tarball contains multiple real copies
of miinitext.c rather than several links to a single real file. The build runs
fine and you can create a tarball from the expanded tarball.

Note on dixmods:
The library source was referenced using $(top_builddir) rather than
$(top_srcdir) which appears to be a copy/paste error. This should in theory
have failed but it didn't. Automake appends a workaround:
`test -f '$(top_builddir)/fb/fbcmap_mi.c' ||
 echo '$(srcdir)/'`$(top_builddir)/fb/fbcmap_mi.c

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 hw/dmx/Makefile.am                  |    6 +++---
 hw/dmx/config/Makefile.am           |    4 ++--
 hw/dmx/config/dmxlog.c              |    1 +
 hw/dmx/config/strlcpy.c             |    1 +
 hw/dmx/fbcmap_mi.c                  |    1 +
 hw/dmx/miinitext.c                  |    1 +
 hw/dmx/panoramiX.c                  |    1 +
 hw/kdrive/src/Makefile.am           |    4 ++--
 hw/kdrive/src/fbcmap_mi.c           |    1 +
 hw/kdrive/src/miinitext.c           |    1 +
 hw/vfb/Makefile.am                  |    8 ++++----
 hw/vfb/dpmsstubs.c                  |    1 +
 hw/vfb/fbcmap_mi.c                  |    1 +
 hw/vfb/miinitext.c                  |    1 +
 hw/vfb/stubs.c                      |    1 +
 hw/xfree86/dixmods/Makefile.am      |    6 +++---
 hw/xfree86/dixmods/fbcmap_mi.c      |    1 +
 hw/xfree86/dixmods/miinitext.c      |    1 +
 hw/xnest/Makefile.am                |    8 ++++----
 hw/xnest/dpmsstubs.c                |    1 +
 hw/xnest/fbcmap_mi.c                |    1 +
 hw/xnest/miinitext.c                |    1 +
 hw/xnest/stubs.c                    |    1 +
 hw/xquartz/Makefile.am              |    4 ++--
 hw/xquartz/fbcmap_mi.c              |    1 +
 hw/xquartz/mach-startup/Makefile.am |    2 +-
 hw/xquartz/mach-startup/strndup.c   |    1 +
 hw/xquartz/miinitext.c              |    1 +
 hw/xwin/Makefile.am                 |    8 ++++----
 hw/xwin/dpmsstubs.c                 |    1 +
 hw/xwin/fbcmap_mi.c                 |    1 +
 hw/xwin/miinitext.c                 |    1 +
 hw/xwin/stubs.c                     |    1 +
 test/Makefile.am                    |    6 +++---
 test/dpmsstubs.c                    |    1 +
 test/miinitext.c                    |    1 +
 test/stubs.c                        |    1 +
 37 files changed, 55 insertions(+), 28 deletions(-)
 create mode 120000 hw/dmx/config/dmxlog.c
 create mode 120000 hw/dmx/config/strlcpy.c
 create mode 120000 hw/dmx/fbcmap_mi.c
 create mode 120000 hw/dmx/miinitext.c
 create mode 120000 hw/dmx/panoramiX.c
 create mode 120000 hw/kdrive/src/fbcmap_mi.c
 create mode 120000 hw/kdrive/src/miinitext.c
 create mode 120000 hw/vfb/dpmsstubs.c
 create mode 120000 hw/vfb/fbcmap_mi.c
 create mode 120000 hw/vfb/miinitext.c
 create mode 120000 hw/vfb/stubs.c
 create mode 120000 hw/xfree86/dixmods/fbcmap_mi.c
 create mode 120000 hw/xfree86/dixmods/miinitext.c
 create mode 120000 hw/xnest/dpmsstubs.c
 create mode 120000 hw/xnest/fbcmap_mi.c
 create mode 120000 hw/xnest/miinitext.c
 create mode 120000 hw/xnest/stubs.c
 create mode 120000 hw/xquartz/fbcmap_mi.c
 create mode 120000 hw/xquartz/mach-startup/strndup.c
 create mode 120000 hw/xquartz/miinitext.c
 create mode 120000 hw/xwin/dpmsstubs.c
 create mode 120000 hw/xwin/fbcmap_mi.c
 create mode 120000 hw/xwin/miinitext.c
 create mode 120000 hw/xwin/stubs.c
 create mode 120000 test/dpmsstubs.c
 create mode 120000 test/miinitext.c
 create mode 120000 test/stubs.c

diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
index a05af13..dc468a1 100644
--- a/hw/dmx/Makefile.am
+++ b/hw/dmx/Makefile.am
@@ -3,7 +3,7 @@ SUBDIRS = input config examples doc doxygen man
 bin_PROGRAMS = Xdmx
 
 if XINERAMA
-PANORAMIX_SRCS = $(top_srcdir)/Xext/panoramiX.c
+PANORAMIX_SRCS = panoramiX.c
 endif
 
 if GLX
@@ -64,8 +64,8 @@ Xdmx_SOURCES = dmx.c \
                dmxvisual.h \
                dmxwindow.c \
                dmxwindow.h \
-               $(top_srcdir)/mi/miinitext.c \
-               $(top_srcdir)/fb/fbcmap_mi.c \
+               miinitext.c \
+               fbcmap_mi.c \
                $(GLX_SRCS) 
 
 
diff --git a/hw/dmx/config/Makefile.am b/hw/dmx/config/Makefile.am
index 06588e7..74e740a 100644
--- a/hw/dmx/config/Makefile.am
+++ b/hw/dmx/config/Makefile.am
@@ -21,7 +21,7 @@ BUILT_SOURCES = parser.c parser.h scanner.c
 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
 
 libdmxconfig_a_SOURCES = $(LIBSRCS)
-libdmxconfig_a_SOURCES += $(top_srcdir)/os/strlcpy.c
+libdmxconfig_a_SOURCES += strlcpy.c
 
 if GLX
 GLX_DEFS = @GL_CFLAGS@
@@ -41,7 +41,7 @@ bin_PROGRAMS = xdmxconfig vdltodmx dmxtodmx
 xdmxconfig_DEPENDENCIES = libdmxconfig.a
 xdmxconfig_SOURCES = \
 	xdmxconfig.c \
-	$(top_srcdir)/hw/dmx/dmxlog.c \
+	dmxlog.c \
 	Canvas.c \
 	Canvas.h \
 	CanvasP.h
diff --git a/hw/dmx/config/dmxlog.c b/hw/dmx/config/dmxlog.c
new file mode 120000
index 0000000..07fa81f
--- /dev/null
+++ b/hw/dmx/config/dmxlog.c
@@ -0,0 +1 @@
+../../../hw/dmx/dmxlog.c
\ No newline at end of file
diff --git a/hw/dmx/config/strlcpy.c b/hw/dmx/config/strlcpy.c
new file mode 120000
index 0000000..722cfec
--- /dev/null
+++ b/hw/dmx/config/strlcpy.c
@@ -0,0 +1 @@
+../../../os/strlcpy.c
\ No newline at end of file
diff --git a/hw/dmx/fbcmap_mi.c b/hw/dmx/fbcmap_mi.c
new file mode 120000
index 0000000..587bd83
--- /dev/null
+++ b/hw/dmx/fbcmap_mi.c
@@ -0,0 +1 @@
+../../fb/fbcmap_mi.c
\ No newline at end of file
diff --git a/hw/dmx/miinitext.c b/hw/dmx/miinitext.c
new file mode 120000
index 0000000..32f438c
--- /dev/null
+++ b/hw/dmx/miinitext.c
@@ -0,0 +1 @@
+../../mi/miinitext.c
\ No newline at end of file
diff --git a/hw/dmx/panoramiX.c b/hw/dmx/panoramiX.c
new file mode 120000
index 0000000..5cb350e
--- /dev/null
+++ b/hw/dmx/panoramiX.c
@@ -0,0 +1 @@
+../../Xext/panoramiX.c
\ No newline at end of file
diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am
index 5799ddb..c8982bd 100644
--- a/hw/kdrive/src/Makefile.am
+++ b/hw/kdrive/src/Makefile.am
@@ -22,7 +22,7 @@ libkdrive_la_SOURCES =	\
 	kmode.c		\
 	kshadow.c	\
 	$(KDRIVE_XV_SOURCES) \
-        $(top_srcdir)/mi/miinitext.c
+        miinitext.c
 
 libkdrivestubs_la_SOURCES = \
-        $(top_srcdir)/fb/fbcmap_mi.c
+        fbcmap_mi.c
diff --git a/hw/kdrive/src/fbcmap_mi.c b/hw/kdrive/src/fbcmap_mi.c
new file mode 120000
index 0000000..6846307
--- /dev/null
+++ b/hw/kdrive/src/fbcmap_mi.c
@@ -0,0 +1 @@
+../../../fb/fbcmap_mi.c
\ No newline at end of file
diff --git a/hw/kdrive/src/miinitext.c b/hw/kdrive/src/miinitext.c
new file mode 120000
index 0000000..f813eed
--- /dev/null
+++ b/hw/kdrive/src/miinitext.c
@@ -0,0 +1 @@
+../../../mi/miinitext.c
\ No newline at end of file
diff --git a/hw/vfb/Makefile.am b/hw/vfb/Makefile.am
index 9f4992c..52d9206 100644
--- a/hw/vfb/Makefile.am
+++ b/hw/vfb/Makefile.am
@@ -9,12 +9,12 @@ AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
 
 SRCS =	InitInput.c \
 	InitOutput.c \
-	$(top_srcdir)/Xext/dpmsstubs.c \
-	$(top_srcdir)/Xi/stubs.c \
-	$(top_srcdir)/mi/miinitext.c
+	dpmsstubs.c \
+	stubs.c \
+	miinitext.c
 
 libfbcmap_a_CFLAGS = $(AM_CFLAGS)
-libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c
+libfbcmap_a_SOURCES = fbcmap_mi.c
 
 Xvfb_SOURCES = $(SRCS)
 
diff --git a/hw/vfb/dpmsstubs.c b/hw/vfb/dpmsstubs.c
new file mode 120000
index 0000000..ae4697e
--- /dev/null
+++ b/hw/vfb/dpmsstubs.c
@@ -0,0 +1 @@
+../../Xext/dpmsstubs.c
\ No newline at end of file
diff --git a/hw/vfb/fbcmap_mi.c b/hw/vfb/fbcmap_mi.c
new file mode 120000
index 0000000..587bd83
--- /dev/null
+++ b/hw/vfb/fbcmap_mi.c
@@ -0,0 +1 @@
+../../fb/fbcmap_mi.c
\ No newline at end of file
diff --git a/hw/vfb/miinitext.c b/hw/vfb/miinitext.c
new file mode 120000
index 0000000..32f438c
--- /dev/null
+++ b/hw/vfb/miinitext.c
@@ -0,0 +1 @@
+../../mi/miinitext.c
\ No newline at end of file
diff --git a/hw/vfb/stubs.c b/hw/vfb/stubs.c
new file mode 120000
index 0000000..71a6c88
--- /dev/null
+++ b/hw/vfb/stubs.c
@@ -0,0 +1 @@
+../../Xi/stubs.c
\ No newline at end of file
diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am
index 3c43640..9c55f5e 100644
--- a/hw/xfree86/dixmods/Makefile.am
+++ b/hw/xfree86/dixmods/Makefile.am
@@ -19,12 +19,12 @@ AM_CPPFLAGS = @XORG_INCS@ \
 
 libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
 libfb_la_LIBADD = $(top_builddir)/fb/libfb.la
-libfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c
+libfb_la_SOURCES = fbcmap_mi.c fbmodule.c
 libfb_la_CFLAGS = $(AM_CFLAGS)
 
 libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
 libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la
-libwfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c
+libwfb_la_SOURCES = fbcmap_mi.c fbmodule.c
 libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
 
 libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
@@ -44,7 +44,7 @@ libshadow_la_LIBADD += libfb.la
 endif
 libshadow_la_SOURCES = shmodule.c
 
-libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c
+libdixmods_la_SOURCES = miinitext.c
 libdixmods_la_CFLAGS = $(AM_CFLAGS)
 
 libxorgxkb_la_SOURCES = xkbVT.c xkbPrivate.c xkbKillSrv.c
diff --git a/hw/xfree86/dixmods/fbcmap_mi.c b/hw/xfree86/dixmods/fbcmap_mi.c
new file mode 120000
index 0000000..6846307
--- /dev/null
+++ b/hw/xfree86/dixmods/fbcmap_mi.c
@@ -0,0 +1 @@
+../../../fb/fbcmap_mi.c
\ No newline at end of file
diff --git a/hw/xfree86/dixmods/miinitext.c b/hw/xfree86/dixmods/miinitext.c
new file mode 120000
index 0000000..f813eed
--- /dev/null
+++ b/hw/xfree86/dixmods/miinitext.c
@@ -0,0 +1 @@
+../../../mi/miinitext.c
\ No newline at end of file
diff --git a/hw/xnest/Makefile.am b/hw/xnest/Makefile.am
index 3c099cd..2667748 100644
--- a/hw/xnest/Makefile.am
+++ b/hw/xnest/Makefile.am
@@ -42,11 +42,11 @@ SRCS =	Args.c \
 	XNPixmap.h \
 	XNWindow.h \
 	xnest-config.h \
-	$(top_srcdir)/Xext/dpmsstubs.c \
-	$(top_srcdir)/Xi/stubs.c \
-	$(top_srcdir)/mi/miinitext.c
+	dpmsstubs.c \
+	stubs.c \
+	miinitext.c
 
-libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c
+libfbcmap_a_SOURCES = fbcmap_mi.c
 libfbcmap_a_CFLAGS = $(AM_CFLAGS)
 
 XNEST_LIBS = \
diff --git a/hw/xnest/dpmsstubs.c b/hw/xnest/dpmsstubs.c
new file mode 120000
index 0000000..ae4697e
--- /dev/null
+++ b/hw/xnest/dpmsstubs.c
@@ -0,0 +1 @@
+../../Xext/dpmsstubs.c
\ No newline at end of file
diff --git a/hw/xnest/fbcmap_mi.c b/hw/xnest/fbcmap_mi.c
new file mode 120000
index 0000000..587bd83
--- /dev/null
+++ b/hw/xnest/fbcmap_mi.c
@@ -0,0 +1 @@
+../../fb/fbcmap_mi.c
\ No newline at end of file
diff --git a/hw/xnest/miinitext.c b/hw/xnest/miinitext.c
new file mode 120000
index 0000000..32f438c
--- /dev/null
+++ b/hw/xnest/miinitext.c
@@ -0,0 +1 @@
+../../mi/miinitext.c
\ No newline at end of file
diff --git a/hw/xnest/stubs.c b/hw/xnest/stubs.c
new file mode 120000
index 0000000..71a6c88
--- /dev/null
+++ b/hw/xnest/stubs.c
@@ -0,0 +1 @@
+../../Xi/stubs.c
\ No newline at end of file
diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 2ca953c..5caa4d9 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -20,8 +20,8 @@ SUBDIRS = bundle . $(GL_DIR) xpr pbproxy mach-startup man
 DIST_SUBDIRS = bundle . GL xpr pbproxy mach-startup man
 
 libXquartz_la_SOURCES = \
-	$(top_srcdir)/fb/fbcmap_mi.c \
-	$(top_srcdir)/mi/miinitext.c \
+	fbcmap_mi.c \
+	miinitext.c \
 	X11Application.m \
 	X11Controller.m \
 	applewm.c \
diff --git a/hw/xquartz/fbcmap_mi.c b/hw/xquartz/fbcmap_mi.c
new file mode 120000
index 0000000..587bd83
--- /dev/null
+++ b/hw/xquartz/fbcmap_mi.c
@@ -0,0 +1 @@
+../../fb/fbcmap_mi.c
\ No newline at end of file
diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am
index 77962b1..1ef95c5 100644
--- a/hw/xquartz/mach-startup/Makefile.am
+++ b/hw/xquartz/mach-startup/Makefile.am
@@ -16,7 +16,7 @@ dist_X11_bin_SOURCES = \
 # with the case where we build on Lion but target Snow Leopard as the minimum
 # OS version.
 #if NEED_STRNDUP
-dist_X11_bin_SOURCES += $(top_srcdir)/os/strndup.c
+dist_X11_bin_SOURCES += strndup.c
 #endif
 
 nodist_X11_bin_SOURCES = \
diff --git a/hw/xquartz/mach-startup/strndup.c b/hw/xquartz/mach-startup/strndup.c
new file mode 120000
index 0000000..cef9d58
--- /dev/null
+++ b/hw/xquartz/mach-startup/strndup.c
@@ -0,0 +1 @@
+../../../os/strndup.c
\ No newline at end of file
diff --git a/hw/xquartz/miinitext.c b/hw/xquartz/miinitext.c
new file mode 120000
index 0000000..32f438c
--- /dev/null
+++ b/hw/xquartz/miinitext.c
@@ -0,0 +1 @@
+../../mi/miinitext.c
\ No newline at end of file
diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am
index 7f0eaf0..9be8eea 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -127,10 +127,10 @@ SRCS =	InitInput.c \
 	winresource.h \
 	winwindow.h \
 	XWin.rc \
-	$(top_srcdir)/Xext/dpmsstubs.c \
-	$(top_srcdir)/Xi/stubs.c \
-	$(top_srcdir)/mi/miinitext.c \
-	$(top_srcdir)/fb/fbcmap_mi.c \
+	dpmsstubs.c \
+	stubs.c \
+	miinitext.c \
+	fbcmap_mi.c \
 	$(SRCS_CLIPBOARD) \
 	$(SRCS_MULTIWINDOW) \
 	$(SRCS_MULTIWINDOWEXTWM) \
diff --git a/hw/xwin/dpmsstubs.c b/hw/xwin/dpmsstubs.c
new file mode 120000
index 0000000..ae4697e
--- /dev/null
+++ b/hw/xwin/dpmsstubs.c
@@ -0,0 +1 @@
+../../Xext/dpmsstubs.c
\ No newline at end of file
diff --git a/hw/xwin/fbcmap_mi.c b/hw/xwin/fbcmap_mi.c
new file mode 120000
index 0000000..587bd83
--- /dev/null
+++ b/hw/xwin/fbcmap_mi.c
@@ -0,0 +1 @@
+../../fb/fbcmap_mi.c
\ No newline at end of file
diff --git a/hw/xwin/miinitext.c b/hw/xwin/miinitext.c
new file mode 120000
index 0000000..32f438c
--- /dev/null
+++ b/hw/xwin/miinitext.c
@@ -0,0 +1 @@
+../../mi/miinitext.c
\ No newline at end of file
diff --git a/hw/xwin/stubs.c b/hw/xwin/stubs.c
new file mode 120000
index 0000000..71a6c88
--- /dev/null
+++ b/hw/xwin/stubs.c
@@ -0,0 +1 @@
+../../Xi/stubs.c
\ No newline at end of file
diff --git a/test/Makefile.am b/test/Makefile.am
index 2852bb3..5b5700c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -71,9 +71,9 @@ endif
 else
 nodist_libxservertest_la_SOURCES = \
             ddxstubs.c \
-            $(top_srcdir)/mi/miinitext.c \
-            $(top_srcdir)/Xext/dpmsstubs.c \
-            $(top_srcdir)/Xi/stubs.c
+            miinitext.c \
+            dpmsstubs.c \
+            stubs.c
 
 libxservertest_la_LIBADD += \
             $(top_builddir)/damageext/libdamageext.la \
diff --git a/test/dpmsstubs.c b/test/dpmsstubs.c
new file mode 120000
index 0000000..927321b
--- /dev/null
+++ b/test/dpmsstubs.c
@@ -0,0 +1 @@
+../Xext/dpmsstubs.c
\ No newline at end of file
diff --git a/test/miinitext.c b/test/miinitext.c
new file mode 120000
index 0000000..7fe401c
--- /dev/null
+++ b/test/miinitext.c
@@ -0,0 +1 @@
+../mi/miinitext.c
\ No newline at end of file
diff --git a/test/stubs.c b/test/stubs.c
new file mode 120000
index 0000000..7bc27ea
--- /dev/null
+++ b/test/stubs.c
@@ -0,0 +1 @@
+../Xi/stubs.c
\ No newline at end of file
-- 
1.7.9.5



More information about the xorg-devel mailing list