#!/bin/sh source="$1" symbol_base="$(echo "$source" | tr '[:punct:]' '_')" cat << EOF #pragma once // NOTE: THIS FILE IS GENERATED, DO NOT EDIT #include extern char _binary_${symbol_base}_start; extern char _binary_${symbol_base}_end; #define ${symbol_base} ((const char* const)(&_binary_${symbol_base}_start)) #define ${symbol_base}_size ((size_t)(&_binary_${symbol_base}_end - &_binary_${symbol_base}_start)) EOF