#!/bin/sh input="$1" base="$2" # assembly (used to compile data with custom symbol name) cat << EOF > "$base.s" .section .rodata .global ${base}_head ${base}_head: .incbin "$input" EOF # C header cat << EOF > "$base.h" #pragma once // NOTE: THIS FILE IS GENERATED, DO NOT EDIT #include extern const char ${base}_head; static const char* ${base} = &${base}_head; static const size_t ${base}_size = $(wc -c < "$input"); EOF