1MAKE   = @MAKE@
2RM     = @RM@
3SHELL  = @SHELL@
4srcdir = @srcdir@
5
6# needed here to properly support distclean
7libbuild_dir=@libbuild_dir@
8binbuild_dir=@binbuild_dir@
9docbuild_dir=@docbuild_dir@
10etcbuild_dir=@etcbuild_dir@
11sharebuild_dir=@sharebuild_dir@
12sbinbuild_dir=@sbinbuild_dir@
13
14# The empty string, "", in PKGS is needed to avoid /bin/sh from complaining
15# when @PKGS@ is/are really empty.
16PKGS   = "" @subdirs@
17
18all:
19	@-for pkg in $(PKGS) ; do \
20	      if [ -n "$$pkg" -a -s $$pkg/Makefile ] ; then \
21	          echo "Making $$pkg" ; \
22	          ( cd $$pkg && $(MAKE) $(MAKEOPTS) ) ; \
23	      fi ; \
24	  done
25
26install:
27	@if [ -n "$(PREFIX)" ] ; then \
28	     ./sbin/install-package -prefix=$(PREFIX) ; \
29	 else \
30	     ./sbin/install-package ; \
31	 fi
32
33uninstall:
34	@-./sbin/uninstall-package
35
36clean:
37	@-for pkg in $(PKGS) ; do \
38	      if [ -n "$$pkg" -a -s $$pkg/Makefile ] ; then \
39	          ( cd $$pkg && $(MAKE) $(MAKEOPTS) clean ) ; \
40	      fi ; \
41	  done
42
43rmprog:
44	@-for file in bin/* sbin/* ; do \
45	      case "$$file" in \
46	          *.in) ;; \
47	          *) $(RM) $$file ;; \
48	      esac ; \
49	  done
50
51# We only want to try to cleanup the FOObuild_dir directories when we are doing
52# a VPATH build.  We chmod because the files are all copied to the build dir
53# preserving permissions, so the rm will fail when running "make distcheck"
54# because the distcheck process makes the temporary source tree read-only.
55#
56# In the long run it would be nice to avoid these FOObuild_dir copies.
57distclean-misc:
58	@-$(RM) sbin/install-package
59	@-$(RM) Makefile
60	@-$(RM) simple.class simple.jar simple_swing.class simple_swing.jar
61	@-$(RM) config.log config.status
62	@-$(RM) -r autom4te*.cache
63	@-if test '$(srcdir)' != . ; then \
64	    chmod -R u+w $(libbuild_dir) $(docbuild_dir) \
65	        $(etcbuild_dir) $(sharebuild_dir) $(sbinbuild_dir) ; \
66	    $(RM) -r -f $(libbuild_dir) $(docbuild_dir) \
67	        $(etcbuild_dir) $(sharebuild_dir) $(sbinbuild_dir) ; \
68	fi
69
70distclean: rmprog distclean-misc
71	@-for pkg in $(PKGS) ; do \
72	      if [ -n "$$pkg" -a -s $$pkg/Makefile ] ; then \
73	          echo "making distclean in $$pkg" ; \
74	          ( cd $$pkg && $(MAKE) $(MAKEOPTS) distclean ) ; \
75	      fi ; \
76	  done
77
78maintainer-clean: rmprog distclean-misc
79	@-for pkg in $(PKGS) ; do \
80	      if [ -n "$$pkg" -a -s $$pkg/Makefile ] ; then \
81	          ( cd $$pkg && $(MAKE) $(MAKEOPTS) maintainer-clean ) ; \
82	      fi ; \
83	  done
84
85owner-clean: rmprog distclean-misc
86	@-for pkg in $(PKGS) ; do \
87	      if [ -n "$$pkg" -a -s $$pkg/Makefile ] ; then \
88	          ( cd $$pkg && $(MAKE) $(MAKEOPTS) owner-clean ) ; \
89	      fi ; \
90	  done
91	@-$(RM) configure
92