< prev index next >

make/CopyImportModules.gmk

Print this page

        

@@ -57,13 +57,28 @@
     TARGETS += $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB)
   else
     $(eval $(call SetupCopyFiles, COPY_LIBS, \
         SRC := $(LIBS_DIR), \
         DEST := $(JDK_OUTPUTDIR)/lib, \
-        FILES := $(call CacheFind, $(LIBS_DIR)), \
+        FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
     ))
-    TARGETS += $(COPY_LIBS)
+
+    # Use relative links if the import dir is inside the OUTPUT_ROOT, otherwise
+    # copy to avoid having automated systems following symlinks when deleting files,
+    # or risk invalidating the build output from external changes.
+    ifeq ($(filter $(OUTPUT_ROOT)/%, $(LIBS_DIR)), )
+      LINK_MACRO := install-file
+    else
+      LINK_MACRO := link-file-relative
+    endif
+    $(eval $(call SetupCopyFiles, LINK_LIBS, \
+        SRC := $(LIBS_DIR), \
+        DEST := $(JDK_OUTPUTDIR)/lib, \
+        FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
+        MACRO := $(LINK_MACRO), \
+    ))
+    TARGETS += $(COPY_LIBS) $(LINK_LIBS)
   endif
 endif
 
 ifneq ($(CMDS_DIR), )
   $(eval $(call SetupCopyFiles, COPY_CMDS, \
< prev index next >