[10/14] batctl: Use standard-like build rules

Message ID 1305980898-30494-10-git-send-email-sven@narfation.org (mailing list archive)
State Accepted, archived
Commit 21a79a12e377457286d12d2348680de2988b3052
Headers

Commit Message

Sven Eckelmann May 21, 2011, 12:28 p.m. UTC
  User expect a specific naming inside makefile rules which they can
modify by changing environment variables or providing them explicitely
as parameters of the make call. The naming was extracted from the gnu
make standard rules database.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 Makefile |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
  

Comments

Marek Lindner May 22, 2011, 10:07 a.m. UTC | #1
On Saturday 21 May 2011 14:28:14 Sven Eckelmann wrote:
> User expect a specific naming inside makefile rules which they can
> modify by changing environment variables or providing them explicitely
> as parameters of the make call. The naming was extracted from the gnu
> make standard rules database.

Applied in revision 21a79a1.

Thanks,
Marek
  

Patch

diff --git a/Makefile b/Makefile
index 0683fd7..edd8907 100755
--- a/Makefile
+++ b/Makefile
@@ -23,9 +23,9 @@  BINARY_NAME = batctl
 OBJ = main.o bat-hosts.o functions.o sys.o debug.o ping.o traceroute.o tcpdump.o list-batman.o hash.o vis.o debugfs.o bisect.o
 
 # batctl flags and options
-CFLAGS += -pedantic -Wall -W -std=gnu99 -fno-strict-aliasing
-EXTRA_CFLAGS += -DREVISION_VERSION=$(REVISION_VERSION)
-LDFLAGS += -lm
+CFLAGS += -pedantic -Wall -W -std=gnu99 -fno-strict-aliasing -MD
+CPPFLAGS += -DREVISION_VERSION=$(REVISION_VERSION)
+LDLIBS += -lm
 
 # disable verbose output
 ifneq ($(findstring $(MAKEFLAGS),s),s)
@@ -39,6 +39,8 @@  endif
 
 # standard build tools
 CC ?= gcc
+COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
+LINK.o = $(Q_LD)$(CC) $(LDFLAGS) $(TARGET_ARCH)
 
 # standard install paths
 SBINDIR = $(INSTALL_PREFIX)/usr/sbin
@@ -53,10 +55,10 @@  all: $(BINARY_NAME)
 # standard build rules
 .SUFFIXES: .o .c
 .c.o:
-	$(Q_CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MD -c $< -o $@
+	$(COMPILE.c) -o $@ $<
 
-$(BINARY_NAME): $(OBJ) Makefile
-	$(Q_LD)$(CC) -o $@ $(OBJ) $(LDFLAGS)
+$(BINARY_NAME): $(OBJ)
+	$(LINK.o) $^ $(LDLIBS) -o $@
 
 clean:
 	rm -f $(BINARY_NAME) $(OBJ) $(DEP)