Matthias Andreas Benkard | f59e097 | 2018-04-10 22:01:34 +0200 | [diff] [blame] | 1 | # Copyright 2015 Andrew Gottemoller. |
| 2 | # |
| 3 | # This software is a copyrighted work licensed under the terms of the |
| 4 | # Weld license. Please consult the file "WELD_LICENSE" for |
| 5 | # details. |
| 6 | |
| 7 | # This makefile defines sh specific functionality used throughout weld |
| 8 | |
| 9 | |
| 10 | # Convert a native path name to a universal representation |
| 11 | path_to_universal = $(1) |
| 12 | |
| 13 | # Convert a universtal path name to the native representation |
| 14 | path_to_native = $(1) |
| 15 | |
| 16 | # Find all files of the specified name beneath the specified path |
| 17 | find_files = $(strip $(call path_to_universal,$(shell find $(call path_to_native,$(1)) -name $(call path_to_native,$(2))))) |
| 18 | |
| 19 | # Create a symlink to a file (requires passing --check-symlink-times on make command line) |
| 20 | # soft_copy = $(strip ln -s -f $(call path_to_native,$(abspath $(1)) $(abspath $(2)))) |
| 21 | soft_copy = $(strip cp $(call path_to_native,$(1) $(2))) |
| 22 | |
| 23 | # Make an actual copy of a file |
| 24 | hard_copy = $(strip cp $(call path_to_native,$(1) $(2))) |
| 25 | |
| 26 | # Remove files which exist |
| 27 | remove_files = $(strip $(if $(wildcard $(1)),rm -f $(call path_to_native,$(wildcard $(1))),)) |
| 28 | |
| 29 | # Create a directory tree |
| 30 | make_directory = $(strip $(if $(wildcard $(1)),,mkdir -p $(call path_to_native,$(1)))) |
| 31 | |
| 32 | # Remove directory that exists |
| 33 | remove_directory = $(strip $(if $(wildcard $(1)),rm -rf $(call path_to_native,$(wildcard $(1))),)) |
| 34 | |
| 35 | # Print to stdout |
| 36 | print = echo $(1) |