bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fixing `make distclean'


From: Neal H Walfield
Subject: Fixing `make distclean'
Date: Thu, 15 Nov 2001 23:51:21 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1

Now that we have nice tag files, they should be deleted when the user
runs `make distclean'.  At least, that is my interpretation of the
distclean target as found in the GNU Coding Standards:

    `distclean'
          Delete all files from the current directory that are created by
          configuring or building the program.  If you have unpacked the
          source and built the program without creating any other files,
          `make distclean' should leave only the files that were in the
          distribution.

Not to mention that we were missing a few files in the clean target.
Namely, the .d files in the top build directory and hurd/doc, and
stamp-version in hurd/doc.

In order to do this, I had to revise the distclean target a bit: I
made it similar to the clean target and added a distclean target to
Makeconf.  Now, rather then distclean just wrapping the clean target
in the top directory, distclean depends on clean-misc (where all of
the clean work -- not dir-clean dependencies -- resides) and acts
similarly to the clean target, i.e. calling `make -C dir distclean
no_deps=t'.

In order to allow subdirectories to supplement the clean and distclean
targets, I added the clean-other and distclean-other targets.  These
act in much the same way as $(OTHERTAGS) et al.

This patch also fixes a small bug in the objs and relink targets: they
were using $(prog-subdirs), not $(working-prog-subdirs) as I would
expect.


2001-11-15  Neal H Walfield  <neal@cs.uml.edu>

        * Makefile (distclean): Be similar to the clean target.
        Remove TAGS.  Depend on clean-misc.
        (%-distclean): New pattern.  Similar to the %-clean pattern.
        (clean-misc): Delete the dependency and the TAGS files.
        * Makeconf (.PHONY): Add distclean target.
        (distclean): New target.
        (clean): Depend on the user definable target, clean-other.
        (clean-other): New, empty target.
        (distclean-other): Likewise.

        * Makefile (relink): Use $(working-prog-subdirs), not
        $(prog-subdirs).
        (objs): Likewise.


Index: Makeconf
===================================================================
RCS file: /cvsroot/hurd/hurd/Makeconf,v
retrieving revision 1.194
diff -u -r1.194 Makeconf
--- Makeconf    2001/11/14 23:58:22     1.194
+++ Makeconf    2001/11/15 21:22:12
@@ -198,7 +198,7 @@
 
 # Standard targets
 
-.PHONY: all install libs relink clean objs
+.PHONY: all install libs relink distclean clean objs
 
 # Just build all the object files.
 objs: $(OBJS)
@@ -400,11 +411,17 @@
              $(cleantarg)
 relink:
        rm -f $(linktarg)
+distclean: clean distclean-other
+       rm -f TAGS
 endif
 
-clean:
-relink:
+clean: clean-other
+clean-other:
+
+distclean:
+distclean-other:
 
+relink:
 
 
 # Subdependencies
Index: Makefile
===================================================================
RCS file: /cvsroot/hurd/hurd/Makefile,v
retrieving revision 1.119
diff -u -r1.119 Makefile
--- Makefile    2001/02/11 00:23:04     1.119
+++ Makefile    2001/11/15 21:27:18
@@ -81,12 +81,20 @@
        cd $(srcdir); tar cfz $(dirname)-$(version).tar.gz $(dirname)-$(version)
        rm -rf $(srcdir)/$(dirname)-$(version)
 
+# This rule should consist only of dependencies; any actual work should be
+# done by clean-misc (which distclean also depends on)
 clean: $(addsuffix -clean,$(lib-subdirs)) $(addsuffix 
-clean,$(working-prog-subdirs)) clean-misc
 
-relink: $(addsuffix -relink,$(lib-subdirs) $(prog-subdirs))
+distclean: $(addsuffix -distclean,$(lib-subdirs)) $(addsuffix 
-distclean,$(working-prog-subdirs)) clean-misc
+       rm -f config.make config.log config.status config.cache TAGS
+ifneq (.,${srcdir})
+       rm -f Makefile
+endif
 
-objs: $(addsuffix -objs,$(lib-subdirs) $(prog-subdirs))
+relink: $(addsuffix -relink,$(lib-subdirs) $(working-prog-subdirs))
 
+objs: $(addsuffix -objs,$(lib-subdirs) $(working-prog-subdirs))
+
 install: $(addsuffix -install,$(lib-subdirs) $(working-prog-subdirs) \
           $(other-subdirs))
 
@@ -108,6 +116,9 @@
 %-clean:
        $(MAKE) -C $* clean no_deps=t
 
+%-distclean:
+       $(MAKE) -C $* distclean no_deps=t
+
 %-relink:
        $(MAKE) -C $* relink no_deps=t
 
@@ -134,14 +145,9 @@
 $(lf-inst): $(srcdir)/hurd-snap/%: $(srcdir)/%
        cp $< $@
 
-.PHONY: clean-misc distclean
+.PHONY: clean-misc
 clean-misc:
-
-distclean: clean
-       rm -f config.make config.log config.status config.cache
-ifneq (.,${srcdir})
-       rm -f Makefile
-endif
+       rm -f *.d
 
 
 ## Directory dependencies


2001-11-15  Neal H Walfield  <neal@cs.uml.edu>

        * Makefile (clean-other): New target, remove the dependency
        files and stamp-version.


Index: doc/Makefile
===================================================================
RCS file: /cvsroot/hurd/hurd/doc/Makefile,v
retrieving revision 1.8
diff -u -r1.8 Makefile
--- doc/Makefile        1999/09/19 03:25:21     1.8
+++ doc/Makefile        2001/11/15 21:27:24
@@ -27,6 +27,9 @@
 
 include ../Makeconf
 
+clean-other:
+       rm -f *.d stamp-version
+
 # For each .info file we need a .d file.
 -include $(patsubst %.info,%.d,$(filter %.info,$(targets))) /dev/null





reply via email to

[Prev in Thread] Current Thread [Next in Thread]