summaryrefslogtreecommitdiff
path: root/Cmds
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-07-24 14:17:19 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-07-24 14:20:03 +0200
commit90cc1f2632be0c45f8aa19d07e5af6e817cc791b (patch)
tree4da1e1bc6fc7698e4892a49ebda5621c4d09e4f8 /Cmds
parent305ca18ac251f4e58cbff2fcc588c36c54cfeb63 (diff)
build: split build system into smaller manageable pieces
Split the build system into smaller manageable pieces, grouped by context. In that sense, we can keep the most important information within the Makefile itself, and group out misc bits and pieces that we just include into it. E.g. 'Cmds' contains all defined commands that we call from other locations, 'Template' contains the generic build template for all tools, 'Extra' has pieces that need special treatment for the tools to build and 'Misc' contains help and release code. This makes it more manageable on the long run. While at it, I also simplified some code and removed all Wflags expect "-Wall" as we want to convert into "-Wall -Wextra -W" anyway. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'Cmds')
-rw-r--r--Cmds41
1 files changed, 41 insertions, 0 deletions
diff --git a/Cmds b/Cmds
new file mode 100644
index 0000000..f82838e
--- /dev/null
+++ b/Cmds
@@ -0,0 +1,41 @@
+# Be quite and do not echo the cmd
+Q = @
+
+# GCC related stuff
+LD = $(Q)echo -e " LD\t$@" && $(CCACHE) $(CROSS_COMPILE)gcc
+CCNQ = $(CCACHE) $(CROSS_COMPILE)gcc
+CC = $(Q)echo -e " CC\t$<" && $(CCNQ)
+ifeq ($(DEBUG), 1)
+ STRIP = $(Q)true
+else
+ STRIP = $(Q)echo -e " STRIP\t$@" && $(CROSS_COMPILE)strip
+endif
+
+# Flex/bison related
+LEX = $(Q)echo -e " LEX\t$<" && flex
+YAAC = $(Q)echo -e " YAAC\t$<" && bison
+
+# Installation related
+INST = echo -e " INST\t$(1)" && install -d $(2) && \
+ install --mode=644 -DC $(1) $(2)/$(shell basename $(1))
+
+ifeq ("$(origin PREFIX)", "command line")
+ INSTX = echo -e " INST\t$(1)" && install -d $(2) && \
+ install -C $(1) $(2)/$(shell basename $(1))
+else
+ INSTX = echo -e " INST\t$(1)" && install -C $(1) $(2)/$(shell basename $(1))
+endif
+
+RM = echo -e " RM\t$(1)" && rm -rf $(1)
+RMDIR = echo -e " RM\t$(1)" && rmdir --ignore-fail-on-non-empty $(1) 2> /dev/null || true
+
+GZIP = gzip --best -c
+
+# Git related
+GIT_ARCHIVE = git archive --prefix=netsniff-ng-$(VERSION_STRING)/ v$(VERSION_STRING) | \
+ $(1) > ../netsniff-ng-$(VERSION_STRING).tar.$(2)
+GIT_TAG = git tag -a $(VERSION_STRING) -s -m "tools: $(VERSION_STRING) release"
+GIT_LOG = git shortlog -n --not $(shell git describe --always --abbrev=0 --tags)
+GIT_REM = git ls-files -o | xargs rm -rf
+GIT_PEOPLE = git log --no-merges $(VERSION_STRING)..HEAD | grep Author: | cut -d: -f2 | \
+ cut -d\< -f1 | sort | uniq -c | sort -nr