summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-04-17 12:32:22 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-04-17 12:32:22 -0400
commit9f1107cf041d44e79f566f41fc117321fb42881f (patch)
tree6dc927bfaf1a2b79fcf259d02a059599dba5447a /config
parent94f26cec62be7f0d766f80f7376ea5e0040948ae (diff)
downloadbfs-9f1107cf041d44e79f566f41fc117321fb42881f.tar.xz
build: Directly generate version.c
Diffstat (limited to 'config')
-rw-r--r--config/config.mk12
-rw-r--r--config/deps.mk2
-rw-r--r--config/flags.mk2
-rw-r--r--config/pkg.mk2
-rw-r--r--config/prelude.mk4
5 files changed, 12 insertions, 10 deletions
diff --git a/config/config.mk b/config/config.mk
index 9d64eec..4771a5e 100644
--- a/config/config.mk
+++ b/config/config.mk
@@ -17,7 +17,7 @@ MKS := \
# The main configuration file, which includes the others
${CONFIG}: ${MKS}
${MSG} "[ GEN] ${TGT}"
- @printf '# %s\n' "$@" >$@
+ @printf '# %s\n' "${TGT}" >$@
@printf 'include $${GEN}/%s\n' ${.ALLSRC:${GEN}/%=%} >>$@
${VCAT} ${CONFIG}
.PHONY: ${CONFIG}
@@ -26,7 +26,7 @@ ${CONFIG}: ${MKS}
${GEN}/vars.mk::
@${MKDIR} ${@D}
${MSG} "[ GEN] ${TGT}"
- @printf '# %s\n' "$@" >$@
+ @printf '# %s\n' "${TGT}" >$@
@printf 'PREFIX := %s\n' "$$XPREFIX" >>$@
@printf 'MANDIR := %s\n' "$$XMANDIR" >>$@
@printf 'OS := %s\n' "$${OS:-$$(uname)}" >>$@
@@ -54,8 +54,10 @@ ${GEN}/deps.mk: ${GEN}/flags.mk
${GEN}/objs.mk::
@${MKDIR} ${@D}
${MSG} "[ GEN] ${TGT}"
- @printf '# %s\n' "$@" >$@
- @for obj in ${OBJS:${OBJ}/%.o=%}; do printf '$${OBJ}/%s.o: %s.c\n' "$$obj" "$$obj"; done >>$@
+ @printf '# %s\n' "${TGT}" >$@
+ @for obj in ${OBJS:${OBJ}/%.o=%}; do \
+ printf '$${OBJ}/%s.o: %s.c\n' "$$obj" "$$obj"; \
+ done | sed 's|: gen/|: $${GEN}/|' >>$@
# External dependencies
PKG_MKS := \
@@ -67,7 +69,7 @@ PKG_MKS := \
# Auto-detect dependencies and their build flags
${GEN}/pkgs.mk: ${PKG_MKS}
- @printf '# %s\n' "$@" >$@
+ @printf '# %s\n' "${TGT}" >$@
@printf 'include $${GEN}/%s\n' ${.ALLSRC:${GEN}/%=%} >>$@
@+${MAKE} -sf config/pkgs.mk
.PHONY: ${GEN}/pkgs.mk
diff --git a/config/deps.mk b/config/deps.mk
index ca178de..e963b6e 100644
--- a/config/deps.mk
+++ b/config/deps.mk
@@ -10,7 +10,7 @@ include config/exports.mk
${GEN}/deps.mk::
${MSG} "[ GEN] ${TGT}"
- printf '# %s\n' "$@" >$@
+ printf '# %s\n' "${TGT}" >$@
if config/cc.sh -MD -MP -MF /dev/null config/empty.c; then \
printf 'DEPFLAGS = -MD -MP -MF $${@:.o=.d}\n'; \
fi >>$@ 2>$@.log
diff --git a/config/flags.mk b/config/flags.mk
index c9d7913..48f1a08 100644
--- a/config/flags.mk
+++ b/config/flags.mk
@@ -105,7 +105,7 @@ APPEND = append() { test -z "$$2" || printf '%s += %s\n' "$$1" "$$2" >>$@; }; ap
${GEN}/flags.mk::
${MSG} "[ GEN] ${TGT}"
- printf '# %s\n' "$@" >$@
+ printf '# %s\n' "${TGT}" >$@
${SETVAR} CPPFLAGS "$$BFS_CPPFLAGS"
${APPEND} CPPFLAGS "$$TSAN_CPPFLAGS"
${APPEND} CPPFLAGS "$$LINT_CPPFLAGS"
diff --git a/config/pkg.mk b/config/pkg.mk
index 482ca17..d2d77b0 100644
--- a/config/pkg.mk
+++ b/config/pkg.mk
@@ -12,7 +12,7 @@ include config/exports.mk
SHORT = ${TARGET:${BUILDDIR}/%=%}
default::
- @printf '# %s\n' "${TARGET}" >${TARGET}
+ @printf '# %s\n' "${SHORT}" >${TARGET}
config/pkg.sh ${TARGET:${GEN}/%.mk=%} >>${TARGET} 2>${TARGET}.log
@if [ "${IS_V}" ]; then \
cat ${TARGET}; \
diff --git a/config/prelude.mk b/config/prelude.mk
index 2bcb208..dbc6875 100644
--- a/config/prelude.mk
+++ b/config/prelude.mk
@@ -141,10 +141,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}/src/xtime.o \
+ ${OBJ}/gen/version.o
# Unit test objects
UNIT_OBJS := \