path: root/Makefile
diff options
authorRich Felker <>2016-02-17 16:11:45 -0500
committerRich Felker <>2016-02-17 16:11:45 -0500
commit157e28492a287907fb6f3d39894c2c1b84122b51 (patch)
treec1c6cfb5521b827746798ba10bf233b195a784ea /Makefile
parent63bcda4d8f4074e9d92ae156afd0dced6e64eb65 (diff)
support clean/distclean make targets in unconfigured tree
commit 2f853dd6b9a95d5b13ee8f9df762125e0588df5d moved the error handling for $(ARCH) not being set such that it applied to all targets, including clean and distclean. previously these targets worked even in an unconfigured tree. to restore the old behavior, make most of the makefile body conditional on $(ARCH) being set/non-empty and produce the error via a fake "all" target in the conditional branch for the case where $(ARCH) is empty.
Diffstat (limited to 'Makefile')
1 files changed, 16 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 6daf2c45..3e656d26 100644
--- a/Makefile
+++ b/Makefile
@@ -77,8 +77,12 @@ LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH)$(SUBARCH).so.1
-include config.mak
ifeq ($(ARCH),)
-$(error Please set ARCH in config.mak before running make.)
+ @echo "Please set ARCH in config.mak before running make."
+ @exit 1
@@ -89,14 +93,6 @@ $(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(ALL_OBJS:%.o=%.lo) $(GENH) $(GENH_INT): |
mkdir -p $@
-install: install-libs install-headers install-tools
- rm -rf obj lib
-distclean: clean
- rm -f config.mak
obj/include/bits/alltypes.h: $(srcdir)/arch/$(ARCH)/bits/ $(srcdir)/include/ $(srcdir)/tools/mkalltypes.sed
sed -f $(srcdir)/tools/mkalltypes.sed $(srcdir)/arch/$(ARCH)/bits/ $(srcdir)/include/ > $@
@@ -223,10 +219,20 @@ install-headers: $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%)
install-tools: $(ALL_TOOLS:obj/%=$(DESTDIR)$(bindir)/%)
+install: install-libs install-headers install-tools
musl-git-%.tar.gz: .git
git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ $(patsubst musl-git-%.tar.gz,%,$@)
musl-%.tar.gz: .git
git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ v$(patsubst musl-%.tar.gz,%,$@)
+ rm -rf obj lib
+distclean: clean
+ rm -f config.mak
.PHONY: all clean install install-libs install-headers install-tools