mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
a241a16214
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
103 lines
2.1 KiB
Plaintext
103 lines
2.1 KiB
Plaintext
#
|
|
# Copyright (c) 1999, 2001-2003 Silicon Graphics, Inc. All Rights Reserved.
|
|
#
|
|
ifndef _BUILDRULES_INCLUDED_
|
|
_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
|
|
|
|
# Never blow away subdirs
|
|
ifdef SUBDIRS
|
|
.PRECIOUS: $(SUBDIRS)
|
|
.PHONY: $(SUBDIRS)
|
|
|
|
$(SUBDIRS):
|
|
@echo "Building $@"
|
|
$(Q)$(MAKE) $(MAKEOPTS) -q -C $@ || $(MAKE) $(MAKEOPTS) -C $@
|
|
endif
|
|
|
|
#
|
|
# Standard targets
|
|
#
|
|
|
|
ifdef LTCOMMAND
|
|
$(LTCOMMAND) : $(SUBDIRS) $(OBJECTS) $(LTDEPENDENCIES)
|
|
@echo " [LD] $*"
|
|
$(Q)$(LTLINK) -o $@ $(LDFLAGS) $(OBJECTS) $(LDLIBS)
|
|
endif
|
|
|
|
ifdef LTLIBRARY
|
|
$(LTLIBRARY) : $(SUBDIRS) $(LTOBJECTS)
|
|
@echo " [LD] $*"
|
|
$(Q)$(LTLINK) $(LTLDFLAGS) -o $(LTLIBRARY) $(LTOBJECTS) $(LTLIBS)
|
|
|
|
%.lo: %.c
|
|
@echo " [CC] $@"
|
|
$(Q)$(LTCOMPILE) -c $<
|
|
else
|
|
%.o: %.c
|
|
@echo " [CC] $@"
|
|
$(Q)$(CC) $(CFLAGS) -c $<
|
|
|
|
endif
|
|
|
|
ifdef POTHEAD
|
|
%.pot: $(XGETTEXTFILES)
|
|
$(XGETTEXT) --language=C --keyword=_ -o $@ $(XGETTEXTFILES)
|
|
|
|
# Generate temp .po files, to check whether translations need updating.
|
|
# Not by default, due to gettext output differences between versions.
|
|
%.po: $(POTHEAD)
|
|
# $(MSGMERGE) -o $@.tmpo $@ $(POTHEAD)
|
|
# if ! diff $@.tmpo $@ >/dev/null; then echo "$@ dated, see $@.tmpo"; fi
|
|
|
|
%.mo: %.po
|
|
$(MSGFMT) -o $@ $<
|
|
endif
|
|
|
|
source :
|
|
$(SOURCE_MAKERULE)
|
|
|
|
endif # _BUILDRULES_INCLUDED_
|
|
|
|
$(_FORCE):
|
|
|
|
# dependency build is automatic, relies on gcc -MM to generate.
|
|
.PHONY : depend
|
|
|
|
MAKEDEP := $(MAKEDEPEND) $(CFLAGS)
|
|
|
|
.ltdep: $(CFILES) $(HFILES)
|
|
@echo " [LTDEP]"
|
|
$(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)if [ -n "$$( echo $(CFILES))" ]; then \
|
|
$(MAKEDEP) $(CFILES) | \
|
|
$(SED) -e 's,^\([^:]*\)\.o,\1,' > .dep; \
|
|
else \
|
|
cp /dev/null .dep; \
|
|
fi
|
|
|