# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
# Cambridge, MA 02139, USA.
-ifndef objpfx
-You must use the parent or subdirectory Makefile, not this one directly.
-endif
-
dist:
ifdef subdir
ifndef sysdep_dirs
# Find all sysdep directories.
-sysdep_dirs := $(shell find $(..)sysdeps -type d -print)
+export sysdep_dirs := $(shell find $(..)sysdeps -type d -print)
else
# Defined by the parent.
sysdep_dirs := $(addprefix $(..),$(sysdep_dirs))
ifdef subdir
all-headers = $(headers)
else
-+distinfo := $(shell MAKEFLAGS= MFLAGS= $(MAKE) -s no_deps=t echo-distinfo)
++distinfo := $(shell MAKEFLAGS= MFLAGS= $(MAKE) -s no_deps=t echo-distinfo \
+ | grep -v '^make')
all-headers := $(patsubst +header+%,%,$(filter +header+%,$(+distinfo)))
+subdir-nodist := $(patsubst +nodist+%,%,$(filter +nodist+%,$(+distinfo)))
+subdir-headers := $(filter-out $(headers),$(all-headers))
endif
+foo:=$(shell echo 'IS THIS WORKING??? all-headers=$(all-headers)' >&2)
# Find all sysdep sources and headers.
+maybe-sysdeps := $(sources) $(sources:.c=.s) $(sources:.c=.S) $(all-headers) \
$(filter %.c %.S %.s %.h,$(distribute))
foo:=$(shell echo '+maybe-sysdeps=$(+maybe-sysdeps)'>&2)
+# Find all the files that have a stub or generic version.
+try-sysdeps := $(foreach dir,$(..)sysdeps/stub $(..)sysdeps/generic,\
+ $(addprefix $(dir)/,$(+maybe-sysdeps)))
+foo:=$(shell echo 'try-sysdeps=$(try-sysdeps)'>&2)
++sysdeps := $(wildcard $(try-sysdeps))
+foo:=$(shell echo 'stub/generic +sysdeps=$(+sysdeps)'>&2)
++sysdep-names := $(sort $(notdir $(+sysdeps)))
+foo:=$(shell echo '+sysdep-names=$(+sysdep-names)' >&2)
+
+# Now find all the sysdep versions of those files.
+sysdeps := $(wildcard $(foreach dir,$(sysdep_dirs) $(source_dirs),\
- $(addprefix $(dir)/,$(+maybe-sysdeps))))
+ $(addprefix $(dir)/, \
+ $(+sysdep-names) \
+ $(+sysdep-names:.c=.s) \
+ $(+sysdep-names:.c=.S) \
+ )))
+
# Source and header files to go in the distribution tar file.
.S.s := $(wildcard $(sources:.c=.S) $(sources:.c=.s))
sources := $(filter-out $(addsuffix .c,$(basename $(.S.s))),$(sources)) $(.S.s)
-+sysdep-names := $(sort $(notdir $(+sysdeps)))
-foo:=$(shell echo '+sysdep-names=$(+sysdep-names)' >&2)
+out := $(patsubst %.S,%.c,$(+sysdep-names:.s=.c)) \
$(addsuffix .c,$(sysdep_routines)) \
$(+subdir-nodist)
$(..)glibc-%:
ln -s . $@
++tsrcs := $(+tsrcs) \
+ TAGS
+.PHONY: TAGS
+TAGS: $(..)MakeTAGS
+ $(MAKE) -f $< $@ -o subdir_TAGS
+
ifdef subdir
foo:=$(shell echo subdir foo >&2)
+tardeps := $(strip $(+tsrcs))
+tsrcs := $(addprefix $(tardir)/$(subdir)/,$(+tardeps))
+verbose = v
+
.PHONY: dist
dist: $(..)$(tardir) $(+tardeps)
@cd ..; if test -f dist.tar; then c=u; else c=c; fi; \
$(sysdep-Subdir-files)
foo:=$(shell echo '+sysdep-dist=$(+sysdep-dist)' >&2)
+subdirs := $(filter-out crypt,$(subdirs))
+
+sysdep-tsrcs := $(wildcard $(foreach file,Makefile Implies,\
$(addsuffix /$(file),$(sysdep_dirs)))) \
$(+sysdep-dist)
-+tsrcs := $(distribute) $(+tsrcs) $(+sysdep-tsrcs)
++tsrcs := $(+tsrcs) $(+sysdep-tsrcs)
.PHONY: dist
# N.B.: The order in which these are done matters (so don't use -j).
MAKEFLAGS = -j1 # I wonder if that works.
-dist: dist.tar subdir_dist de-.. dist.tar.Z
+dist: dist.tar subdir_dist de-.. dist.tar.Z \
+ $(tardir).tar.Z $(tardir)-crypt.tar.Z
+
+$(tardir).tar.Z: dist.tar.Z
+ ln $< $@
+
+$(tardir)-crypt.tar.Z: crypt/crypt.tar.Z
+ ln $< $@
+crypt/%: FORCE
+ $(MAKE) -C $(@D) $(@F)
+FORCE:
dist.tar: $(tardir) $(+tsrcs)
tar ch$(verbose)f $@ $(addprefix $(tardir)/,$(filter-out $(tardir),$^))
de-..: dist.tar
tar xf $< -C /tmp
tar cf $< -C /tmp $(tardir)
- -rm -fr /tmp/$(tardir)
-
-README: README.template version.c
- -rm -f $@
- sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
-# Make it unwritable so I won't change it by mistake.
- chmod a-w $@
-
-INSTALL: manual/maint.texinfo
- makeinfo +no-validate +no-warn +no-headers $<
+ -rm -fr /tmp/$(tardir) &
%.Z: %
compress -c $< > $@
endif # Subdirectory vs. parent makefile
\f
# Get these things out of the environment because they take up lots of space.
-override distribute :=
-override sources :=
-override objects :=
-override routines :=
-override aux :=
+unexport distribute sources