batmand: Remove optimisation and debugging options
PATCH 1/14 batmand: 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:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
@@ -29,7 +29,7 @@ endif #NO_POLICY_ROUTING = -DNO_POLICY_ROUTING CC = gcc -CFLAGS += -pedantic -Wall -W -Os -g3 -std=gnu99 +CFLAGS += -pedantic -Wall -W -std=gnu99 EXTRA_CFLAGS = -DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA $(NO_POLICY_ROUTING) -DREVISION_VERSION=$(REVISION_VERSION) LDFLAGS += -lpthread
Signature · 1 line
1.7.5.1
PATCH 2/14 batmand: 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:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
Makefile +1 -4
@@ -77,11 +77,8 @@ REVISION= $(shell if [ -d .git ]; then \ fi) REVISION_VERSION =\"\ $(REVISION)\" -NUM_CPUS = $(shell nproc 2> /dev/null || echo 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/14 batmand: Remove unused Makefile variables
In reply to Sven Eckelmann---
This patch depends on other patches submitted earlier:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
Makefile +0 -6
@@ -60,17 +60,11 @@ ifeq ($(UNAME),OpenBSD) OS_C = $(BSD_C) $(POSIX_C) endif -LOG_BRANCH = trunk/batman - -SRC_FILES = "\(\.c\)\|\(\.h\)\|\(Makefile\)\|\(INSTALL\)\|\(LIESMICH\)\|\(README\)\|\(THANKS\)\|\(TRASH\)\|\(Doxyfile\)\|\(./posix\)\|\(./linux\)\|\(./bsd\)\|\(./man\)\|\(./doc\)" - SRC_C= batman.c originator.c schedule.c list-batman.c allocate.c bitarray.c hash.c profile.c ring_buffer.c hna.c $(OS_C) SRC_H= batman.h originator.h schedule.h list-batman.h os.h allocate.h bitarray.h hash.h profile.h packet.h types.h ring_buffer.h hna.h SRC_O= $(SRC_C:.c=.o) -PACKAGE_NAME = batmand BINARY_NAME = batmand -SOURCE_VERSION_HEADER = batman.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/14 batmand: 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:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 29 ++++++++++++++--------------- 1 files changed, 14 insertions(+), 15 deletions(-)
Makefile +14 -15
@@ -36,33 +36,33 @@ LDFLAGS += -lpthread SBINDIR = $(INSTALL_PREFIX)/usr/sbin UNAME = $(shell uname) -POSIX_C = posix/init.c posix/posix.c posix/tunnel.c posix/unix_socket.c -BSD_C = bsd/route.c bsd/tun.c bsd/kernel.c bsd/compat.c +POSIX_OBJ = posix/init.o posix/posix.o posix/tunnel.o posix/unix_socket.o +BSD_OBJ = bsd/route.o bsd/tun.o bsd/kernel.o bsd/compat.o +LINUX_OBJ = linux/route.o linux/tun.o linux/kernel.o ifeq ($(UNAME),Linux) -OS_C = linux/route.c linux/tun.c linux/kernel.c $(POSIX_C) +OS_OBJ = $(LINUX_OBJ) $(POSIX_OBJ) endif ifeq ($(UNAME),Darwin) -OS_C = $(BSD_C) $(POSIX_C) +OS_OBJ = $(BSD_OBJ) $(POSIX_OBJ) endif ifeq ($(UNAME),GNU/kFreeBSD) -OS_C = $(BSD_C) $(POSIX_C) +OS_OBJ = $(BSD_OBJ) $(POSIX_OBJ) LDFLAGS += -lfreebsd -lbsd endif ifeq ($(UNAME),FreeBSD) -OS_C = $(BSD_C) $(POSIX_C) +OS_OBJ = $(BSD_OBJ) $(POSIX_OBJ) endif ifeq ($(UNAME),OpenBSD) -OS_C = $(BSD_C) $(POSIX_C) +OS_OBJ = $(BSD_OBJ) $(POSIX_OBJ) endif -SRC_C= batman.c originator.c schedule.c list-batman.c allocate.c bitarray.c hash.c profile.c ring_buffer.c hna.c $(OS_C) -SRC_H= batman.h originator.h schedule.h list-batman.h os.h allocate.h bitarray.h hash.h profile.h packet.h types.h ring_buffer.h hna.h -SRC_O= $(SRC_C:.c=.o) +OBJ = batman.o originator.o schedule.o list-batman.o allocate.o bitarray.o hash.o profile.o ring_buffer.o hna.o $(OS_OBJ) +DEP = $(OBJ:.o=.d) BINARY_NAME = batmand
@@ -74,16 +74,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 posix/*.o linux/*.o bsd/*.o - rm -f *.d posix/*.d linux/*.d bsd/*.d + rm -f $(BINARY_NAME) $(OBJ) $(DEP) install: mkdir -p $(SBINDIR)
Signature · 1 line
1.7.5.1
PATCH 5/14 batmand: Provide shebang to inform about interpreter
In reply to Sven Eckelmann---
This patch depends on other patches submitted earlier:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
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 B.A.T.M.A.N. contributors #
Signature · 1 line
1.7.5.1
PATCH 6/14 batmand: 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:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
Makefile +2 -0
@@ -89,3 +89,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/14 batmand: 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:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
@@ -30,7 +30,7 @@ endif # activate this variable to deactivate policy routing for backward compatibility #NO_POLICY_ROUTING = -DNO_POLICY_ROUTING -CC = gcc +CC ?= gcc CFLAGS += -pedantic -Wall -W -std=gnu99 EXTRA_CFLAGS = -DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA $(NO_POLICY_ROUTING) -DREVISION_VERSION=$(REVISION_VERSION) LDFLAGS += -lpthread
Signature · 1 line
1.7.5.1
PATCH 8/14 batmand: Build binary before installing it
In reply to Sven Eckelmann---
This patch depends on other patches submitted earlier:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
@@ -86,7 +86,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/14 batmand: Reorder Makefile for better readability
In reply to Sven Eckelmann---
This patch depends on other patches submitted earlier:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 65 +++++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 37 insertions(+), 28 deletions(-)
Makefile +37 -28
@@ -18,24 +18,8 @@ # 02110-1301, USA # -ifneq ($(findstring $(MAKEFLAGS),s),s) -ifndef V - Q_CC = @echo ' ' CC $@; - Q_LD = @echo ' ' LD $@; - export Q_CC - export Q_LD -endif -endif - -# activate this variable to deactivate policy routing for backward compatibility -#NO_POLICY_ROUTING = -DNO_POLICY_ROUTING - -CC ?= gcc -CFLAGS += -pedantic -Wall -W -std=gnu99 -EXTRA_CFLAGS = -DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA $(NO_POLICY_ROUTING) -DREVISION_VERSION=$(REVISION_VERSION) -LDFLAGS += -lpthread - -SBINDIR = $(INSTALL_PREFIX)/usr/sbin +# batmand build +BINARY_NAME = batmand UNAME = $(shell uname) POSIX_OBJ = posix/init.o posix/posix.o posix/tunnel.o posix/unix_socket.o
@@ -64,24 +48,45 @@ OS_OBJ = $(BSD_OBJ) $(POSIX_OBJ) endif OBJ = batman.o originator.o schedule.o list-batman.o allocate.o bitarray.o hash.o profile.o ring_buffer.o hna.o $(OS_OBJ) -DEP = $(OBJ:.o=.d) -BINARY_NAME = batmand +# activate this variable to deactivate policy routing for backward compatibility +#NO_POLICY_ROUTING = -DNO_POLICY_ROUTING -REVISION= $(shell if [ -d .git ]; then \ - echo $$(git describe --always --dirty 2> /dev/null || echo "[unknown]"); \ - fi) +# batmand flags and options +CFLAGS += -pedantic -Wall -W -std=gnu99 +EXTRA_CFLAGS = -DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA $(NO_POLICY_ROUTING) -DREVISION_VERSION=$(REVISION_VERSION) +LDFLAGS += -lpthread + +# disable verbose output +ifneq ($(findstring $(MAKEFLAGS),s),s) +ifndef V + Q_CC = @echo ' ' CC $@; + Q_LD = @echo ' ' LD $@; + export Q_CC + export Q_LD +endif +endif + +# standard build tools +CC ?= gcc + +# standard install paths +SBINDIR = $(INSTALL_PREFIX)/usr/sbin + +# 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)
@@ -90,4 +95,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/14 batmand: 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:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)
Makefile +9 -7
@@ -36,7 +36,7 @@ endif ifeq ($(UNAME),GNU/kFreeBSD) OS_OBJ = $(BSD_OBJ) $(POSIX_OBJ) -LDFLAGS += -lfreebsd -lbsd +LDLIBS += -lfreebsd -lbsd endif ifeq ($(UNAME),FreeBSD)
@@ -53,9 +53,9 @@ OBJ = batman.o originator.o schedule.o list-batman.o allocate.o bitarray.o hash. #NO_POLICY_ROUTING = -DNO_POLICY_ROUTING # batmand flags and options -CFLAGS += -pedantic -Wall -W -std=gnu99 -EXTRA_CFLAGS = -DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA $(NO_POLICY_ROUTING) -DREVISION_VERSION=$(REVISION_VERSION) -LDFLAGS += -lpthread +CFLAGS += -pedantic -Wall -W -std=gnu99 -MD +CPPFLAGS = -DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA $(NO_POLICY_ROUTING) -DREVISION_VERSION=$(REVISION_VERSION) +LDLIBS += -lpthread # disable verbose output ifneq ($(findstring $(MAKEFLAGS),s),s)
@@ -69,6 +69,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
@@ -83,10 +85,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/14 Make called tools in clean and install configurable
In reply to Sven Eckelmann---
This patch depends on other patches submitted earlier:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
Makefile +6 -3
@@ -69,6 +69,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)
@@ -91,11 +94,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/14 batmand: 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:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile +3 -3
@@ -76,7 +76,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)
@@ -97,8 +97,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/14 batmand: 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:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
Makefile +2 -1
@@ -76,7 +76,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
PATCH 14/14 batmand: Install manpage
In reply to Sven Eckelmann---
This patch depends on other patches submitted earlier:
- batmand: Fix FTBFS on second build attempt
- batmand: Remove obsolete creation of source packages
- batmand: Remove subversion/svk revision information
- batmand: Use nproc to get number of available processors
Makefile | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
Makefile +4 -0
@@ -48,6 +48,7 @@ OS_OBJ = $(BSD_OBJ) $(POSIX_OBJ) endif OBJ = batman.o originator.o schedule.o list-batman.o allocate.o bitarray.o hash.o profile.o ring_buffer.o hna.o $(OS_OBJ) +MANPAGE = man/batmand.8 # activate this variable to deactivate policy routing for backward compatibility #NO_POLICY_ROUTING = -DNO_POLICY_ROUTING
@@ -78,6 +79,7 @@ LINK.o = $(Q_LD)$(CC) $(LDFLAGS) $(TARGET_ARCH) # standard install paths PREFIX = /usr/local SBINDIR = $(PREFIX)/sbin +MANDIR = $(PREFIX)/share/man # try to generate revision REVISION = $(shell if [ -d .git ]; then echo $$(git describe --always --dirty 2> /dev/null || echo "[unknown]"); fi)
@@ -99,7 +101,9 @@ clean: install: $(BINARY_NAME) $(MKDIR) $(DESTDIR)$(SBINDIR) + $(MKDIR) $(DESTDIR)$(MANDIR)/man8 $(INSTALL) -m 0755 $(BINARY_NAME) $(DESTDIR)$(SBINDIR) + $(INSTALL) -m 0644 $(MANPAGE) $(DESTDIR)$(MANDIR)/man8 # load dependencies DEP = $(OBJ:.o=.d)
Signature · 1 line
1.7.5.1