+# distclean also removes the copied source and headers
+distclean: clean
+ $(RM) -r scripts # historical reasons
+ $(RM) $(PNGSRCS) $(PNGH)
+ $(RM) $(ZSRCS) $(ZH) $(ZCONF)
+ $(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
+
+# Header file dependencies:
+$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
+$(PNGOBJS): $(PNGHDRS) $(ZINC)
+$(ZOBJS): $(ZHDRS)
+
+# Gather the source code from the respective directories
+$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
+ $(RM) $@
+ $(COPY) $(PNGSRC)/$@ $@
+
+# No dependency on the ZLIBSRC target so that it only needs
+# to be specified once.
+$(ZSRCS) $(ZH):
+ $(RM) $@
+ $(COPY) $(ZLIBSRC)/$@ $@
+
+# The unconfigured zconf.h varies in name according to the
+# zlib release
+$(ZCONF):
+ $(RM) $@
+ @for f in zconf.h.in zconf.in.h zconf.h; do\
+ test -r $(ZLIBSRC)/$$f &&\
+ echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
+ $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
+ done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
+
+$(PROGSRCS) $(PROGHDRS) $(PROGDOCS): $(PROGSRC)/$@
+ $(RM) $@
+ $(COPY) $(PROGSRC)/$@ $@
+