DPDK patches and discussions
 help / color / mirror / Atom feed
From: Keith Wiles <keith.wiles@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] mk: add makefile extention support
Date: Tue,  9 Feb 2016 11:35:14 -0600	[thread overview]
Message-ID: <1455039314-86891-1-git-send-email-keith.wiles@intel.com> (raw)

Adding support to the build system to allow for Makefile.XXX
extention to a subtree, which already has Makefiles. These
Makefiles could be from the autotools and others places. Using
the Makefile extention RTE_MKFILE_SUFFIX in a makefile subtree
using 'export RTE_MKFILE_SUFFIX=.XXX' to use Makefile.XXX in
that subtree.

The main reason I needed this feature was to integrate a autotool
open source projects with DPDK and keep the original Makefiles.

Signed-off-by: Keith Wiles <keith.wiles@intel.com>
---
 mk/internal/rte.extvars.mk |  2 +-
 mk/rte.bsdmodule.mk        |  6 +++---
 mk/rte.extsubdir.mk        |  2 +-
 mk/rte.module.mk           |  6 +++---
 mk/rte.sdkbuild.mk         | 10 +++++-----
 mk/rte.sdkconfig.mk        |  6 +++---
 mk/rte.sdkdepdirs.mk       | 10 +++++-----
 mk/rte.sdkgcov.mk          |  2 +-
 mk/rte.sdktest.mk          |  2 +-
 mk/rte.subdir.mk           | 14 +++++++-------
 10 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/mk/internal/rte.extvars.mk b/mk/internal/rte.extvars.mk
index 040d39f..3361551 100644
--- a/mk/internal/rte.extvars.mk
+++ b/mk/internal/rte.extvars.mk
@@ -48,7 +48,7 @@ ifeq ("$(origin M)", "command line")
 RTE_EXTMK := $(abspath $(M))
 endif
 endif
-RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile
+RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile$(RTE_MKFILE_SUFFIX)
 export RTE_EXTMK
 
 # RTE_SDK_BIN must point to .config, include/ and lib/.
diff --git a/mk/rte.bsdmodule.mk b/mk/rte.bsdmodule.mk
index 86b92ff..e8a504a 100644
--- a/mk/rte.bsdmodule.mk
+++ b/mk/rte.bsdmodule.mk
@@ -80,7 +80,7 @@ build: _postbuild
 
 # build module
 $(MODULE).ko: $(SRCS_LINKS)
-	$(Q)if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; fi
+	$(Q)if [ ! -f $(notdir Makefile)$(RTE_MKFILE_SUFFIX) ]; then ln -nfs $(SRCDIR)/Makefile$(RTE_MKFILE_SUFFIX) . ; fi
 	$(Q)if [ ! -f $(notdir BSDmakefile) ]; then ln -nfs $(SRCDIR)/BSDmakefile . ; fi
 	$(Q)MAKEFLAGS= $(BSDMAKE)
 
@@ -100,11 +100,11 @@ clean: _postclean
 # do a make clean and remove links
 .PHONY: doclean
 doclean:
-	$(Q)if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; fi
+	$(Q)if [ ! -f $(notdir Makefile$(RTE_MKFILE_SUFFIX)) ]; then ln -nfs $(SRCDIR)/Makefile$(RTE_MKFILE_SUFFIX) . ; fi
 	$(Q)$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR) clean
 	$(Q)$(foreach FILE,$(SRCS-y) $(SRCS-n) $(SRCS-),\
 		if [ -h $(notdir $(FILE)) ]; then rm -f $(notdir $(FILE)) ; fi ;)
-	$(Q)if [ -h $(notdir Makefile) ]; then rm -f $(notdir Makefile) ; fi
+	$(Q)if [ -h $(notdir Makefile$(RTE_MKFILE_SUFFIX)) ]; then rm -f $(notdir Makefile$(RTE_MKFILE_SUFFIX)) ; fi
 	$(Q)rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) \
 		$(INSTALL-FILES-all)
 
diff --git a/mk/rte.extsubdir.mk b/mk/rte.extsubdir.mk
index f50f006..55d4e16 100644
--- a/mk/rte.extsubdir.mk
+++ b/mk/rte.extsubdir.mk
@@ -45,7 +45,7 @@ clean: $(DIRS-y)
 $(DIRS-y):
 	@echo "== $@"
 	$(Q)$(MAKE) -C $(@) \
-		M=$(CURDIR)/$(@)/Makefile \
+		M=$(CURDIR)/$(@)/Makefile$(RTE_MKFILE_SUFFIX) \
 		O=$(BASE_OUTPUT)/$(CUR_SUBDIR)/$(@)/$(RTE_TARGET) \
 		BASE_OUTPUT=$(BASE_OUTPUT) \
 		CUR_SUBDIR=$(CUR_SUBDIR)/$(@) \
diff --git a/mk/rte.module.mk b/mk/rte.module.mk
index 53ed4fe..6477bbe 100644
--- a/mk/rte.module.mk
+++ b/mk/rte.module.mk
@@ -76,7 +76,7 @@ build: _postbuild
 
 # build module
 $(MODULE).ko: $(SRCS_LINKS)
-	@if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; fi
+	@if [ ! -f $(notdir Makefile$(RTE_MKFILE_SUFFIX)) ]; then ln -nfs $(SRCDIR)/Makefile$(RTE_MKFILE_SUFFIX) . ; fi
 	@$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR) \
 		CC="$(KERNELCC)" CROSS_COMPILE=$(CROSS) V=$(if $V,1,0)
 
@@ -97,11 +97,11 @@ clean: _postclean
 # do a make clean and remove links
 .PHONY: doclean
 doclean:
-	@if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; fi
+	@if [ ! -f $(notdir Makefile$(RTE_MKFILE_SUFFIX)) ]; then ln -nfs $(SRCDIR)/Makefile$(RTE_MKFILE_SUFFIX) . ; fi
 	$(Q)$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR) clean
 	@$(foreach FILE,$(SRCS-y) $(SRCS-n) $(SRCS-),\
 		if [ -h $(notdir $(FILE)) ]; then rm -f $(notdir $(FILE)) ; fi ;)
-	@if [ -h $(notdir Makefile) ]; then rm -f $(notdir Makefile) ; fi
+	@if [ -h $(notdir Makefile$(RTE_MKFILE_SUFFIX)) ]; then rm -f $(notdir Makefile$(RTE_MKFILE_SUFFIX)) ; fi
 	@rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) \
 		$(INSTALL-FILES-all)
 
diff --git a/mk/rte.sdkbuild.mk b/mk/rte.sdkbuild.mk
index 85f603c..3860843 100644
--- a/mk/rte.sdkbuild.mk
+++ b/mk/rte.sdkbuild.mk
@@ -76,15 +76,15 @@ clean: $(CLEANDIRS)
 $(ROOTDIRS-y):
 	@[ -d $(BUILDDIR)/$@ ] || mkdir -p $(BUILDDIR)/$@
 	@echo "== Build $@"
-	$(Q)$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile -C $(BUILDDIR)/$@ all
+	$(Q)$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile$(RTE_MKFILE_SUFFIX) -C $(BUILDDIR)/$@ all
 	@if [ $@ = drivers -a $(CONFIG_RTE_BUILD_COMBINE_LIBS) = y ]; then \
-		$(MAKE) -f $(RTE_SDK)/lib/Makefile sharelib; \
+	$(MAKE) -f $(RTE_SDK)/lib/Makefile$(RTE_MKFILE_SUFFIX) sharelib; \
 	fi
 
 %_clean:
 	@echo "== Clean $*"
-	$(Q)if [ -f $(RTE_SRCDIR)/$*/Makefile -a -d $(BUILDDIR)/$* ]; then \
-		$(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* clean ; \
+	$(Q)if [ -f $(RTE_SRCDIR)/$*/Makefile$(RTE_MKFILE_SUFFIX) -a -d $(BUILDDIR)/$* ]; then \
+	$(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile$(RTE_MKFILE_SUFFIX) -C $(BUILDDIR)/$* clean ; \
 	fi
 
 RTE_MAKE_SUBTARGET ?= all
@@ -93,7 +93,7 @@ RTE_MAKE_SUBTARGET ?= all
 	@echo $(addsuffix _sub,$(FULL_DEPDIRS-$(*)))
 	@[ -d $(BUILDDIR)/$* ] || mkdir -p $(BUILDDIR)/$*
 	@echo "== Build $*"
-	$(Q)$(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* \
+	$(Q)$(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile$(RTE_MKFILE_SUFFIX) -C $(BUILDDIR)/$* \
 		$(RTE_MAKE_SUBTARGET)
 
 .PHONY: all
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index f8d95b1..48d377a 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -61,7 +61,7 @@ notemplate:
 ifeq ($(RTE_CONFIG_TEMPLATE),)
 config: notemplate
 else
-config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
+config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile$(RTE_MKFILE_SUFFIX)
 	$(Q)$(MAKE) depdirs
 	@echo "Configuration done"
 endif
@@ -93,9 +93,9 @@ SDK_RELPATH=$(shell $(RTE_SDK)/scripts/relpath.sh $(abspath $(RTE_SRCDIR)) \
 				$(abspath $(RTE_OUTPUT)))
 OUTPUT_RELPATH=$(shell $(RTE_SDK)/scripts/relpath.sh $(abspath $(RTE_OUTPUT)) \
 				$(abspath $(RTE_SRCDIR)))
-$(RTE_OUTPUT)/Makefile: | $(RTE_OUTPUT)
+$(RTE_OUTPUT)/Makefile$(RTE_MKFILE_SUFFIX): | $(RTE_OUTPUT)
 	$(Q)$(RTE_SDK)/scripts/gen-build-mk.sh $(SDK_RELPATH) $(OUTPUT_RELPATH) \
-		> $(RTE_OUTPUT)/Makefile
+		> $(RTE_OUTPUT)/Makefile$(RTE_MKFILE_SUFFIX)
 
 # clean installed files, and generate a new config header file
 # if NODOTCONF variable is defined, don't try to rebuild .config
diff --git a/mk/rte.sdkdepdirs.mk b/mk/rte.sdkdepdirs.mk
index bebaf2a..06c49fc 100644
--- a/mk/rte.sdkdepdirs.mk
+++ b/mk/rte.sdkdepdirs.mk
@@ -32,7 +32,7 @@
 ifeq (,$(wildcard $(RTE_OUTPUT)/.config))
   $(error "need a make config first")
 endif
-ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile))
+ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile$(RTE_MKFILE_SUFFIX)))
   $(error "need a make config first")
 endif
 
@@ -43,9 +43,9 @@ depdirs: $(RTE_OUTPUT)/.depdirs
 $(RTE_OUTPUT)/.depdirs: $(RTE_OUTPUT)/.config
 	@rm -f $(RTE_OUTPUT)/.depdirs ; \
 	for d in $(ROOTDIRS-y); do \
-		if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \
+		if [ -f $(RTE_SRCDIR)/$$d/Makefile$(RTE_MKFILE_SUFFIX) ]; then \
 			[ -d $(BUILDDIR)/$$d ] || mkdir -p $(BUILDDIR)/$$d ; \
-			$(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depdirs \
+			$(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile$(RTE_MKFILE_SUFFIX) depdirs \
 				>> $(RTE_OUTPUT)/.depdirs ; \
 		fi ; \
 	done
@@ -57,8 +57,8 @@ depgraph:
 	echo "    node [color=lightblue2, style=filled];" ; \
 	for d in $(ROOTDIRS-y); do \
 		echo "    \"root\" -> \"$$d\"" ; \
-		if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \
-			$(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depgraph ; \
+		if [ -f $(RTE_SRCDIR)/$$d/Makefile$(RTE_MKFILE_SUFFIX) ]; then \
+			$(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile$(RTE_MKFILE_SUFFIX) depgraph ; \
 		fi ; \
 	done ; \
 	echo "}"
diff --git a/mk/rte.sdkgcov.mk b/mk/rte.sdkgcov.mk
index fd20fd7..42e4445 100644
--- a/mk/rte.sdkgcov.mk
+++ b/mk/rte.sdkgcov.mk
@@ -40,7 +40,7 @@ ifeq (,$(wildcard $(RTE_OUTPUT)/.config))
 else
   include $(RTE_SDK)/mk/rte.vars.mk
 endif
-ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile))
+ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile$(RTE_MKFILE_SUFFIX)))
   $(error "need a make config first")
 endif
 
diff --git a/mk/rte.sdktest.mk b/mk/rte.sdktest.mk
index ee25f28..932e853 100644
--- a/mk/rte.sdktest.mk
+++ b/mk/rte.sdktest.mk
@@ -34,7 +34,7 @@ ifeq (,$(wildcard $(RTE_OUTPUT)/.config))
 else
   include $(RTE_SDK)/mk/rte.vars.mk
 endif
-ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile))
+ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile$(RTE_MKFILE_SUFFIX)))
   $(error "need a make config first")
 endif
 
diff --git a/mk/rte.subdir.mk b/mk/rte.subdir.mk
index 256e64e..999585e 100644
--- a/mk/rte.subdir.mk
+++ b/mk/rte.subdir.mk
@@ -60,15 +60,15 @@ build: _postbuild
 $(DIRS-y):
 	@[ -d $(CURDIR)/$@ ] || mkdir -p $(CURDIR)/$@
 	@echo "== Build $S/$@"
-	@$(MAKE) S=$S/$@ -f $(SRCDIR)/$@/Makefile -C $(CURDIR)/$@ all
+	@$(MAKE) S=$S/$@ -f $(SRCDIR)/$@/Makefile$(RTE_MKFILE_SUFFIX) -C $(CURDIR)/$@ all
 
 .PHONY: clean
 clean: _postclean
 
 %_clean:
 	@echo "== Clean $S/$*"
-	@if [ -f $(SRCDIR)/$*/Makefile -a -d $(CURDIR)/$* ]; then \
-		$(MAKE) S=$S/$* -f $(SRCDIR)/$*/Makefile -C $(CURDIR)/$* clean ; \
+	@if [ -f $(SRCDIR)/$*/Makefile$(RTE_MKFILE_SUFFIX) -a -d $(CURDIR)/$* ]; then \
+	$(MAKE) S=$S/$* -f $(SRCDIR)/$*/Makefile$(RTE_MKFILE_SUFFIX) -C $(CURDIR)/$* clean ; \
 	fi
 	@rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS)
 
@@ -90,8 +90,8 @@ $(foreach d,$(DIRS-y),$(eval $(call depdirs_rule,$(d))))
 .PHONY: depdirs
 depdirs:
 	@for d in $(DIRS-y); do \
-		if [ -f $(SRCDIR)/$$d/Makefile ]; then \
-			$(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depdirs ; \
+	if [ -f $(SRCDIR)/$$d/Makefile$(RTE_MKFILE_SUFFIX) ]; then \
+		$(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile$(RTE_MKFILE_SUFFIX) depdirs ; \
 		fi ; \
 	done
 
@@ -99,8 +99,8 @@ depdirs:
 depgraph:
 	@for d in $(DIRS-y); do \
 		echo "    \"$(S)\" -> \"$(S)/$$d\"" ; \
-		if [ -f $(SRCDIR)/$$d/Makefile ]; then \
-			$(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depgraph ; \
+		if [ -f $(SRCDIR)/$$d/Makefile$(RTE_MKFILE_SUFFIX) ]; then \
+			$(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile$(RTE_MKFILE_SUFFIX) depgraph ; \
 		fi ; \
 	done
 
-- 
2.7.0

             reply	other threads:[~2016-02-09 17:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09 17:35 Keith Wiles [this message]
2016-02-24 15:22 ` Wiles, Keith
2016-02-28 21:00 ` Thomas Monjalon
2016-02-28 21:47   ` Wiles, Keith
2016-02-29  8:21     ` Thomas Monjalon
2016-02-29 14:12       ` Wiles, Keith
2016-03-03 14:55         ` Wiles, Keith
2016-03-03 16:33           ` Thomas Monjalon
2016-03-03 17:53             ` Wiles, Keith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455039314-86891-1-git-send-email-keith.wiles@intel.com \
    --to=keith.wiles@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).