# Makeconfig fragment for glibc ports add-on.

# These rules make sure that sysdeps/CPU/preconfigure changes are noticed.
# preconfigure fragments can be written by hand, or they can be generated
# from preconfigure.in by autoconf like sysdeps/.../configure.in files.

# Figure out the name of this add-on.  The ports add-on infrastructure
# scripts can be copied into separate add-on packages by any name.
ports-sysdeps = $(..)$(Makeconfig-add-on)/sysdeps

$(common-objpfx)config.status: $(wildcard $(ports-sysdeps)/*/preconfigure)

ifneq ($(AUTOCONF),no)

ifeq ($(with-cvs),yes)
define autoconf-it-cvs
test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
endef
else
autoconf-it-cvs =
endif

define autoconf-it
@-rm -f $@.new
$(AUTOCONF) $(ACFLAGS) $< > $@.new
chmod a-w,a+x $@.new
mv -f $@.new $@
$(autoconf-it-cvs)
endef

$(..)ports/sysdeps/%/preconfigure: $(..)ports/sysdeps/%/preconfigure.in \
				   aclocal.m4
	$(autoconf-it)

endif # $(AUTOCONF) = no

# This allows e.g. `make ports/dist' from a build directory.
ifndef subdir
ports/%:
	$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
endif
