Signed-off-by: Sven Eckelmann sven@narfation.org --- This patch depends on other patches submitted earlier: - vis: Remove obsolete creation of source packages - vis: Remove subversion/svk revision information
Makefile | 39 ++++++++++++++++++++++++--------------- 1 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/Makefile b/Makefile index 75d59cc..da966ac 100755 --- a/Makefile +++ b/Makefile @@ -18,6 +18,16 @@ # 02110-1301, USA #
+# vis build +BINARY_NAME= vis +OBJ = allocate.o hash.o list-batman.o vis.o udp_server.o + +# vis flags and options +CFLAGS += -pedantic -Wall -W -std=gnu99 +EXTRA_CFLAGS = -DDEBUG_MALLOC -DMEMORY_USAGE -DREVISION_VERSION=$(REVISION_VERSION) +LDFLAGS += -lpthread + +# disable verbose output ifneq ($(findstring $(MAKEFLAGS),s),s) ifndef V Q_CC = @echo ' ' CC $@; @@ -27,31 +37,26 @@ ifndef V endif endif
+# standard build tools CC ?= gcc -CFLAGS += -pedantic -Wall -W -std=gnu99 -EXTRA_CFLAGS = -DDEBUG_MALLOC -DMEMORY_USAGE -DREVISION_VERSION=$(REVISION_VERSION) -LDFLAGS += -lpthread
+# standard install paths SBINDIR = $(INSTALL_PREFIX)/usr/sbin
-OBJ = allocate.o hash.o list-batman.o vis.o udp_server.o -DEP = $(OBJ:.o=.d) - -BINARY_NAME= vis - -REVISION= $(shell if [ -d .git ]; then \ - echo $$(git describe --always --dirty 2> /dev/null || echo "[unknown]"); \ - fi) +# try to generate revision +REVISION = $(shell if [ -d .git ]; then echo $$(git describe --always --dirty 2> /dev/null || echo "[unknown]"); fi) REVISION_VERSION="\ $(REVISION)"
+# default target all: $(BINARY_NAME)
-$(BINARY_NAME): $(OBJ) Makefile - $(Q_LD)$(CC) -o $@ $(OBJ) $(LDFLAGS) - +# standard build rules +.SUFFIXES: .o .c .c.o: $(Q_CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MD -c $< -o $@ --include $(DEP) + +$(BINARY_NAME): $(OBJ) Makefile + $(Q_LD)$(CC) -o $@ $(OBJ) $(LDFLAGS)
clean: rm -f $(BINARY_NAME) $(OBJ) $(DEP) @@ -60,4 +65,8 @@ install: $(BINARY_NAME) mkdir -p $(SBINDIR) install -m 0755 $(BINARY_NAME) $(SBINDIR)
+# load dependencies +DEP = $(OBJ:.o=.d) +-include $(DEP) + .PHONY: all clean install