diff options
Diffstat (limited to 'build')
-rwxr-xr-x | build/embed.sh | 12 | ||||
-rw-r--r-- | build/header.mk | 5 | ||||
-rw-r--r-- | build/prelude.mk | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/build/embed.sh b/build/embed.sh new file mode 100755 index 0000000..8d7d0f1 --- /dev/null +++ b/build/embed.sh @@ -0,0 +1,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\1,/g' diff --git a/build/header.mk b/build/header.mk index 76e9562..8b28346 100644 --- a/build/header.mk +++ b/build/header.mk @@ -63,6 +63,11 @@ gen/config.h: ${PKG_HEADERS} ${HEADERS} @printf '#endif // BFS_CONFIG_H\n' >>$@ @cat ${.ALLSRC:%=%.log} >gen/config.log ${VCAT} $@ + @printf '%s' "$$CONFIG" | build/embed.sh >gen/config.i + @printf '%s' "$$XCPPFLAGS" | build/embed.sh >gen/cppflags.i + @printf '%s' "$$XCFLAGS" | build/embed.sh >gen/cflags.i + @printf '%s' "$$XLDFLAGS" | build/embed.sh >gen/ldflags.i + @printf '%s' "$$XLDLIBS" | build/embed.sh >gen/ldlibs.i .PHONY: gen/config.h # The short name of the config test diff --git a/build/prelude.mk b/build/prelude.mk index 38e432c..76fbce8 100644 --- a/build/prelude.mk +++ b/build/prelude.mk @@ -97,10 +97,10 @@ LIBBFS := \ obj/src/thread.o \ obj/src/trie.o \ obj/src/typo.o \ + obj/src/version.o \ obj/src/xregex.o \ obj/src/xspawn.o \ obj/src/xtime.o \ - obj/gen/version.o # Unit test objects UNIT_OBJS := \ |