| 1 | #! /bin/sh |
| 2 | |
| 3 | # Copyright (C) 2009, 2010 Christian Egli |
| 4 | # Copyright (C) 2016 Bert Frees |
| 5 | |
| 6 | # Copying and distribution of this file, with or without modification, |
| 7 | # are permitted in any medium without royalty provided the copyright |
| 8 | # notice and this notice are preserved. This file is offered as-is, |
| 9 | # without any warranty. |
| 10 | |
| 11 | # Use this script to regenerate Makefile.am if you must. I recommend |
| 12 | # against it for the reasons explained in |
| 13 | # http://www.gnu.org/software/hello/manual/automake/Wildcards.html. |
| 14 | # It's easy to pick up some spurious files that you did not mean to |
| 15 | # distribute. |
| 16 | |
| 17 | OUTFILE=Makefile.am.new |
| 18 | COMMAND="ls | grep -v Makefile | grep -v README | grep -v maketablelist.sh | grep -v '.*~$' | grep -v '.in$' | sort -df | sed -e 's/$/ \\\\/' -e 's/^/ /' -e '\$s/\\\\$//'" |
| 19 | |
| 20 | cat <<EOF >$OUTFILE |
| 21 | # generate the list of tables as follows: |
| 22 | # $ ${COMMAND} |
| 23 | table_files = \\ |
| 24 | EOF |
| 25 | |
| 26 | eval "$COMMAND" >> $OUTFILE |
| 27 | |
| 28 | cat <<'EOF' >>$OUTFILE |
| 29 | |
| 30 | comma=, |
| 31 | fuzzing_yml = $(top_srcdir)/.github/workflows/fuzzing.yml |
| 32 | $(fuzzing_yml): $(srcdir)/Makefile.am |
| 33 | [ ! -w $(fuzzing_yml) ] || \ |
| 34 | perl -0777 -i -pe \ |
| 35 | 's~(table:).*?(steps:)~\1'"$$(printf '\n - %s' $(filter %.utb %.ctb,$(table_files)))"'\n \2~is' \ |
| 36 | $@ |
| 37 | |
| 38 | all-local: $(fuzzing_yml) |
| 39 | |
| 40 | # tables that use macros need to be expanded |
| 41 | BUILT_SOURCES = nl-chardefs.uti nl-NL-g0.utb |
| 42 | CLEANFILES = nl-chardefs.uti nl-NL-g0.utb |
| 43 | nl-chardefs.uti nl-NL-g0.utb: % : %.in Makefile |
| 44 | m4 -G $< > $@ |
| 45 | |
| 46 | tablesdir = $(datadir)/liblouis/tables |
| 47 | tables_DATA = $(table_files) |
| 48 | EXTRA_DIST = $(table_files) \ |
| 49 | nl-chardefs.uti.in \ |
| 50 | nl-NL-g0.utb.in |
| 51 | EOF |
| 52 |