Fix 'make distclean'

Ken Brown
Sun Jun 5 17:15:00 GMT 2016

Sometimes when a build of Cygwin fails, there will be a message 
suggesting running 'make distclean'.  But this fails to clean the 
winsup/cygwin subdirectory, and the build still fails.

On the other hand, 'make clean' in winsup/cygwin removes two source 
files, which have to be restored before one can rebuild.

The attached patch fixes both problems.

-------------- next part --------------
From 71c16ecc3126a41ae41cbf354428c64282952951 Mon Sep 17 00:00:00 2001
From: Ken Brown <>
Date: Sun, 5 Jun 2016 12:58:22 -0400
Subject: [PATCH] Allow 'make distclean' to clean winsup/cygwin
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

But don’t let it remove source files.
 winsup/        | 4 ++--
 winsup/cygwin/ | 7 ++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/winsup/ b/winsup/
index 1fdf93a..9eca806 100644
--- a/winsup/
+++ b/winsup/
@@ -48,7 +48,7 @@ CLEAN_SUBDIRS=${patsubst %,clean_%,$(SUBDIRS)}
-.PHONY: all install clean all-info info install-info install-license check \
+.PHONY: all install clean distclean all-info info install-info install-license check \
@@ -71,7 +71,7 @@ install-license: CYGWIN_LICENSE COPYING
-clean: $(CLEAN_SUBDIRS)
+clean distclean: $(CLEAN_SUBDIRS)
diff --git a/winsup/cygwin/ b/winsup/cygwin/
index 43919bd..a548368 100644
--- a/winsup/cygwin/
+++ b/winsup/cygwin/
@@ -653,14 +653,15 @@ uninstall-man:
 	    rm -f $(DESTDIR)$(mandir)/man7/`basename $$i` ; \
-	-rm -f *.o *.dll *.dbg *.a *.exp junk *.base *.exe *.d *stamp* *_magic.h sigfe.s cygwin.def globals.h $(srcdir)/$(TLSOFFSETS_H) $(srcdir)/
+clean distclean realclean:
+	-rm -f *.o *.dll *.dbg *.a *.exp junk *.base *.exe *.d *stamp* *_magic.h sigfe.s cygwin.def globals.h
 	-@$(MAKE) -C ${cygserver_blddir} libclean
-maintainer-clean realclean: clean
+maintainer-clean: clean
 	@echo "This command is intended for maintainers to use;"
 	@echo "it deletes files that may require special tools to rebuild."
 	-rm -fr configure
+	-rm -f  $(srcdir)/$(TLSOFFSETS_H) $(srcdir)/
 # Rule to build LDSCRIPT

More information about the Cygwin-patches mailing list