summaryrefslogtreecommitdiff
path: root/Template
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 /Template
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 'Template')
-rw-r--r--Template23
1 files changed, 23 insertions, 0 deletions
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