[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fwd: Making only some targets on cross-compilation
From: |
Philip A. Prindeville |
Subject: |
Fwd: Making only some targets on cross-compilation |
Date: |
Tue, 25 Aug 2009 23:23:06 -0700 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090320) |
Sent this email out, but then didn't hear back... it struck me that it's
not an ALSA bug so much as an automake bug.
The problem is simple: normally, targets like "all" use the
"all-recursive" indirect target (or "install" and "install-recursive",
etc), which then looks like:
SUBDIRS = doc include src $(am__append_1) $(am__append_2) \
$(am__append_3) test utils
...
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
so the problem is this. If you don't want to patch the Makefile,
Makefile.in, or Makefile.am, but want to only build or install a subset
of directories (say for instance your building binary only targets for a
cross-compiled system), then the "include", "doc", and "test" targets
are useless.
So you try to build as:
make all ... SUBDIRS='src utils'
for instance, but that breaks because the child make inherits the same
'SUBDIRS' argument via 'MFLAGS' (even though you only meant it to apply
to the top-level).
I thought about a fix like:
ifneq ($(SUBDIRS),)
SUBDIRS_ = $(SUBDIRS)
else
SUBDIRS_ = doc include src $(am__append_1) $(am__append_2) \
$(am__append_3) test utils
endif
...
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS_)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
to avoid the child inheriting the parent's SUBDIRS, but it would anyway
via SUBDIRS_ indirectly.
Is there a simple way to make sure that whatever value of SUBDIRS is
passed in from the top-level make isn't passed on to sub-makes?
You'd think that this would be the obviously desirable characteristic...
but maybe I'm missing something subtle.
Is this a bug, or a feature? :-)
Thanks,
-Philip
--- Begin Message ---
Subject: |
Making only some targets on cross-compilation |
Date: |
Thu, 20 Aug 2009 17:49:35 -0700 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090320) |
Hi.
I'm working on the astlinux project (www.astlinux.org) and had a
question about doing a build for only a subset of the $SUBDIRS targets.
I tried doing something like:
make -C $(ALSA-LIB_DIR) \
SUBDIRS='src include modules aserver'
but this fails. The problem is that if we look into the environment in
the top-level $(RECURSIVE_TARGETS): we get:
SUBDIRS=include src modules aserver
...
MAKEFLAGS=w --jobserver-fds=3,4 -j -- SUBDIRS=include\ src\ modules\ aserver
CC=/home/philipp/asterisk/build_i586/staging_dir/bin/i586-linux-uclibc-gcc
so those targets eventually get picked up by the make running in
include/, which then overrides his own Makefile value:
SUBDIRS = sound
and tries to build the same top-level targets now in include/. Clearly
this is wrong.
Anyone have a work-around to this? We're on an embedded system, and
don't want to build (nor install, obviously) "doc", "test", "alsalisp",
"utils", etc.
Having something like:
SUBDIRS=$(filter-out $(SUBDIRS_EXCLUDE),$(SUBDIRS))
would be really sweet. Then I could just build as:
make -C $(ALSA-LIB_DIR) \
all SUBDIRS_EXCLUDE='doc test utils'
and only get the targets I want...
Thanks,
-Philip
--- End Message ---
- Fwd: Making only some targets on cross-compilation,
Philip A. Prindeville <=