summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cmds41
-rw-r--r--Extra32
-rw-r--r--Makefile250
-rw-r--r--Misc84
-rw-r--r--Template23
5 files changed, 205 insertions, 225 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
diff --git a/Extra b/Extra
new file mode 100644
index 0000000..759b144
--- /dev/null
+++ b/Extra
@@ -0,0 +1,32 @@
+# Targets that need extra treatment for now
+
+curvetun: LDFLAGS += -L ${NACL_LIB_DIR}
+mausezahn: CFLAGS = $(mausezahn-eflags)
+
+bpfc_clean_custom:
+ $(Q)$(call RM,$(BUILD_DIR)/*.h $(BUILD_DIR)/*.c)
+
+trafgen_clean_custom:
+ $(Q)$(call RM,$(BUILD_DIR)/*.h $(BUILD_DIR)/*.c)
+
+netsniff-ng_install_custom flowtop_install_custom:
+ $(Q)$(foreach file,$(NCONF_FILES),$(call INST,$(file),$(ETCDIRE));)
+
+trafgen_install_custom:
+ $(Q)$(call INST,trafgen_stddef.h,$(ETCDIRE))
+ $(Q)mv $(ETCDIRE)/trafgen_stddef.h $(ETCDIRE)/stddef.h
+
+astraceroute_install_custom:
+ $(Q)$(call INST,geoip.conf,$(ETCDIRE))
+
+netsniff-ng_uninstall_custom flowtop_uninstall_custom:
+ $(Q)$(foreach file,$(NCONF_FILES),$(call RM,$(ETCDIRE)/$(file));)
+ $(Q)$(call RMDIR,$(ETCDIRE))
+
+trafgen_uninstall_custom:
+ $(Q)$(call RM,$(ETCDIRE)/stddef.h)
+ $(Q)$(call RMDIR,$(ETCDIRE))
+
+astraceroute_uninstall_custom:
+ $(Q)$(call RM,$(ETCDIRE)/geoip.conf)
+ $(Q)$(call RMDIR,$(ETCDIRE))
diff --git a/Makefile b/Makefile
index b7faf98..76434c0 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,11 @@
# Subject to the GNU GPL, version 2.
-include Config
+-include Cmds
+-include Extra
+-include Template
+-include Misc
+
ifndef CONFIG_OK
$(error "Please run `./configure' before `make'")
endif
@@ -11,7 +16,7 @@ endif
VERSION = 0
PATCHLEVEL = 5
SUBLEVEL = 8
-EXTRAVERSION = -rc1
+EXTRAVERSION = -rc1+
NAME = Ziggomatic
TOOLS ?= $(CONFIG_TOOLS)
@@ -80,89 +85,25 @@ CFLAGS_DEF += -D_REENTRANT
CFLAGS_DEF += -D_LARGEFILE_SOURCE
CFLAGS_DEF += -D_LARGEFILE64_SOURCE
CFLAGS_DEF += -D_FILE_OFFSET_BITS=64
+CFLAGS_DEF += -DVERSION_STRING=\"$(VERSION_STRING)\"
+CFLAGS_DEF += -DVERSION_LONG=\"$(VERSION_LONG)\"
+CFLAGS_DEF += -DPREFIX_STRING=\"$(PREFIX)\"
WFLAGS_DEF = -Wall
-WFLAGS_DEF += -Wformat=2
-WFLAGS_DEF += -Wmissing-prototypes
-WFLAGS_DEF += -Wdeclaration-after-statement
-WFLAGS_DEF += -Werror-implicit-function-declaration
-WFLAGS_DEF += -Wstrict-prototypes
-WFLAGS_DEF += -Wimplicit-int
-WFLAGS_DEF += -Wundef
-
-WFLAGS_EXTRA = -Wno-unused-result
-WFLAGS_EXTRA += -Wmissing-parameter-type
-WFLAGS_EXTRA += -Wtype-limits
-WFLAGS_EXTRA += -Wclobbered
-WFLAGS_EXTRA += -Wmissing-field-initializers
-WFLAGS_EXTRA += -Woverride-init
-WFLAGS_EXTRA += -Wold-style-declaration
-WFLAGS_EXTRA += -Wignored-qualifiers
-WFLAGS_EXTRA += -Wempty-body
-WFLAGS_EXTRA += -Wuninitialized
-WFLAGS_DEF += $(WFLAGS_EXTRA)
-CFLAGS_DEF += $(WFLAGS_DEF)
-
-CFLAGS ?= $(CFLAGS_DEF)
CPPFLAGS ?=
+CFLAGS ?= $(CFLAGS_DEF) $(WFLAGS_DEF) $(CPPFLAGS) -I.
+
LEX_FLAGS =
YAAC_FLAGS =
+
LDFLAGS ?=
ifeq ("$(origin CROSS_LD_LIBRARY_PATH)", "command line")
LDFLAGS += -L$(CROSS_LD_LIBRARY_PATH)
endif
-ALL_LDFLAGS = $(LDFLAGS)
-ALL_CFLAGS = $(CFLAGS) $(CPPFLAGS) -I.
-ALL_CFLAGS += -DVERSION_STRING=\"$(VERSION_STRING)\"
-ALL_CFLAGS += -DVERSION_LONG=\"$(VERSION_LONG)\"
-ALL_CFLAGS += -DPREFIX_STRING=\"$(PREFIX)\"
-
VERSION_STRING = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
-VERSION_LONG = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)~$(NAME)
-
-# 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
+VERSION_LONG = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)~$(NAME)
export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION
export CROSS_COMPILE
@@ -182,27 +123,16 @@ build_showinfo:
clean_showinfo:
$(Q)echo "$(bold)Cleaning netsniff-ng toolkit ($(VERSION_STRING)):$(normal)"
-%.yy.o: %.l
- $(LEX) -P $(shell perl -wlne 'print $$1 if /lex-func-prefix:\s([a-z]+)/' $<) \
- -o $(BUILD_DIR)/$(shell basename $< .l).yy.c $(LEX_FLAGS) $<
-%.tab.o: %.y
- $(YAAC) -p $(shell perl -wlne 'print $$1 if /yaac-func-prefix:\s([a-z]+)/' $<) \
- -o $(BUILD_DIR)/$(shell basename $< .y).tab.c $(YAAC_FLAGS) -d $<
-
.PHONY: all toolkit $(TOOLS) clean %_prehook %_clean %_install %_uninstall tag tags cscope
-.DEFAULT_GOAL := all
-.FORCE:
-.DEFAULT:
.IGNORE: %_clean_custom %_install_custom
.NOTPARALLEL: $(TOOLS)
+.DEFAULT_GOAL := all
+.DEFAULT:
+.FORCE:
NCONF_FILES = ether.conf tcp.conf udp.conf oui.conf geoip.conf
-#XXX: for an -rcX release ship it without curvetun as this needs
-# to be fixed until a non-rc release though, therefore do not
-# apply ''all: toolkit'' for now. However, we still let people
-# build it by hand if they need to for some reasons.
-all: build_showinfo allbutcurvetun
+all: build_showinfo toolkit
allbutcurvetun: $(filter-out curvetun,$(TOOLS))
allbutmausezahn: $(filter-out mausezahn,$(TOOLS))
toolkit: $(TOOLS)
@@ -214,154 +144,24 @@ distclean: clean
mrproper: distclean
$(Q)$(GIT_REM)
-#XXX: same here, instead of "install: install_all" we ignore curvetun
-# for the moment
-install: install_allbutcurvetun
+install: install_all
install_all: $(foreach tool,$(TOOLS),$(tool)_install)
install_allbutcurvetun: $(foreach tool,$(filter-out curvetun,$(TOOLS)),$(tool)_install)
install_allbutmausezahn: $(foreach tool,$(filter-out mausezahn,$(TOOLS)),$(tool)_install)
uninstall: $(foreach tool,$(TOOLS),$(tool)_uninstall)
$(Q)$(call RMDIR,$(ETCDIRE))
-define TOOL_templ
- include $(1)/Makefile
- $(1) $(1)%: BUILD_DIR := $(1)
- $(1) $(1)%: ALL_CFLAGS += $$($(1)-eflags)
- $(1)_prehook:
- $(Q)echo "$(bold)$(WHAT) $(1):$(normal)"
- $(1): $(1)_prehook $$($(1)-lex) $$($(1)-yaac) $$(patsubst %.o,$(1)/%.o,$$($(1)-objs))
- $(1)_clean: $(1)_clean_custom
- $(Q)$$(call RM,$(1)/*.o $(1)/$(1) $(1)/*.gz)
- $(1)_install: $(1)_install_custom
- $(Q)$$(call INSTX,$(1)/$(1),$$(SBINDIR))
- $(Q)$(GZIP) $(1).8 > $(1)/$(1).8.gz
- $(Q)$$(call INSTX,$(1)/$(1).8.gz,$$(MAN8DIR))
- $(1)_uninstall: $(1)_uninstall_custom
- $(Q)$$(call RM,$$(SBINDIR)/$(1))
- $(Q)$$(call RM,$$(MAN8DIR)/$(1).8.gz)
- $(1)/%.yy.o: $(1)/%.yy.c
- $$(CC) $$(ALL_CFLAGS) -o $$@ -c $$<
- $(1)/%.tab.o: $(1)/%.tab.c
- $$(CC) $$(ALL_CFLAGS) -o $$@ -c $$<
- $(1)/%.o: %.c
- $$(CC) $$(ALL_CFLAGS) -o $(1)/$$(shell basename $$@) -c $$<
-endef
+%.yy.o: %.l
+ $(LEX) -P $(shell perl -wlne 'print $$1 if /lex-func-prefix:\s([a-z]+)/' $<) \
+ -o $(BUILD_DIR)/$(shell basename $< .l).yy.c $(LEX_FLAGS) $<
+%.tab.o: %.y
+ $(YAAC) -p $(shell perl -wlne 'print $$1 if /yaac-func-prefix:\s([a-z]+)/' $<) \
+ -o $(BUILD_DIR)/$(shell basename $< .y).tab.c $(YAAC_FLAGS) -d $<
$(foreach tool,$(TOOLS),$(eval $(call TOOL_templ,$(tool))))
%:: ;
-# Here are two special treatments for now
-curvetun: ALL_LDFLAGS += -L ${NACL_LIB_DIR}
-mausezahn: ALL_CFLAGS = $(mausezahn-eflags)
-
-bpfc_clean_custom:
- $(Q)$(call RM,$(BUILD_DIR)/*.h $(BUILD_DIR)/*.c)
-trafgen_clean_custom:
- $(Q)$(call RM,$(BUILD_DIR)/*.h $(BUILD_DIR)/*.c)
-
-netsniff-ng_install_custom flowtop_install_custom:
- $(Q)$(foreach file,$(NCONF_FILES),$(call INST,$(file),$(ETCDIRE));)
-trafgen_install_custom:
- $(Q)$(call INST,trafgen_stddef.h,$(ETCDIRE))
- $(Q)mv $(ETCDIRE)/trafgen_stddef.h $(ETCDIRE)/stddef.h
-astraceroute_install_custom:
- $(Q)$(call INST,geoip.conf,$(ETCDIRE))
-netsniff-ng_uninstall_custom flowtop_uninstall_custom:
- $(Q)$(foreach file,$(NCONF_FILES),$(call RM,$(ETCDIRE)/$(file));)
- $(Q)$(call RMDIR,$(ETCDIRE))
-trafgen_uninstall_custom:
- $(Q)$(call RM,$(ETCDIRE)/stddef.h)
- $(Q)$(call RMDIR,$(ETCDIRE))
-astraceroute_uninstall_custom:
- $(Q)$(call RM,$(ETCDIRE)/geoip.conf)
- $(Q)$(call RMDIR,$(ETCDIRE))
-
$(TOOLS):
- $(LD) $(ALL_LDFLAGS) -o $@/$@ $@/*.o $($@-libs)
+ $(LD) $(LDFLAGS) -o $@/$@ $@/*.o $($@-libs)
$(STRIP) $@/$@
-
-nacl:
- $(Q)echo "$(bold)$(WHAT) $@:$(normal)"
- $(Q)cd curvetun/ && ./nacl_build.sh ~/nacl
- $(Q)source ~/.bashrc
-
-tarball.gz: ; $(call GIT_ARCHIVE,gzip,gz)
-tarball.bz2: ; $(call GIT_ARCHIVE,bzip2,bz2)
-tarball.xz: ; $(call GIT_ARCHIVE,xz,xz)
-tarball: tarball.gz tarball.bz2 tarball.xz
-
-tag:
- $(GIT_TAG)
-
-announcement:
- $(Q)echo -e "netsniff-ng $(VERSION_STRING) has been released to the public (http://netsniff-ng.org/).\n" > .MAIL_MSG
- $(Q)echo -e "It can be fetched via Git, through:\n" >> .MAIL_MSG
- $(Q)echo -e " git clone git://github.com/borkmann/netsniff-ng.git" >> .MAIL_MSG
- $(Q)echo -e " git checkout $(VERSION_STRING)\n" >> .MAIL_MSG
- $(Q)echo -e "Or via HTTP, through:\n" >> .MAIL_MSG
- $(Q)echo -e " wget http://pub.netsniff-ng.org/netsniff-ng/netsniff-ng-$(VERSION_STRING).tar.gz\n" >> .MAIL_MSG
- $(Q)echo -e "The release be verified via Git, through (see README):\n" >> .MAIL_MSG
- $(Q)echo -e " git tag -v $(VERSION_STRING)\n" >> .MAIL_MSG
- $(Q)echo -e "Major high-level changes since the last release are:\n" >> .MAIL_MSG
- $(Q)echo -e " *** BLURB HERE ***\n" >> .MAIL_MSG
- $(Q)echo -e "Contributors since last release:\n" >> .MAIL_MSG
- $(GIT_PEOPLE) >> .MAIL_MSG
- $(Q)echo -e "\nGit changelog since the last release:\n" >> .MAIL_MSG
- $(GIT_LOG) >> .MAIL_MSG
-
-release: announcement tag tarball
- $(Q)echo "Released $(bold)$(VERSION_STRING)$(normal)"
-
-FIND_SOURCE_FILES = ( git ls-files '*.[hcS]' 2>/dev/null || \
- find . \( -name .git -type d -prune \) \
- -o \( -name '*.[hcS]' -type f -print \) )
-
-tags ctags:
- $(Q)$(call RM,tags)
- $(FIND_SOURCE_FILES) | xargs ctags -a
-
-cscope:
- $(Q)$(call RM,cscope*)
- $(FIND_SOURCE_FILES) | xargs cscope -b
-
-help:
- $(Q)echo "$(bold)Available tools from the toolkit:$(normal)"
- $(Q)echo " <tool>:={$(TOOLS)}"
- $(Q)echo "$(bold)Targets for building the toolkit:$(normal)"
- $(Q)echo " all|toolkit - Build the whole toolkit"
- $(Q)echo " allbutcurvetun - Build all except curvetun"
- $(Q)echo " allbutmausezahn - Build all except mausezahn"
- $(Q)echo " <tool> - Build only one of the tools"
- $(Q)echo "$(bold)Targets for cleaning the toolkit's build files:$(normal)"
- $(Q)echo " clean - Remove all build files"
- $(Q)echo " <tool>_clean - Remove only one of the tool's files"
- $(Q)echo " distclean - Remove all build and build config files"
- $(Q)echo " mrproper - Remove all files not in source distribution"
- $(Q)echo "$(bold)Targets for installing the toolkit:$(normal)"
- $(Q)echo " install - Install the whole toolkit"
- $(Q)echo " <tool>_install - Install only one of the tools"
- $(Q)echo "$(bold)Targets for removing the toolkit:$(normal)"
- $(Q)echo " uninstall - Remove the whole toolkit from the system"
- $(Q)echo " <toolname>_uninstall - Remove only one of the tools"
- $(Q)echo "$(bold)Hacking/development targets:$(normal)"
- $(Q)echo " tag - Generate Git tag of current version"
- $(Q)echo " tarball - Generate tarball of latest version"
- $(Q)echo " release - Generate a new release"
- $(Q)echo " tags - Generate sparse ctags"
- $(Q)echo " cscope - Generate cscope files"
- $(Q)echo "$(bold)Misc targets:$(normal)"
- $(Q)echo " nacl - Execute the build_nacl script"
- $(Q)echo " help - Show this help"
- $(Q)echo "$(bold)Available parameters:$(normal)"
- $(Q)echo " DEBUG=1 / DISTRO=1 - Enable debugging / Build for distros"
- $(Q)echo " HARDENING=1 - Enable GCC hardening of executables"
- $(Q)echo " PREFIX=/path - Install path prefix"
- $(Q)echo " CROSS_COMPILE=/path-prefix - Kernel-like cross-compiling prefix"
- $(Q)echo " CROSS_LD_LIBRARY_PATH=/path - Library search path for cross-compiling"
- $(Q)echo " CC=cgcc - Use sparse compiler wrapper"
- $(Q)echo " CFLAGS=\"-O2 -Wall ...\" - Overwrite CFLAGS for compilation"
- $(Q)echo " CPPFLAGS=\"-I <path> ...\" - Additional CFLAGS for compilation"
- $(Q)echo " LDFLAGS=\"-L <path> ...\" - Additional LDFLAGS for compilation"
- $(Q)echo " CCACHE= - Do not use ccache for compilation"
- $(Q)echo " Q= - Show verbose garbage"
diff --git a/Misc b/Misc
new file mode 100644
index 0000000..0180762
--- /dev/null
+++ b/Misc
@@ -0,0 +1,84 @@
+nacl:
+ $(Q)echo "$(bold)$(WHAT) $@:$(normal)"
+ $(Q)cd curvetun/ && ./nacl_build.sh ~/nacl
+ $(Q)source ~/.bashrc
+
+tarball.gz: ; $(call GIT_ARCHIVE,gzip,gz)
+tarball.bz2: ; $(call GIT_ARCHIVE,bzip2,bz2)
+tarball.xz: ; $(call GIT_ARCHIVE,xz,xz)
+tarball: tarball.gz tarball.bz2 tarball.xz
+
+tag:
+ $(GIT_TAG)
+
+announcement:
+ $(Q)echo -e "netsniff-ng $(VERSION_STRING) has been released to the public (http://netsniff-ng.org/).\n" > .MAIL_MSG
+ $(Q)echo -e "It can be fetched via Git, through:\n" >> .MAIL_MSG
+ $(Q)echo -e " git clone git://github.com/borkmann/netsniff-ng.git" >> .MAIL_MSG
+ $(Q)echo -e " git checkout $(VERSION_STRING)\n" >> .MAIL_MSG
+ $(Q)echo -e "Or via HTTP, through:\n" >> .MAIL_MSG
+ $(Q)echo -e " wget http://pub.netsniff-ng.org/netsniff-ng/netsniff-ng-$(VERSION_STRING).tar.gz\n" >> .MAIL_MSG
+ $(Q)echo -e "The release be verified via Git, through (see README):\n" >> .MAIL_MSG
+ $(Q)echo -e " git tag -v $(VERSION_STRING)\n" >> .MAIL_MSG
+ $(Q)echo -e "Major high-level changes since the last release are:\n" >> .MAIL_MSG
+ $(Q)echo -e " *** BLURB HERE ***\n" >> .MAIL_MSG
+ $(Q)echo -e "Contributors since last release:\n" >> .MAIL_MSG
+ $(GIT_PEOPLE) >> .MAIL_MSG
+ $(Q)echo -e "\nGit changelog since the last release:\n" >> .MAIL_MSG
+ $(GIT_LOG) >> .MAIL_MSG
+
+release: announcement tag tarball
+ $(Q)echo "Released $(bold)$(VERSION_STRING)$(normal)"
+
+FIND_SOURCE_FILES = ( git ls-files '*.[hcS]' 2>/dev/null || \
+ find . \( -name .git -type d -prune \) \
+ -o \( -name '*.[hcS]' -type f -print \) )
+
+tags ctags:
+ $(Q)$(call RM,tags)
+ $(FIND_SOURCE_FILES) | xargs ctags -a
+
+cscope:
+ $(Q)$(call RM,cscope*)
+ $(FIND_SOURCE_FILES) | xargs cscope -b
+
+help:
+ $(Q)echo "$(bold)Available tools from the toolkit:$(normal)"
+ $(Q)echo " <tool>:={$(TOOLS)}"
+ $(Q)echo "$(bold)Targets for building the toolkit:$(normal)"
+ $(Q)echo " all|toolkit - Build the whole toolkit"
+ $(Q)echo " allbutcurvetun - Build all except curvetun"
+ $(Q)echo " allbutmausezahn - Build all except mausezahn"
+ $(Q)echo " <tool> - Build only one of the tools"
+ $(Q)echo "$(bold)Targets for cleaning the toolkit's build files:$(normal)"
+ $(Q)echo " clean - Remove all build files"
+ $(Q)echo " <tool>_clean - Remove only one of the tool's files"
+ $(Q)echo " distclean - Remove all build and build config files"
+ $(Q)echo " mrproper - Remove all files not in source distribution"
+ $(Q)echo "$(bold)Targets for installing the toolkit:$(normal)"
+ $(Q)echo " install - Install the whole toolkit"
+ $(Q)echo " <tool>_install - Install only one of the tools"
+ $(Q)echo "$(bold)Targets for removing the toolkit:$(normal)"
+ $(Q)echo " uninstall - Remove the whole toolkit from the system"
+ $(Q)echo " <toolname>_uninstall - Remove only one of the tools"
+ $(Q)echo "$(bold)Hacking/development targets:$(normal)"
+ $(Q)echo " tag - Generate Git tag of current version"
+ $(Q)echo " tarball - Generate tarball of latest version"
+ $(Q)echo " release - Generate a new release"
+ $(Q)echo " tags - Generate sparse ctags"
+ $(Q)echo " cscope - Generate cscope files"
+ $(Q)echo "$(bold)Misc targets:$(normal)"
+ $(Q)echo " nacl - Execute the build_nacl script"
+ $(Q)echo " help - Show this help"
+ $(Q)echo "$(bold)Available parameters:$(normal)"
+ $(Q)echo " DEBUG=1 / DISTRO=1 - Enable debugging / Build for distros"
+ $(Q)echo " HARDENING=1 - Enable GCC hardening of executables"
+ $(Q)echo " PREFIX=/path - Install path prefix"
+ $(Q)echo " CROSS_COMPILE=/path-prefix - Kernel-like cross-compiling prefix"
+ $(Q)echo " CROSS_LD_LIBRARY_PATH=/path - Library search path for cross-compiling"
+ $(Q)echo " CC=cgcc - Use sparse compiler wrapper"
+ $(Q)echo " CFLAGS=\"-O2 -Wall ...\" - Overwrite CFLAGS for compilation"
+ $(Q)echo " CPPFLAGS=\"-I <path> ...\" - Additional CFLAGS for compilation"
+ $(Q)echo " LDFLAGS=\"-L <path> ...\" - Additional LDFLAGS for compilation"
+ $(Q)echo " CCACHE= - Do not use ccache for compilation"
+ $(Q)echo " Q= - Show verbose garbage"
diff --git a/Template b/Template
new file mode 100644
index 0000000..d3b4ecc
--- /dev/null
+++ b/Template
@@ -0,0 +1,23 @@
+define TOOL_templ
+ include $(1)/Makefile
+ $(1) $(1)%: BUILD_DIR := $(1)
+ $(1) $(1)%: CFLAGS += $$($(1)-eflags)
+ $(1)_prehook:
+ $(Q)echo "$(bold)$(WHAT) $(1):$(normal)"
+ $(1): $(1)_prehook $$($(1)-lex) $$($(1)-yaac) $$(patsubst %.o,$(1)/%.o,$$($(1)-objs))
+ $(1)_clean: $(1)_clean_custom
+ $(Q)$$(call RM,$(1)/*.o $(1)/$(1) $(1)/*.gz)
+ $(1)_install: $(1)_install_custom
+ $(Q)$$(call INSTX,$(1)/$(1),$$(SBINDIR))
+ $(Q)$(GZIP) $(1).8 > $(1)/$(1).8.gz
+ $(Q)$$(call INSTX,$(1)/$(1).8.gz,$$(MAN8DIR))
+ $(1)_uninstall: $(1)_uninstall_custom
+ $(Q)$$(call RM,$$(SBINDIR)/$(1))
+ $(Q)$$(call RM,$$(MAN8DIR)/$(1).8.gz)
+ $(1)/%.yy.o: $(1)/%.yy.c
+ $$(CC) $$(CFLAGS) -o $$@ -c $$<
+ $(1)/%.tab.o: $(1)/%.tab.c
+ $$(CC) $$(CFLAGS) -o $$@ -c $$<
+ $(1)/%.o: %.c
+ $$(CC) $$(CFLAGS) -o $(1)/$$(shell basename $$@) -c $$<
+endef