PATCH: libiberty Makefile

Nathan Sidwell nathan@acm.org
Fri Oct 22 04:25:00 GMT 1999


Hi,
the attached patch to libiberty's Makefile.in allows one to
`make maintainer-clean'. Currently the Makefile contains stuff like

distclean: clean distclean-subdir
	...whatever
maintainer-clean: distclean maintainer-clean-subdir
	...whatever

this means the subdir's distclean rule is run before the subdir's
maintainer-clean rule. Unfortunately distclean removes the subdir's
Makefile. Thus a make maintainer-clean at the toplevel dies.

This patch adds a SUBDIR make var which contains the subdirs to
recurse into, and then explicitly dinks it to "" before
recursively making clean. The subdir's makefile chains
maintainer-clean to distclean etc, as one would expect. With this
patch, a toplevel maintainer-clean completes.

IYR, I installed the following for the same problem in gcc's Makefile
Wed Sep 22 16:12:40 BST 1999  Nathan Sidwell  <nathan@acm.org>

ok?

nathan
-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
        I have seen the death of PhotoShop -- it is called GIMP
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk
1999-10-22  Nathan Sidwell  <nathan@acm.org>

	* Makefile.in (SUBDIRS): New macro
	(mostlyclean, clean, distclean, maintainer-clean): Adjust.
	(*-subdir): Adjust.

Index: libiberty/Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/libiberty/Makefile.in,v
retrieving revision 1.31
diff -c -3 -p -r1.31 Makefile.in
*** Makefile.in	1999/10/15 07:50:25	1.31
--- Makefile.in	1999/10/22 09:45:45
*************** FLAGS_TO_PASS = \
*** 92,97 ****
--- 92,100 ----
  	"libsubdir=$(libsubdir)" \
  	"tooldir=$(tooldir)"
  
+ # subdirectories to recurse into
+ SUBDIRS = testsuite
+ 
  all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir
  	@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
  
*************** mostlyclean: mostlyclean-subdir
*** 209,222 ****
  	rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
  	rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
  	@$(MULTICLEAN) multi-clean DO=mostlyclean
! clean: mostlyclean clean-subdir
  	rm -f *.a required-list tmpmulti.out
  	@$(MULTICLEAN) multi-clean DO=clean
! distclean: clean distclean-subdir
  	@$(MULTICLEAN) multi-clean DO=distclean
  	rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out
  	rm -f config.log
! maintainer-clean realclean: distclean maintainer-clean-subdir
  
  force:
  
--- 212,228 ----
  	rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
  	rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
  	@$(MULTICLEAN) multi-clean DO=mostlyclean
! clean: clean-subdir
! 	$(MAKE) SUBDIRS="" mostlyclean
  	rm -f *.a required-list tmpmulti.out
  	@$(MULTICLEAN) multi-clean DO=clean
! distclean: distclean-subdir
! 	$(MAKE) SUBDIRS="" clean
  	@$(MULTICLEAN) multi-clean DO=distclean
  	rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out
  	rm -f config.log
! maintainer-clean realclean: maintainer-clean-subdir
! 	$(MAKE) SUBDIRS="" distclean
  
  force:
  
*************** install-info-subdir clean-info-subdir dv
*** 236,242 ****
  etags-subdir mostlyclean-subdir clean-subdir distclean-subdir \
  maintainer-clean-subdir:
  	@target=`echo $@ | sed -e 's/-subdir//'`; \
! 	cd testsuite && $(MAKE) $$target
  
  $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA): stamp-picdir
  
--- 242,250 ----
  etags-subdir mostlyclean-subdir clean-subdir distclean-subdir \
  maintainer-clean-subdir:
  	@target=`echo $@ | sed -e 's/-subdir//'`; \
! 	for dir in . $(SUBDIRS) ; do \
! 	  test $$dir = . || (cd $$dir && $(MAKE) $$target) || exit 1; \
! 	done
  
  $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA): stamp-picdir
  


More information about the Gcc-patches mailing list