Unified · Split
| @@ -1,3 +1,5 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 1 | # Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | 3 | # Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. |
| 2 | # | 4 | # |
| 3 | # Permission is hereby granted, free of charge, to any person obtaining a | 5 | # Permission is hereby granted, free of charge, to any person obtaining a |
| @@ -22,15 +24,13 @@ set -e · 18 unmodified lines | |||
| 22 | 24 | ||
| 23 | OUT="$1" | 25 | OUT="$1" |
| 24 | IN="$2" | 26 | IN="$2" |
| 25 | NAME="$(basename "$IN")" | 27 | NAME="$(basename "$IN" | sed 's/\..*//')" |
| 26 | NAME="${NAME/.ptx/}" | ||
| 27 | 28 | ||
| 28 | echo -n "const char ${NAME}_ptx[] = \\" > "$OUT" | 29 | printf "const char %s_ptx[] = \\" "$NAME" > "$OUT" |
| 29 | while read LINE | 30 | while read LINE |
| 30 | do | 31 | do |
| 31 | echo -ne "\n\t\"$LINE\\\n\"" >> "$OUT" | 32 | printf "\n\t\"%s\\\n\"" "$(printf "%s" "$LINE" | sed 's/["\\]/\\&/g')" >> "$OUT" |
| 32 | done < "$IN" | 33 | done < "$IN" |
| 33 | echo ";" >> "$OUT" | 34 | printf ";\n" >> "$OUT" |
| 34 | 35 | ||
| 35 | exit 0 | 36 | exit 0 |
| 36 | |||