vis: Remove optimisation and debugging options
PATCH 1/13 vis: Remove optimisation and debugging options
Distributions like Gentoo or Debian have to strip the options regarding the optimisation levels and debugging information to fulfil their policies. There is currently no valid reason why the Makefile should override it.
---
This patch depends on other patches submitted earlier:
- vis: Remove obsolete creation of source packages
- vis: Remove subversion/svk revision information
Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
@@ -26,7 +26,7 @@ endif endif CC = gcc -CFLAGS += -pedantic -Wall -W -O1 -g3 -std=gnu99 +CFLAGS += -pedantic -Wall -W -std=gnu99 EXTRA_CFLAGS = -DDEBUG_MALLOC -DMEMORY_USAGE -DREVISION_VERSION=$(REVISION_VERSION) LDFLAGS += -lpthread
Signature · 1 line
1.7.5.1
PATCH 2/13 vis: Don't automatically build in parallel
Distributions like Gentoo and Debian have policies which make it necessary to use some kind of environmental variable to control the parallel build.
---
This patch depends on other patches submitted earlier:
- vis: Remove obsolete creation of source packages
- vis: Remove subversion/svk revision information
Makefile | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
Makefile +1 -5
@@ -49,11 +49,7 @@ REVISION= $(shell if [ -d .git ]; then \ fi) REVISION_VERSION=\"\ $(REVISION)\" -NUM_CPUS = $(shell NUM_CPUS=`cat /proc/cpuinfo | grep -v 'model name' | grep processor | tail -1 | awk -F' ' '{print $$3}'`;echo `expr $$NUM_CPUS + 1`) - - -all: - $(MAKE) -j $(NUM_CPUS) $(BINARY_NAME) +all: $(BINARY_NAME) $(BINARY_NAME): $(SRC_O) $(SRC_H) Makefile $(Q_LD)$(CC) -o $@ $(SRC_O) $(LDFLAGS)
Signature · 1 line
1.7.5.1
PATCH 3/13 vis: Remove unused Makefile variables
In reply to Sven Eckelmann---
This patch depends on other patches submitted earlier:
- vis: Remove obsolete creation of source packages
- vis: Remove subversion/svk revision information
Makefile | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
Makefile +0 -6
@@ -32,17 +32,11 @@ LDFLAGS += -lpthread SBINDIR = $(INSTALL_PREFIX)/usr/sbin -LOG_BRANCH= trunk/vis - -SRC_FILES= "\(\.c\)\|\(\.h\)\|\(Makefile\)\|\(INSTALL\)\|\(LIESMICH\)\|\(README\)\|\(THANKS\)\|\(TRASH\)\|\(Doxyfile\)\|\(./posix\)\|\(./linux\)\|\(./bsd\)\|\(./man\)\|\(./doc\)" - SRC_C= allocate.c hash.c list-batman.c vis.c udp_server.c SRC_H= allocate.h hash.h list-batman.h vis.h vis-types.h SRC_O= $(SRC_C:.c=.o) -PACKAGE_NAME= vis BINARY_NAME= vis -SOURCE_VERSION_HEADER= vis.h REVISION= $(shell if [ -d .git ]; then \ echo $$(git describe --always --dirty 2> /dev/null || echo "[unknown]"); \
Signature · 1 line
1.7.5.1
PATCH 4/13 vis: Directly specify objects in Makefile
In reply to Sven EckelmannThe information about header and source files aren't needed by the Makefile. Only the dependencies to headers provide useful information, but these are automatically included by the generated *.d files.
---
This patch depends on other patches submitted earlier:
- vis: Remove obsolete creation of source packages
- vis: Remove subversion/svk revision information
Makefile | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-)
Makefile +6 -8
@@ -32,9 +32,8 @@ LDFLAGS += -lpthread SBINDIR = $(INSTALL_PREFIX)/usr/sbin -SRC_C= allocate.c hash.c list-batman.c vis.c udp_server.c -SRC_H= allocate.h hash.h list-batman.h vis.h vis-types.h -SRC_O= $(SRC_C:.c=.o) +OBJ = allocate.o hash.o list-batman.o vis.o udp_server.o +DEP = $(OBJ:.o=.d) BINARY_NAME= vis
@@ -45,16 +44,15 @@ REVISION_VERSION=\"\ $(REVISION)\" all: $(BINARY_NAME) -$(BINARY_NAME): $(SRC_O) $(SRC_H) Makefile - $(Q_LD)$(CC) -o $@ $(SRC_O) $(LDFLAGS) +$(BINARY_NAME): $(OBJ) Makefile + $(Q_LD)$(CC) -o $@ $(OBJ) $(LDFLAGS) .c.o: $(Q_CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MD -c $< -o $@ --include $(SRC_C:.c=.d) +-include $(DEP) clean: - rm -f $(BINARY_NAME) *.o - rm -f `find . -name '*.d' -print` + rm -f $(BINARY_NAME) $(OBJ) $(DEP) install: mkdir -p $(SBINDIR)
Signature · 1 line
1.7.5.1
PATCH 5/13 vis: Provide shebang to inform about interpreter
In reply to Sven Eckelmann---
This patch depends on other patches submitted earlier:
- vis: Remove obsolete creation of source packages
- vis: Remove subversion/svk revision information
Makefile | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) mode change 100644 => 100755 Makefile
Makefile +2 -0
@@ -1,3 +1,5 @@ +#!/usr/bin/make -f +# -*- makefile -*- # # Copyright (C) 2006-2009 BATMAN contributors #
Signature · 1 line
1.7.5.1
PATCH 6/13 vis: Mark makefile targets without output as PHONY
In reply to Sven EckelmannNormally makefile targets should create an output with the same name as the target. It is necessary to mark them as PHONY to prevent that the virtual target like all, clean or install aren't executed when a file with the same name exists.
---
This patch depends on other patches submitted earlier:
- vis: Remove obsolete creation of source packages
- vis: Remove subversion/svk revision information
Makefile | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
Makefile +2 -0
@@ -59,3 +59,5 @@ clean: install: mkdir -p $(SBINDIR) install -m 0755 $(BINARY_NAME) $(SBINDIR) + +.PHONY: all clean install
Signature · 1 line
1.7.5.1
PATCH 7/13 vis: Only define CC when not already specified
In reply to Sven EckelmannIt is possible that a build environment specifies the CC different than gcc (for example gcc-4.6). The Makefile should only set it when the compiler wasn't explicitely set.
---
This patch depends on other patches submitted earlier:
- vis: Remove obsolete creation of source packages
- vis: Remove subversion/svk revision information
Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
@@ -27,7 +27,7 @@ ifndef V endif endif -CC = gcc +CC ?= gcc CFLAGS += -pedantic -Wall -W -std=gnu99 EXTRA_CFLAGS = -DDEBUG_MALLOC -DMEMORY_USAGE -DREVISION_VERSION=$(REVISION_VERSION) LDFLAGS += -lpthread
Signature · 1 line
1.7.5.1
PATCH 8/13 vis: Build binary before installing it
In reply to Sven Eckelmann---
This patch depends on other patches submitted earlier:
- vis: Remove obsolete creation of source packages
- vis: Remove subversion/svk revision information
Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
@@ -56,7 +56,7 @@ $(BINARY_NAME): $(OBJ) Makefile clean: rm -f $(BINARY_NAME) $(OBJ) $(DEP) -install: +install: $(BINARY_NAME) mkdir -p $(SBINDIR) install -m 0755 $(BINARY_NAME) $(SBINDIR)
Signature · 1 line
1.7.5.1
PATCH 9/13 vis: Reorder Makefile for better readability
In reply to Sven Eckelmann---
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(-)
Makefile +24 -15
@@ -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
Signature · 1 line
1.7.5.1
PATCH 10/13 vis: Use standard-like build rules
In reply to Sven EckelmannUser 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.
---
This patch depends on other patches submitted earlier:
- vis: Remove obsolete creation of source packages
- vis: Remove subversion/svk revision information
Makefile | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
Makefile +8 -6
@@ -23,9 +23,9 @@ 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 +CFLAGS += -pedantic -Wall -W -std=gnu99 -MD +CPPFLAGS += -DDEBUG_MALLOC -DMEMORY_USAGE -DREVISION_VERSION=$(REVISION_VERSION) +LDLIBS += -lpthread # 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)
Signature · 1 line
1.7.5.1
PATCH 11/13 vis: Make called tools in clean and install configurable
In reply to Sven Eckelmann---
This patch depends on other patches submitted earlier:
- vis: Remove obsolete creation of source packages
- vis: Remove subversion/svk revision information
Makefile | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
Makefile +6 -3
@@ -39,6 +39,9 @@ endif # standard build tools CC ?= gcc +RM ?= rm -f +INSTALL ?= install +MKDIR ?= mkdir -p COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c LINK.o = $(Q_LD)$(CC) $(LDFLAGS) $(TARGET_ARCH)
@@ -61,11 +64,11 @@ $(BINARY_NAME): $(OBJ) $(LINK.o) $^ $(LDLIBS) -o $@ clean: - rm -f $(BINARY_NAME) $(OBJ) $(DEP) + $(RM) $(BINARY_NAME) $(OBJ) $(DEP) install: $(BINARY_NAME) - mkdir -p $(SBINDIR) - install -m 0755 $(BINARY_NAME) $(SBINDIR) + $(MKDIR) $(SBINDIR) + $(INSTALL) -m 0755 $(BINARY_NAME) $(SBINDIR) # load dependencies DEP = $(OBJ:.o=.d)
Signature · 1 line
1.7.5.1
PATCH 12/13 vis: Rename INSTALL_PREFIX to DESTDIR
In reply to Sven EckelmannMakefile generators like cmake or configure (generated by autotools) usually use DESTDIR to allow the modification of the "root" path without affecting other build steps.
---
This patch depends on other patches submitted earlier:
- vis: Remove obsolete creation of source packages
- vis: Remove subversion/svk revision information
Makefile | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile +3 -3
@@ -46,7 +46,7 @@ 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 +SBINDIR = /usr/sbin # try to generate revision REVISION = $(shell if [ -d .git ]; then echo $$(git describe --always --dirty 2> /dev/null || echo "[unknown]"); fi)
@@ -67,8 +67,8 @@ clean: $(RM) $(BINARY_NAME) $(OBJ) $(DEP) install: $(BINARY_NAME) - $(MKDIR) $(SBINDIR) - $(INSTALL) -m 0755 $(BINARY_NAME) $(SBINDIR) + $(MKDIR) $(DESTDIR)$(SBINDIR) + $(INSTALL) -m 0755 $(BINARY_NAME) $(DESTDIR)$(SBINDIR) # load dependencies DEP = $(OBJ:.o=.d)
Signature · 1 line
1.7.5.1
PATCH 13/13 vis: Introduce PREFIX as standard installation prefix
In reply to Sven Eckelmanncmake and configure (generated by autotools) use a prefix configuration which is by default /usr/local to define to which all other paths are relative to. SBINDIR is then defined as $PREFIX/sbin but can also be redefined.
---
This patch depends on other patches submitted earlier:
- vis: Remove obsolete creation of source packages
- vis: Remove subversion/svk revision information
Makefile | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
Makefile +2 -1
@@ -46,7 +46,8 @@ COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c LINK.o = $(Q_LD)$(CC) $(LDFLAGS) $(TARGET_ARCH) # standard install paths -SBINDIR = /usr/sbin +PREFIX = /usr/local +SBINDIR = $(PREFIX)/sbin # try to generate revision REVISION = $(shell if [ -d .git ]; then echo $$(git describe --always --dirty 2> /dev/null || echo "[unknown]"); fi)
Signature · 1 line
1.7.5.1