summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-05-21 15:53:52 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-05-21 15:53:52 -0400
commitdd8e3b8b3e2d55c586e80e62d88719909bd8a568 (patch)
tree2a1de46f9e5b557a90e673e656f531340d0db962 /Makefile
parentf9498086969d917a85452560173a0d9db3604c32 (diff)
downloadbfs-dd8e3b8b3e2d55c586e80e62d88719909bd8a568.tar.xz
build: Allow flags.mk to override command line variables
Previously, during something like ./configure LDFLAGS=..., any additions to LDFLAGS from the generated makefiles were ignored. I had thought that sub-make invocations would allow those variables to be overridden, but that is not the behaviour of make. So instead, set _LDFLAGS etc. in the generated files so that they don't conflict.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile4
1 files changed, 2 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index b31d6c5..f33a604 100644
--- a/Makefile
+++ b/Makefile
@@ -54,7 +54,7 @@ bin/bfs: ${LIBBFS} obj/src/main.o
${BINS}:
@${MKDIR} ${@D}
- +${MSG} "[ LD ] $@" ${CC} ${CFLAGS} ${LDFLAGS} ${.ALLSRC} ${LDLIBS} -o $@
+ +${MSG} "[ LD ] $@" ${CC} ${_CFLAGS} ${_LDFLAGS} ${.ALLSRC} ${_LDLIBS} -o $@
${POSTLINK}
# Get the .c file for a .o file
@@ -63,7 +63,7 @@ CSRC = ${@:obj/%.o=%.c}
# Rebuild when the configuration changes
${OBJS}: gen/config.mk
@${MKDIR} ${@D}
- ${MSG} "[ CC ] ${CSRC}" ${CC} ${CPPFLAGS} ${CFLAGS} -c ${CSRC} -o $@
+ ${MSG} "[ CC ] ${CSRC}" ${CC} ${_CPPFLAGS} ${_CFLAGS} -c ${CSRC} -o $@
# Save the version number to this file, but only update version.c if it changes
gen/version.c.new::