Message ID | 20190131090724.11157-1-uwe@kleine-koenig.org (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | Makefile: default to LD = CC | expand |
On Thu, Jan 31, 2019 at 10:07:24AM +0100, Uwe Kleine-König wrote: > Usually the compiler is used as linker. Assuming that if someone wants > to change the compiler the linker should be changed, too, simplify that > use case by using "$(CC)" as linker instead of the hard coded "gcc". Thanks. I'll push it later this evening. -- Luc
diff --git a/Makefile b/Makefile index 9c4bafffcd6e..025bce296cdf 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ OS = linux CC = gcc CFLAGS = -O2 -g CFLAGS += -Wall -Wwrite-strings -LD = gcc +LD = $(CC) AR = ar PKG_CONFIG = pkg-config CHECKER = CHECK=./sparse ./cgcc -no-compile
Usually the compiler is used as linker. Assuming that if someone wants to change the compiler the linker should be changed, too, simplify that use case by using "$(CC)" as linker instead of the hard coded "gcc". This also matches the behaviour of make when using the built-in rules of GNU Make which include: LINK.o = $(CC) $(LDFLAGS) $(TARGET_ARCH) %: %.o $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)