From 85eeb2a13ab664432ce357cdb0641163fc541a99 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 18 Feb 2024 16:49:58 +0100 Subject: [PATCH] Makefile: make it idiomatic, respect CPPFLAGS, CFLAGS and LDFLAGS Respect CPPFLAGS, CFLAGS, and LDFLAGS. Use the implicit rule for object files. No need to specify default, the first target is the default target. Respect CC from environment. --- Makefile | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 98917c4..21af4a4 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,8 @@ -CC=gcc -LINK_OPT=-lbluetooth +CC ?= gcc RM=rm -default: bdaddr - bdaddr: bdaddr.o oui.o - $(CC) -o bdaddr bdaddr.o oui.o $(LINK_OPT) - -bdaddr.o: bdaddr.c - $(CC) -c bdaddr.c - -oui.o: oui.c - $(CC) -c oui.c + $(CC) $(LDFLAGS) -o $@ $^ -lbluetooth clean: $(RM) -f *.o