1cabdff1aSopenharmony_ci#!/bin/sh 2cabdff1aSopenharmony_ci 3cabdff1aSopenharmony_ci# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 4cabdff1aSopenharmony_ci# 5cabdff1aSopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a 6cabdff1aSopenharmony_ci# copy of this software and associated documentation files (the "Software"), 7cabdff1aSopenharmony_ci# to deal in the Software without restriction, including without limitation 8cabdff1aSopenharmony_ci# the rights to use, copy, modify, merge, publish, distribute, sublicense, 9cabdff1aSopenharmony_ci# and/or sell copies of the Software, and to permit persons to whom the 10cabdff1aSopenharmony_ci# Software is furnished to do so, subject to the following conditions: 11cabdff1aSopenharmony_ci# 12cabdff1aSopenharmony_ci# The above copyright notice and this permission notice shall be included in 13cabdff1aSopenharmony_ci# all copies or substantial portions of the Software. 14cabdff1aSopenharmony_ci# 15cabdff1aSopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16cabdff1aSopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17cabdff1aSopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18cabdff1aSopenharmony_ci# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19cabdff1aSopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20cabdff1aSopenharmony_ci# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21cabdff1aSopenharmony_ci# DEALINGS IN THE SOFTWARE. 22cabdff1aSopenharmony_ci 23cabdff1aSopenharmony_ciset -e 24cabdff1aSopenharmony_ci 25cabdff1aSopenharmony_ciOUT="$1" 26cabdff1aSopenharmony_ciIN="$2" 27cabdff1aSopenharmony_ciNAME="$(basename "$IN" | sed 's/\..*//')" 28cabdff1aSopenharmony_ci 29cabdff1aSopenharmony_ciprintf "const char %s_ptx[] = \\" "$NAME" > "$OUT" 30cabdff1aSopenharmony_ciecho >> "$OUT" 31cabdff1aSopenharmony_cised -e "$(printf 's/\r//g')" -e 's/["\\]/\\&/g' -e "$(printf 's/^/\t"/')" -e 's/$/\\n"/' < "$IN" >> "$OUT" 32cabdff1aSopenharmony_ciecho ";" >> "$OUT" 33cabdff1aSopenharmony_ci 34cabdff1aSopenharmony_ciexit 0 35