summaryrefslogtreecommitdiffstats
path: root/build/embed.sh
blob: c0744f67d36a85d5810883a2cf9de63604505494 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh

# Copyright © Tavian Barnes <tavianator@tavianator.com>
# SPDX-License-Identifier: 0BSD

# Convert data into a C array like #embed

set -eu

{ cat; printf '\0'; } \
    | od -An -tx1 \
    | sed 's/[^ ][^ ]*/0x&,/g'