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.
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile index 217a00a..3b9e853 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ endif endif
CC = gcc -CFLAGS += -pedantic -Wall -W -g3 -std=gnu99 -Os -fno-strict-aliasing +CFLAGS += -pedantic -Wall -W -std=gnu99 -fno-strict-aliasing EXTRA_CFLAGS = -DREVISION_VERSION=$(REVISION_VERSION) LDFLAGS += -lm
Distributions like Gentoo and Debian have policies which make it necessary to use some kind of environmental variable to control the parallel build.
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile index 3b9e853..61a81fb 100644 --- a/Makefile +++ b/Makefile @@ -53,10 +53,7 @@ REVISION= $(shell if [ -d .git ]; then \
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)
On Saturday 21 May 2011 14:28:06 Sven Eckelmann wrote:
Distributions like Gentoo and Debian have policies which make it necessary to use some kind of environmental variable to control the parallel build.
Applied in revision b2e3f83.
Thanks, Marek
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile index 61a81fb..cf0b5c5 100644 --- a/Makefile +++ b/Makefile @@ -32,10 +32,6 @@ LDFLAGS += -lm
SBINDIR = $(INSTALL_PREFIX)/usr/sbin
-LOG_BRANCH = trunk/batctl - -SRC_FILES = "(.c)|(.h)|(Makefile)|(INSTALL)|(LIESMICH)|(README)|(THANKS)|(TRASH)|(Doxyfile)|(./posix)|(./linux)|(./bsd)|(./man)|(./doc)" - EXTRA_MODULES_C := bisect.c EXTRA_MODULES_H := bisect.h
@@ -43,9 +39,7 @@ SRC_C = main.c bat-hosts.c functions.c sys.c debug.c ping.c traceroute.c tcpdump SRC_H = main.h bat-hosts.h functions.h sys.h debug.h ping.h traceroute.h tcpdump.h list-batman.h hash.h allocate.h vis.h debugfs.h $(EXTRA_MODULES_H) SRC_O = $(SRC_C:.c=.o)
-PACKAGE_NAME = batctl BINARY_NAME = batctl -SOURCE_VERSION_HEADER = main.h
REVISION= $(shell if [ -d .git ]; then \ echo $$(git describe --always --dirty 2> /dev/null || echo "[unknown]"); \
On Saturday 21 May 2011 14:28:07 Sven Eckelmann wrote:
Signed-off-by: Sven Eckelmann sven@narfation.org
Makefile | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
Applied in revision e7b045c.
Thanks, Marek
The 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.
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile index cf0b5c5..1bc4879 100644 --- a/Makefile +++ b/Makefile @@ -32,12 +32,8 @@ LDFLAGS += -lm
SBINDIR = $(INSTALL_PREFIX)/usr/sbin
-EXTRA_MODULES_C := bisect.c -EXTRA_MODULES_H := bisect.h - -SRC_C = main.c bat-hosts.c functions.c sys.c debug.c ping.c traceroute.c tcpdump.c list-batman.c hash.c vis.c debugfs.c $(EXTRA_MODULES_C) -SRC_H = main.h bat-hosts.h functions.h sys.h debug.h ping.h traceroute.h tcpdump.h list-batman.h hash.h allocate.h vis.h debugfs.h $(EXTRA_MODULES_H) -SRC_O = $(SRC_C:.c=.o) +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 +DEP = $(OBJ:.o=.d)
BINARY_NAME = batctl
@@ -49,15 +45,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 *.d + rm -f $(BINARY_NAME) $(OBJ) $(DEP)
install: mkdir -p $(SBINDIR)
On Saturday 21 May 2011 14:28:08 Sven Eckelmann wrote:
The 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.
Applied in revision a6f3c76.
Thanks, Marek
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) mode change 100644 => 100755 Makefile
diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 index 1bc4879..8fc2300 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +#!/usr/bin/make -f +# -*- makefile -*- # # Copyright (C) 2006-2011 B.A.T.M.A.N. contributors #
On Saturday 21 May 2011 14:28:09 Sven Eckelmann wrote:
Signed-off-by: Sven Eckelmann sven@narfation.org
Makefile | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) mode change 100644 => 100755 Makefile
Applied in revision 4866155.
Thanks, Marek
Normally 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.
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile index 8fc2300..f95a9d2 100755 --- a/Makefile +++ b/Makefile @@ -60,3 +60,5 @@ clean: install: mkdir -p $(SBINDIR) install -m 0755 $(BINARY_NAME) $(SBINDIR) + +.PHONY: all clean install
On Saturday 21 May 2011 14:28:10 Sven Eckelmann wrote:
Normally 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.
Applied in revision d487861.
Thanks, Marek
It 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.
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile index f95a9d2..a06177d 100755 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ ifndef V endif endif
-CC = gcc +CC ?= gcc CFLAGS += -pedantic -Wall -W -std=gnu99 -fno-strict-aliasing EXTRA_CFLAGS = -DREVISION_VERSION=$(REVISION_VERSION) LDFLAGS += -lm
On Saturday 21 May 2011 14:28:11 Sven Eckelmann wrote:
It 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.
Applied in revision 8ae5eed.
Thanks, Marek
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile index a06177d..c8cb62f 100755 --- a/Makefile +++ b/Makefile @@ -57,7 +57,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)
On Saturday 21 May 2011 14:28:12 Sven Eckelmann wrote:
Signed-off-by: Sven Eckelmann sven@narfation.org
Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied in revision 75c9f10.
Thanks, Marek
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 40 ++++++++++++++++++++++++---------------- 1 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/Makefile b/Makefile index c8cb62f..0683fd7 100755 --- a/Makefile +++ b/Makefile @@ -18,6 +18,16 @@ # 02110-1301, USA #
+# batctl build and install configuration +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 + +# disable verbose output ifneq ($(findstring $(MAKEFLAGS),s),s) ifndef V Q_CC = @echo ' ' CC $@; @@ -27,32 +37,26 @@ ifndef V endif endif
+# standard build tools CC ?= gcc -CFLAGS += -pedantic -Wall -W -std=gnu99 -fno-strict-aliasing -EXTRA_CFLAGS = -DREVISION_VERSION=$(REVISION_VERSION) -LDFLAGS += -lm
+# standard install paths SBINDIR = $(INSTALL_PREFIX)/usr/sbin
-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 -DEP = $(OBJ:.o=.d) - -BINARY_NAME = batctl - -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) @@ -61,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
On Saturday 21 May 2011 14:28:13 Sven Eckelmann wrote:
Signed-off-by: Sven Eckelmann sven@narfation.org
Makefile | 40 ++++++++++++++++++++++++---------------- 1 files changed, 24 insertions(+), 16 deletions(-)
Applied in revision 6e05c19.
Thanks, Marek
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(-)
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)
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
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile index edd8907..c2b07e7 100755 --- a/Makefile +++ b/Makefile @@ -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)
On Saturday 21 May 2011 14:28:15 Sven Eckelmann wrote:
Signed-off-by: Sven Eckelmann sven@narfation.org
Makefile | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
Applied in revision 8be851a.
Thanks, Marek
Makefile generators like cmake or configure (generated by autotools) usually use DESTDIR to allow the modification of the "root" path without affecting other build steps.
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile index c2b07e7..b5aa6ca 100755 --- a/Makefile +++ b/Makefile @@ -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)
On Saturday 21 May 2011 14:28:16 Sven Eckelmann wrote:
Makefile generators like cmake or configure (generated by autotools) usually use DESTDIR to allow the modification of the "root" path without affecting other build steps.
Applied in revision 08e891f.
Thanks, Marek
cmake 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.
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index b5aa6ca..7ac72ed 100755 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ # 02110-1301, USA #
-# batctl build and install configuration +# batctl build 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
@@ -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)
On Saturday 21 May 2011 14:28:17 Sven Eckelmann wrote:
cmake 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.
Applied in revision 9ca5b44.
Thanks, Marek
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile index 7ac72ed..eee5a63 100755 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ # batctl build 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 +MANPAGE = man/batctl.8
# batctl flags and options CFLAGS += -pedantic -Wall -W -std=gnu99 -fno-strict-aliasing -MD @@ -48,6 +49,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) @@ -69,7 +71,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)
On Saturday 21 May 2011 14:28:18 Sven Eckelmann wrote:
Signed-off-by: Sven Eckelmann sven@narfation.org
Makefile | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
Applied in revision 772f14b.
Thanks, Marek
On Saturday 21 May 2011 14:28:05 Sven Eckelmann wrote:
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.
Applied in revision bf2326e.
Thanks, Marek
b.a.t.m.a.n@lists.open-mesh.org