Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] RFC: option to Makefile.autotools.in to build in $(PROJECT_BUILD_DIR)
@ 2009-02-17  5:02 Hamish Moffatt
  2009-02-19 11:16 ` Peter Korsgaard
  0 siblings, 1 reply; 7+ messages in thread
From: Hamish Moffatt @ 2009-02-17  5:02 UTC (permalink / raw)
  To: buildroot

I've got a package which will use Makefile.autotools.in that needs to
build in $(PROJECT_BUILD_DIR), because it builds kernel modules.

Here is my proposed patch to Makefile.autotools.in to support this (via
a FOO_BUILD_PROJECT_DIR = YES/NO option). Feedback welcome; unless
there's issues I will commit in a day or two.

Hamish


Index: package/Makefile.autotools.in
===================================================================
--- package/Makefile.autotools.in	(revision 8043)
+++ package/Makefile.autotools.in	(working copy)
@@ -64,6 +64,8 @@
 #	make
 # FOO_DIR_PREFIX [default empty]
 #	toplevel relative path to package *.mk file and corresponding patches
+# FOO_BUILD_PROJECT_DIR [YES/NO, default NO]
+#	Do you want to build in $(PROJECT_BUILD_DIR) rather than $(BUILD_DIR)?
 #
 ## The following variables contain hook target names
 ## by default they do nothing, they can be overriden in package makefiles
@@ -134,7 +136,7 @@
 ################################################################################
 
 # Retrieve and unpack the archive
-$(BUILD_DIR)/%/.stamp_downloaded:
+$(BUILD_DIR)/%/.stamp_downloaded $(PROJECT_BUILD_DIR)/%/.stamp_downloaded:
 # support make source-check/external-deps
 ifneq ($(SPIDER),)
 	$(WGET) -P $(DL_DIR) $($(PKG)_SITE)/$($(PKG)_SOURCE)
@@ -152,7 +154,7 @@
 endif
 
 # Retrieve and unpack the archive
-$(BUILD_DIR)/%/.stamp_extracted:
+$(BUILD_DIR)/%/.stamp_extracted $(PROJECT_BUILD_DIR)/%/.stamp_extracted:
 	$(call MESSAGE,"Extracting")
 	$(Q)mkdir -p $(@D)
 	$(Q)$(INFLATE$(suffix $($(PKG)_SOURCE))) $(DL_DIR)/$($(PKG)_SOURCE) | \
@@ -162,7 +164,7 @@
 	$(Q)touch $@
 
 # Fix libtool support if required by the package
-$(BUILD_DIR)/%/.stamp_libtool_patch:
+$(BUILD_DIR)/%/.stamp_libtool_patch $(PROJECT_BUILD_DIR)/%/.stamp_libtool_patch:
 	$(call MESSAGE,"Patching libtool")
 # if the package uses libtool, patch it for cross-compiling in buildroot
 	$(Q)if test "$($(PKG)_LIBTOOL_PATCH)" = "YES"; then \
@@ -176,8 +178,8 @@
 # XXX: FIXME: This has to be done differently and path-independent, i.e. use
 # XXX: FIXME: the dir-part of the stem as base-dir (instead of hardcoding
 # XXX: FIXME: "package/".
-$(BUILD_DIR)/%/.stamp_patched: NAMEVER = $($(PKG)_NAME)-$($(PKG)_VERSION)
-$(BUILD_DIR)/%/.stamp_patched:
+$(BUILD_DIR)/%/.stamp_patched $(PROJECT_BUILD_DIR)/%/.stamp_patched: NAMEVER = $($(PKG)_NAME)-$($(PKG)_VERSION)
+$(BUILD_DIR)/%/.stamp_patched $(PROJECT_BUILD_DIR)/%/.stamp_patched:
 	$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME)")
 	$(if $($(PKG)_PATCH),toolchain/patch-kernel.sh $(@D) $(DL_DIR) $($(PKG)_PATCH))
 	$(Q)( \
@@ -202,7 +204,7 @@
 	$(Q)touch $@
 
 # Running autoreconf
-$(BUILD_DIR)/%/.stamp_autoconfigured:
+$(BUILD_DIR)/%/.stamp_autoconfigured $(PROJECT_BUILD_DIR)/%/.stamp_autoconfigured:
 	$(call MESSAGE,"Running autoreconf")
 	$(Q)cd $(@D)/$($(PKG)_SUBDIR) && $(AUTORECONF)
 # if the package uses libtool, patch it for cross-compiling in buildroot
@@ -214,7 +216,7 @@
 	$(Q)touch $@
 
 # Configuring
-$(BUILD_DIR)/%/.stamp_configured:
+$(BUILD_DIR)/%/.stamp_configured $(PROJECT_BUILD_DIR)/%/.stamp_configured:
 	$(call MESSAGE,"Configuring")
 	cd $(@D)/$($(PKG)_SUBDIR) && rm -f config.cache && \
 	$(TARGET_CONFIGURE_OPTS) \
@@ -233,13 +235,13 @@
 	$(Q)touch $@
 
 # Build
-$(BUILD_DIR)/%/.stamp_built:
+$(BUILD_DIR)/%/.stamp_built $(PROJECT_BUILD_DIR)/%/.stamp_built:
 	$(call MESSAGE,"Building")
 	$($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_MAKE_OPT) -C $(@D)/$($(PKG)_SUBDIR)
 	$(Q)touch $@
 
 # Install to staging dir
-$(BUILD_DIR)/%/.stamp_staging_installed:
+$(BUILD_DIR)/%/.stamp_staging_installed $(PROJECT_BUILD_DIR)/%/.stamp_staging_installed:
 	$(call MESSAGE,'Installing to host (staging directory)')
 	$($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_INSTALL_STAGING_OPT) -C $(@D)/$($(PKG)_SUBDIR)
 #	toolchain/replace.sh $(STAGING_DIR)/usr/lib ".*\.la" "\(['= ]\)/usr" "\\1$(STAGING_DIR)/usr"
@@ -264,19 +266,19 @@
 	done)
 	touch $@
 
-$(BUILD_DIR)/%/.stamp_cleaned:
+$(BUILD_DIR)/%/.stamp_cleaned $(PROJECT_BUILD_DIR)/%/.stamp_cleaned:
 	$(call MESSAGE,"Cleaning up")
 	-$($(PKG)_MAKE_ENV) $(MAKE)  $($(PKG)_CLEAN_OPT) -C $(@D)/$($(PKG)_SUBDIR)
 	rm -f $(@D)/.stamp_built
 
-$(BUILD_DIR)/%/.stamp_uninstalled:
+$(BUILD_DIR)/%/.stamp_uninstalled $(PROJECT_BUILD_DIR)/%/.stamp_uninstalled:
 	$(call MESSAGE,"Uninstalling")
 	$($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_UNINSTALL_STAGING_OPT) -C $(@D)/$($(PKG)_SUBDIR)
 	rm -f $(@D)/.stamp_staging_installed
 	$($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_UNINSTALL_TARGET_OPT) -C $(@D)/$($(PKG)_SUBDIR)
 	rm -f $($(PKG)_TARGET_INSTALL_TARGET) $($(PKG)_HOOK_POST_INSTALL)
 
-$(BUILD_DIR)/%/.stamp_dircleaned:
+$(BUILD_DIR)/%/.stamp_dircleaned $(PROJECT_BUILD_DIR)/%/.stamp_dircleaned:
 	rm -Rf $(@D)
 
 
@@ -299,7 +301,14 @@
 # define package-specific variables to default values
 $(2)_NAME			=  $(1)
 $(2)_VERSION			?= undefined
-$(2)_DIR			=  $$(BUILD_DIR)/$(1)-$$($(2)_VERSION)
+$(2)_BUILD_PROJECT_DIR		?= NO
+
+ifeq ($$($(2)_BUILD_PROJECT_DIR),YES)
+$(2)_DIR			= $$(PROJECT_BUILD_DIR)/$(1)-$$($(2)_VERSION)
+else
+$(2)_DIR			= $$(BUILD_DIR)/$(1)-$$($(2)_VERSION)
+endif
+
 $(2)_SOURCE			?= $(1)-$$($(2)_VERSION).tar.gz
 $(2)_SITE			?= \
 	http://$$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/$(1)
-- 
Hamish Moffatt VK3SB <hamish@debian.org> <hamish@cloud.net.au>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] RFC: option to Makefile.autotools.in to build in $(PROJECT_BUILD_DIR)
  2009-02-17  5:02 [Buildroot] RFC: option to Makefile.autotools.in to build in $(PROJECT_BUILD_DIR) Hamish Moffatt
@ 2009-02-19 11:16 ` Peter Korsgaard
  2009-02-19 11:33   ` Bernhard Reutner-Fischer
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2009-02-19 11:16 UTC (permalink / raw)
  To: buildroot

>>>>> "Hamish" == Hamish Moffatt <hamish@cloud.net.au> writes:

Hi,

 Hamish> I've got a package which will use Makefile.autotools.in that
 Hamish> needs to build in $(PROJECT_BUILD_DIR), because it builds
 Hamish> kernel modules.

 Hamish> Here is my proposed patch to Makefile.autotools.in to support
 Hamish> this (via a FOO_BUILD_PROJECT_DIR = YES/NO option). Feedback
 Hamish> welcome; unless there's issues I will commit in a day or two.

It adds a lot of clutter, but I also don't see any other way of doing
it. We could change the user interface to be something like
FOO_BUILD_DIR (defaulting to BUILD_DIR), and use it in the

$(2)_DIR                        =  $$(BUILD_DIR)/$(1)-$$($(2)_VERSION)

line - But that probably buys us very little.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] RFC: option to Makefile.autotools.in to build in $(PROJECT_BUILD_DIR)
  2009-02-19 11:16 ` Peter Korsgaard
@ 2009-02-19 11:33   ` Bernhard Reutner-Fischer
  2009-02-19 12:14     ` Peter Korsgaard
  0 siblings, 1 reply; 7+ messages in thread
From: Bernhard Reutner-Fischer @ 2009-02-19 11:33 UTC (permalink / raw)
  To: buildroot

On Thu, Feb 19, 2009 at 12:16:51PM +0100, Peter Korsgaard wrote:
>>>>>> "Hamish" == Hamish Moffatt <hamish@cloud.net.au> writes:
>
>Hi,
>
> Hamish> I've got a package which will use Makefile.autotools.in that
> Hamish> needs to build in $(PROJECT_BUILD_DIR), because it builds
> Hamish> kernel modules.
>
> Hamish> Here is my proposed patch to Makefile.autotools.in to support
> Hamish> this (via a FOO_BUILD_PROJECT_DIR = YES/NO option). Feedback
> Hamish> welcome; unless there's issues I will commit in a day or two.
>
>It adds a lot of clutter, but I also don't see any other way of doing
>it. We could change the user interface to be something like
>FOO_BUILD_DIR (defaulting to BUILD_DIR), and use it in the
>
>$(2)_DIR                        =  $$(BUILD_DIR)/$(1)-$$($(2)_VERSION)
>
>line - But that probably buys us very little.

I admit that i didn't look but it sounds a bit like you would want to
do the same like i did for THIS_SRCDIR (THIS_BUILDDIR comes to mind).
HTH,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] RFC: option to Makefile.autotools.in to build in $(PROJECT_BUILD_DIR)
  2009-02-19 11:33   ` Bernhard Reutner-Fischer
@ 2009-02-19 12:14     ` Peter Korsgaard
  2009-02-19 12:34       ` Bernhard Reutner-Fischer
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2009-02-19 12:14 UTC (permalink / raw)
  To: buildroot

>>>>> "Bernhard" == Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:

Hi,

 Bernhard> I admit that i didn't look but it sounds a bit like you
 Bernhard> would want to do the same like i did for THIS_SRCDIR
 Bernhard> (THIS_BUILDDIR comes to mind).  HTH,

The target-specific-variable make feature is indeed usefull, but I
don't quite see how to apply it in this case.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] RFC: option to Makefile.autotools.in to build in $(PROJECT_BUILD_DIR)
  2009-02-19 12:14     ` Peter Korsgaard
@ 2009-02-19 12:34       ` Bernhard Reutner-Fischer
  2009-02-19 12:43         ` Peter Korsgaard
  0 siblings, 1 reply; 7+ messages in thread
From: Bernhard Reutner-Fischer @ 2009-02-19 12:34 UTC (permalink / raw)
  To: buildroot

On Thu, Feb 19, 2009 at 01:14:56PM +0100, Peter Korsgaard wrote:
>>>>>> "Bernhard" == Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
>
>Hi,
>
> Bernhard> I admit that i didn't look but it sounds a bit like you
> Bernhard> would want to do the same like i did for THIS_SRCDIR
> Bernhard> (THIS_BUILDDIR comes to mind).  HTH,
>
>The target-specific-variable make feature is indeed usefull, but I
>don't quite see how to apply it in this case.

in this case just pickup an eventually given per-package objdir instead
of always using BUILD_DIR, perhaps something like
OBJDIR=$(if $$($(2)_BUILDDIR),$$($(2)_BUILDDIR),$(BUILD_DIR))

so you can just
package/foo/foo.mk:FOO_BUILDDIR=$(PROJECT_BUILDDIR)
(modulo typos)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] RFC: option to Makefile.autotools.in to build in $(PROJECT_BUILD_DIR)
  2009-02-19 12:34       ` Bernhard Reutner-Fischer
@ 2009-02-19 12:43         ` Peter Korsgaard
  2009-02-19 23:39           ` Hamish Moffatt
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2009-02-19 12:43 UTC (permalink / raw)
  To: buildroot

>>>>> "Bernhard" == Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:

Hi,

 >> The target-specific-variable make feature is indeed usefull, but I
 >> don't quite see how to apply it in this case.

 Bernhard> in this case just pickup an eventually given per-package
 Bernhard> objdir instead of always using BUILD_DIR, perhaps something
 Bernhard> like OBJDIR=$(if
 Bernhard> $$($(2)_BUILDDIR),$$($(2)_BUILDDIR),$(BUILD_DIR))

 Bernhard> so you can just
 Bernhard> package/foo/foo.mk:FOO_BUILDDIR=$(PROJECT_BUILDDIR)
 Bernhard> (modulo typos)

That's pretty much what I suggested, but it doesn't remove the etra
complexity to the Makefile.autotools.in rules (there's a generic set
of rules going $(BUILD_DIR)/%/.stamp_<something>:). The package
settings for the other things are done with ?= <default>, so adding a
$(2)_BUILDDIR ?= $(BUILD_DIR) would be enough.


-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] RFC: option to Makefile.autotools.in to build in $(PROJECT_BUILD_DIR)
  2009-02-19 12:43         ` Peter Korsgaard
@ 2009-02-19 23:39           ` Hamish Moffatt
  0 siblings, 0 replies; 7+ messages in thread
From: Hamish Moffatt @ 2009-02-19 23:39 UTC (permalink / raw)
  To: buildroot

On Thu, Feb 19, 2009 at 01:43:06PM +0100, Peter Korsgaard wrote:
> >>>>> "Bernhard" == Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
> 
> Hi,
> 
>  >> The target-specific-variable make feature is indeed usefull, but I
>  >> don't quite see how to apply it in this case.
> 
>  Bernhard> in this case just pickup an eventually given per-package
>  Bernhard> objdir instead of always using BUILD_DIR, perhaps something
>  Bernhard> like OBJDIR=$(if
>  Bernhard> $$($(2)_BUILDDIR),$$($(2)_BUILDDIR),$(BUILD_DIR))
> 
>  Bernhard> so you can just
>  Bernhard> package/foo/foo.mk:FOO_BUILDDIR=$(PROJECT_BUILDDIR)
>  Bernhard> (modulo typos)
> 
> That's pretty much what I suggested, but it doesn't remove the etra
> complexity to the Makefile.autotools.in rules (there's a generic set
> of rules going $(BUILD_DIR)/%/.stamp_<something>:). The package
> settings for the other things are done with ?= <default>, so adding a
> $(2)_BUILDDIR ?= $(BUILD_DIR) would be enough.

An alternative would be to move the rules within the macro expansion,
specifying exact filenames (via variable expansion) rather than using 
$(BUILD_DIR)/%/... That would be neater but would add a significant 
number of new rules (after expansion).


Hamish
-- 
Hamish Moffatt VK3SB <hamish@debian.org> <hamish@cloud.net.au>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-02-19 23:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-17  5:02 [Buildroot] RFC: option to Makefile.autotools.in to build in $(PROJECT_BUILD_DIR) Hamish Moffatt
2009-02-19 11:16 ` Peter Korsgaard
2009-02-19 11:33   ` Bernhard Reutner-Fischer
2009-02-19 12:14     ` Peter Korsgaard
2009-02-19 12:34       ` Bernhard Reutner-Fischer
2009-02-19 12:43         ` Peter Korsgaard
2009-02-19 23:39           ` Hamish Moffatt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox