Skip to content

Commit 3dd22d2

Browse files
gkurzfbarrat
authored andcommitted
Makefile: Add override directive to CFLAGS
It is perfectly legal to override CFLAGS on the command line, but this doesn't work with libocxl: $ make V=1 CFLAGS='-g' VERSION_MAJOR=1 VERSION_MINOR=1 \ VERSION_PATCH=0 CC="gcc" CFLAGS="-g" \ ./version.pl > src/libocxl_info.h mkdir obj gcc -g -c -o obj/afu.o src/afu.c In file included from src/afu.c:17: src/libocxl_internal.h:25:10: fatal error: libocxl.h: No such file or directory 25 | #include "libocxl.h" | ^~~~~~~~~~~ compilation terminated. This is especially painful for some building frameworks that rely on that, eg. buildroot. The GNU make documentation clearly indicates that overriding a variable on the command line causes ordinary assignments to this variable in the makefile to be ignored. Use the override directive so that we can add the required items to CFLAGS. https://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_6.html#SEC66 Signed-off-by: Greg Kurz <groug@kaod.org>
1 parent 537e0ad commit 3dd22d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include Makefile.vars
33

44
OBJS = obj/afu.o obj/internal.o obj/irq.o obj/mmio.o obj/setup.o
55
TEST_OBJS = testobj/afu.o testobj/internal.o testobj/irq.o testobj/mmio.o testobj/setup.o
6-
CFLAGS += -I src/include -I kernel/include -fPIC -D_FILE_OFFSET_BITS=64
6+
override CFLAGS += -I src/include -I kernel/include -fPIC -D_FILE_OFFSET_BITS=64
77

88
VERS_LIB = $(VERSION_MAJOR).$(VERSION_MINOR)
99
LIBNAME = libocxl.so.$(VERS_LIB)

0 commit comments

Comments
 (0)