]> mj.ucw.cz Git - pciutils.git/commitdiff
Makefile: Pass CFLAGS also when linking executable
authorPali Rohár <pali@kernel.org>
Sun, 25 Feb 2024 02:22:08 +0000 (03:22 +0100)
committerMartin Mares <mj@ucw.cz>
Fri, 5 Apr 2024 11:13:58 +0000 (13:13 +0200)
Optimization flags like -O2 from $(OPT) passed via $(CFLAGS) used during
compiling individual object files are ignored when gcc's LTO is enabled for
the linking final executable.

Optimization flags used for compiling individual object files should be
same as optimization flags for linking final executable.

Fix propagation of $(CFLAGS) and $(OPT) when LTO is enabled.

Makefile

index aaec04e05345bf9392137a26b38b51d6c426220d..37333c1915fca2a1a51410d660a73daa31664fc2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -123,7 +123,7 @@ pcilmr$(EXEEXT): pcilmr.o $(LMROBJS) $(COMMON) lib/$(PCIIMPLIB)
 pcilmr.o: pcilmr.c $(LMRINC)
 
 %$(EXEEXT): %.o
-       $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@
+       $(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@
 
 ifdef PCI_OS_WINDOWS
 comma := ,