[patch] Fix Solaris make gdb/data-directory/ compat. [Re: [rfa/rfc] Build libcommon.a for gdb and gdbserver]

Jan Kratochvil
2011-03-06T19:05:56Z

On Sun, 06 Mar 2011 18:23:00 +0100, Andreas Schwab wrote:
> The problem here is that $(PYTHON_FILES) appears as prerequisite of the
> rule and the files are found via VPATH, so Solaris make modified the
> expansion of $(PYTHON_FILES) to prefix it with the VPATH, causing
> PYTHON_SRCDIR to appear twice. (*Note (autoconf) Automatic Rule Rewriting::)
* Automatic Rule Rewriting:: `VPATH' goes wild on Solaris

Thanks for the explanatory documentation reference.

Fixed it on OpenSolaris with /usr/bin/make and checked it is still compatible
with GNU/Linux. Checked both the in-tree and out-of-tree compilation and
installation. Checked out-of-tree build directory in a different number of
subdirectories than the srcdir.

I will even check it in with no comments in some time but a review would be
better.

Thanks,
Jan

gdb/
2011-03-06 Jan Kratochvil <jan.kratochvil@redhat.com>

Fix Solaris make compatibility.
* data-directory/Makefile.in (stamp-syscalls): Copy the files
unconditionally. Drop variable files. Use $^, skip Makefile.
(install-syscalls): Copy the files unconditionally.
(stamp-python): Use $^, skip Makefile. New variable file_pure.

@@ -98,12 +98,9 @@ all: stamp-syscalls stamp-python
stamp-syscalls: Makefile $(SYSCALLS_FILES)
rm -rf ./$(SYSCALLS_DIR)
mkdir ./$(SYSCALLS_DIR)
- files='$(SYSCALLS_FILES)' ; \
- for file in $$files ; do \
- f=$(SYSCALLS_SRCDIR)/$$file ; \
- if test -f $$f ; then \
- $(INSTALL_DATA) $$f ./$(SYSCALLS_DIR) ; \
- fi ; \
+ for f in $^ ; do \
+ if test "$$f" = Makefile; then continue; fi; \
+ $(INSTALL_DATA) $$f ./$(SYSCALLS_DIR) ; \
done
touch $@

@@ -120,9 +117,7 @@ install-syscalls:
files='$(SYSCALLS_FILES)' ; \
for file in $$files; do \
f=$(SYSCALLS_SRCDIR)/$$file ; \
- if test -f $$f ; then \
- $(INSTALL_DATA) $$f $(SYSCALLS_INSTALL_DIR) ; \
- fi ; \
+ $(INSTALL_DATA) $$f $(SYSCALLS_INSTALL_DIR) ; \
done

.PHONY: uninstall-syscalls
@@ -140,11 +135,13 @@ uninstall-syscalls:

stamp-python: Makefile $(PYTHON_FILES)
rm -rf ./$(PYTHON_DIR)
- files='$(PYTHON_FILES)' ; \
+ files='$^' ; \
for file in $$files ; do \
- dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
+ if test "$$file" = Makefile; then continue; fi; \
+ file_pure=`echo "$$file" | sed 's,^$(PYTHON_SRCDIR)/*,,'` ; \
+ dir=`echo "$$file_pure" | sed 's,/[^/]*$$,,'` ; \
$(INSTALL_DIR) ./$(PYTHON_DIR)/$$dir ; \
- $(INSTALL_DATA) $(PYTHON_SRCDIR)/$$file ./$(PYTHON_DIR)/$$dir ; \
+ $(INSTALL_DATA) $$file ./$(PYTHON_DIR)/$$dir ; \
done
touch $@