* [PATCH 2/2] xfstests: some refinements on "make depend"
@ 2011-03-04 19:37 Alex Elder
2011-03-10 17:26 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Alex Elder @ 2011-03-04 19:37 UTC (permalink / raw)
To: xfs
Make it so "make depend" is a generic target, like "make clean".
Each Makefile has a "depend" target that indicates whether making
dependencies means creating ".dep" or creating ".ltdep" (or, I
suppose, both, though none do that right now). Both files get
created even if there are no CFILES to scan (to ensure the target
up-to-date). The "default" target now depends on "depend" (there is
no "ltdepend" any more).
Remove the "depend" and "ltdepend" definitions from the "buildrules"
file; only the actual generated files (".dep" and ".ltdep") remain
as generic targets. The "depend' target is still defined as phony.
Do a shell trick when expanding the value of CFILES, to avoid a
problem that occurs if it is created by "make" by concatentating two
empty strings. The problem was that in that case CFILES will
contain a space, and that wasn't getting treated as empty as
desired.
Make the rule for tool/lib dependencies more generic, to reflect the
general desire that "lib" subdirectories need to be built before
things in the "tool" subdirectories.
Signed-off-by: Alex Elder <aelder@sgi.com>
---
Makefile | 4 +++-
include/buildrules | 31 +++++++++++++++++++++----------
lib/Makefile | 4 +++-
ltp/Makefile | 2 ++
src/Makefile | 2 ++
src/aio-dio-regress/Makefile | 2 ++
6 files changed, 33 insertions(+), 12 deletions(-)
Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ endif
endif
# tool/lib dependencies
-src ltp: lib
+$(TOOL_SUBDIRS): $(LIB_SUBDIRS)
ifeq ($(HAVE_BUILDDEFS), yes)
include $(BUILDRULES)
@@ -77,6 +77,8 @@ endif
aclocal.m4::
aclocal --acdir=`pwd`/m4 --output=$@
+depend: include/builddefs $(addsuffix -depend,$(SUBDIRS))
+
install: default $(addsuffix -install,$(SUBDIRS))
$(INSTALL) -m 755 -d $(PKG_LIB_DIR)
$(INSTALL) -m 755 check $(PKG_LIB_DIR)
Index: b/include/buildrules
===================================================================
--- a/include/buildrules
+++ b/include/buildrules
@@ -6,13 +6,20 @@ _BUILDRULES_INCLUDED_ = 1
include $(TOPDIR)/include/builddefs
+depend: $(addsuffix -depend,$(SUBDIRS))
+
+%-depend:
+ $(Q)$(MAKE) $(MAKEOPTS) -q -C $* depend || \
+ $(MAKE) $(MAKEOPTS) -C $* depend
+
clean clobber : $(addsuffix -clean,$(SUBDIRS))
$(Q)rm -f $(DIRT)
$(Q)rm -fr .libs .ltdep .dep
%-clean:
@echo "Cleaning $*"
- $(Q)$(MAKE) $(MAKEOPTS) -q -C $* clean || $(MAKE) $(MAKEOPTS) -C $* clean
+ $(Q)$(MAKE) $(MAKEOPTS) -q -C $* clean || \
+ $(MAKE) $(MAKEOPTS) -C $* clean
# Never blow away subdirs
ifdef SUBDIRS
@@ -71,21 +78,25 @@ endif # _BUILDRULES_INCLUDED_
$(_FORCE):
# dependency build is automatic, relies on gcc -MM to generate.
-.PHONY : depend ltdepend
+.PHONY : depend
MAKEDEP := $(MAKEDEPEND) $(CFLAGS)
-ltdepend: .ltdep
-
.ltdep: $(CFILES) $(HFILES)
@echo " [LTDEP]"
- $(Q)[ -n "$(CFILES)" ] && \
- $(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,' > .ltdep
-
-depend: .dep
+ $(Q)if [ -n "$$( echo $(CFILES))" ]; then \
+ $(MAKEDEP) $(CFILES) | \
+ $(SED) -e 's,^\([^:]*\)\.o,\1.lo,' > .ltdep; \
+ else \
+ cp /dev/null .ltdep; \
+ fi
.dep: $(CFILES) $(HFILES)
@echo " [DEP]"
- $(Q)[ -n "$(CFILES)" ] && \
- $(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1,' > .dep
+ $(Q)if [ -n "$$( echo $(CFILES))" ]; then \
+ $(MAKEDEP) $(CFILES) | \
+ $(SED) -e 's,^\([^:]*\)\.o,\1,' > .dep; \
+ else \
+ cp /dev/null .dep; \
+ fi
Index: b/lib/Makefile
===================================================================
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -19,10 +19,12 @@ CFILES = dataascii.c databin.c datapid.c
str_to_bytes.c tlibio.c write_log.c \
random.c
-default: ltdepend $(LTLIBRARY)
+default: depend $(LTLIBRARY)
include $(BUILDRULES)
+depend: .ltdep
+
install install-dev: default
-include .ltdep
Index: b/ltp/Makefile
===================================================================
--- a/ltp/Makefile
+++ b/ltp/Makefile
@@ -29,6 +29,8 @@ endif
default: depend $(TARGETS)
+depend: .dep
+
include $(BUILDRULES)
$(TARGETS): $(LIBTEST)
Index: b/src/Makefile
===================================================================
--- a/src/Makefile
+++ b/src/Makefile
@@ -61,6 +61,8 @@ LDIRT = $(TARGETS)
default: depend $(TARGETS) $(SUBDIRS)
+depend: .dep
+
include $(BUILDRULES)
$(TARGETS): $(LIBTEST)
Index: b/src/aio-dio-regress/Makefile
===================================================================
--- a/src/aio-dio-regress/Makefile
+++ b/src/aio-dio-regress/Makefile
@@ -10,6 +10,8 @@ LLDLIBS = -laio -lpthread
default: depend $(TARGETS)
+depend: .dep
+
include $(BUILDRULES)
$(TARGETS):
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] xfstests: some refinements on "make depend"
2011-03-04 19:37 [PATCH 2/2] xfstests: some refinements on "make depend" Alex Elder
@ 2011-03-10 17:26 ` Christoph Hellwig
2011-03-10 22:09 ` Alex Elder
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2011-03-10 17:26 UTC (permalink / raw)
To: Alex Elder; +Cc: xfs
On Fri, Mar 04, 2011 at 01:37:41PM -0600, Alex Elder wrote:
> Make it so "make depend" is a generic target, like "make clean".
>
> Each Makefile has a "depend" target that indicates whether making
> dependencies means creating ".dep" or creating ".ltdep" (or, I
> suppose, both, though none do that right now). Both files get
> created even if there are no CFILES to scan (to ensure the target
> up-to-date). The "default" target now depends on "depend" (there is
> no "ltdepend" any more).
>
> Remove the "depend" and "ltdepend" definitions from the "buildrules"
> file; only the actual generated files (".dep" and ".ltdep") remain
> as generic targets. The "depend' target is still defined as phony.
>
> Do a shell trick when expanding the value of CFILES, to avoid a
> problem that occurs if it is created by "make" by concatentating two
> empty strings. The problem was that in that case CFILES will
> contain a space, and that wasn't getting treated as empty as
> desired.
>
> Make the rule for tool/lib dependencies more generic, to reflect the
> general desire that "lib" subdirectories need to be built before
> things in the "tool" subdirectories.
Can we instead port over the generic dependency generation from
xfsprogs/xfsdump?
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] xfstests: some refinements on "make depend"
2011-03-10 17:26 ` Christoph Hellwig
@ 2011-03-10 22:09 ` Alex Elder
2011-03-11 10:10 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Alex Elder @ 2011-03-10 22:09 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs
On Thu, 2011-03-10 at 12:26 -0500, Christoph Hellwig wrote:
> On Fri, Mar 04, 2011 at 01:37:41PM -0600, Alex Elder wrote:
> > Make it so "make depend" is a generic target, like "make clean".
> >
> > Each Makefile has a "depend" target that indicates whether making
> > dependencies means creating ".dep" or creating ".ltdep" (or, I
> > suppose, both, though none do that right now). Both files get
> > created even if there are no CFILES to scan (to ensure the target
> > up-to-date). The "default" target now depends on "depend" (there is
> > no "ltdepend" any more).
> >
> > Remove the "depend" and "ltdepend" definitions from the "buildrules"
> > file; only the actual generated files (".dep" and ".ltdep") remain
> > as generic targets. The "depend' target is still defined as phony.
> >
> > Do a shell trick when expanding the value of CFILES, to avoid a
> > problem that occurs if it is created by "make" by concatentating two
> > empty strings. The problem was that in that case CFILES will
> > contain a space, and that wasn't getting treated as empty as
> > desired.
> >
> > Make the rule for tool/lib dependencies more generic, to reflect the
> > general desire that "lib" subdirectories need to be built before
> > things in the "tool" subdirectories.
>
> Can we instead port over the generic dependency generation from
> xfsprogs/xfsdump?
My intention was to work toward unifying all the user space
stuff, basically in line with what you suggest.
This is part of a flurry of changes related to the xfstests
dmapi subtree. One of the things I needed to do was populate
a set of new Makefiles there, and I guess in looking into
that I found I didn't like the way the dependencies were done,
and the changes I made to address that ended up in this patch.
I'll hold off on this patch and will reconsider it once
I get the more substantive dmapi changes in.
-Alex
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] xfstests: some refinements on "make depend"
2011-03-10 22:09 ` Alex Elder
@ 2011-03-11 10:10 ` Christoph Hellwig
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2011-03-11 10:10 UTC (permalink / raw)
To: Alex Elder; +Cc: Christoph Hellwig, xfs
On Thu, Mar 10, 2011 at 04:09:36PM -0600, Alex Elder wrote:
> My intention was to work toward unifying all the user space
> stuff, basically in line with what you suggest.
>
> This is part of a flurry of changes related to the xfstests
> dmapi subtree. One of the things I needed to do was populate
> a set of new Makefiles there, and I guess in looking into
> that I found I didn't like the way the dependencies were done,
> and the changes I made to address that ended up in this patch.
>
> I'll hold off on this patch and will reconsider it once
> I get the more substantive dmapi changes in.
Feel free to put it in for now as a transition step.
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-11 10:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-04 19:37 [PATCH 2/2] xfstests: some refinements on "make depend" Alex Elder
2011-03-10 17:26 ` Christoph Hellwig
2011-03-10 22:09 ` Alex Elder
2011-03-11 10:10 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox