Port: Fixes to build system for portability
[urcu.git] / doc / examples / Makefile.am
index 5ad70f45d88cbcd2e687fbf069849c29e735c832..313f5215b254f908eeab9502f455ef67ef3a41b6 100644 (file)
@@ -122,21 +122,35 @@ SUBDIRS_PROXY = hlist list urcu-flavors wfcqueue rculfqueue \
 # Copies are for VPATH build support.
 all-local:
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-               cp -fR $(srcdir)/dist-files $(builddir); \
-               cp -f $(srcdir)/Makefile.examples.template $(builddir); \
+               cp -pfR $(srcdir)/dist-files $(builddir); \
+               cp -pf $(srcdir)/Makefile.examples.template $(builddir); \
                for subdir in $(SUBDIRS_PROXY); do \
-                       cp -fR $(srcdir)/$$subdir $(builddir); \
+                       cp -pfR $(srcdir)/$$subdir $(builddir); \
                done; \
-       fi
-       $(MAKE) -f dist-files/Makefile AM_CPPFLAGS="-I../../../urcu/ -I../../../" AM_LDFLAGS='-L../../../.libs/ -Wl,-rpath="$(PWD)/../../.libs/"' $(AM_MAKEFLAGS) all
+       fi; \
+       if [ x"$(shell echo "$(top_srcdir)" | $(GREP) "^/" | wc -l)" = x"1" ]; then \
+               echo "Examples: absolute top_srcdir path $(top_srcdir)"; \
+               rel_src_subdir=""; \
+       else \
+               echo "Examples: relative top_srcdir path $(top_srcdir)"; \
+               rel_src_subdir="../"; \
+       fi; \
+       if [ x"$(shell echo "$(top_builddir)" | $(GREP) "^/" | wc -l)" = x"1" ]; then \
+               echo "Examples: absolute top_builddir path $(top_builddir)"; \
+               rel_build_subdir=""; \
+       else \
+               echo "Examples: relative top_builddir path $(top_builddir)"; \
+               rel_build_subdir="../"; \
+       fi; \
+       $(MAKE) -f dist-files/Makefile AM_CC="$(CC)" AM_CPPFLAGS="$(CPPFLAGS) -I$$rel_src_subdir/$(top_srcdir)/ -I$$rel_build_subdir$(top_builddir)/" AM_CFLAGS='$(CFLAGS)' AM_LDFLAGS='$(LDFLAGS) -L../../../.libs/ -Wl,-rpath "$(PWD)/../../.libs/"' $(AM_MAKEFLAGS) all;
 
 clean-local:
-       $(MAKE) -f dist-files/Makefile $(AM_MAKEFLAGS) clean
-       @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+       @$(MAKE) -f dist-files/Makefile $(AM_MAKEFLAGS) clean; \
+       if [ x"$(srcdir)" != x"$(builddir)" ]; then \
                for subdir in $(SUBDIRS_PROXY); do \
                        rm -rf $(builddir)/$$subdir; \
                done; \
                rm -f $(builddir)/Makefile.examples.template; \
                rm -rf $(builddir)/dist-files; \
-       fi
+       fi;
 endif
This page took 0.023385 seconds and 4 git commands to generate.