Merge branch 'master' of git://ctrl.tukaani.org/xz
[xz/debian.git] / debian / clean.sh
blobd2056313f6bcdd44394c03111117f3dd4d4f0f59
1 #!/bin/sh
2 # Remove files generated by autoreconf -fi.
3 # For use by the clean target in debian/rules.
5 set -e
7 remove_files='#!/usr/bin/perl
8 # Remove specified files from the current directory.
9 # Each line must be a filename, a comment (starting with #),
10 # a simple glob (of the form *.extension), or blank.
11 # Filenames are restricted to a small character set.
13 use strict;
14 use warnings;
16 my $fnchar = qr/[-_~.@[:alnum:]]/;
18 my $empty = qr/^$/;
19 my $comment = qr/^#/;
20 my $simple = qr/^$fnchar+$/;
21 my $glob = qr/^\*$fnchar+$/;
22 while (my $line = <>) {
23 chomp $line;
24 next if $line =~ $empty;
25 next if $line =~ $comment;
27 if ($line =~ $simple) {
28 unlink $line;
29 next;
31 if ($line =~ $glob) {
32 unlink glob($line);
33 next;
36 die "cannot parse $line";
40 dh_testdir
41 rm -fr build-aux
42 rm -f ABOUT-NLS aclocal.m4 config.h.in configure
43 (cd po && perl -e "$remove_files") < debian/generated-po.list
44 (cd m4 && perl -e "$remove_files") < debian/generated-m4.list
45 find . -name Makefile.in -delete