| 1 |
# Makefile for Recode sources. |
| 2 |
# Copyright © 1991-2023 Free Software Foundation, Inc. |
| 3 |
# François Pinard <[email protected]>, 1988. |
| 4 |
|
| 5 |
# This program is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 3, or (at your option) |
| 8 |
# any later version. |
| 9 |
|
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
|
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
AUTOMAKE_OPTIONS = gnits |
| 19 |
bin_PROGRAMS = recode |
| 20 |
lib_LTLIBRARIES = librecode.la |
| 21 |
noinst_LTLIBRARIES = libmerged.la |
| 22 |
dist_man_MANS = recode.1 |
| 23 |
include_HEADERS = recode.h recodext.h |
| 24 |
|
| 25 |
H_STEPS = common.h decsteps.h inisteps.h tersteps.h \ |
| 26 |
$(H_SURFACES) |
| 27 |
|
| 28 |
noinst_HEADERS = $(H_STEPS) cleaner.h charname.h fr-charname.h iconvdecl.h \ |
| 29 |
rfc1345.h lat1iso5426.h lat1ansel.h |
| 30 |
|
| 31 |
EXTRA_DIST = stamp-steps stamp-strip $(L_STEPS) mergelex.py $(MANS) lat1ansel.h lat1iso5426.h |
| 32 |
|
| 33 |
CLEANFILES = iconvdecl.h |
| 34 |
|
| 35 |
C_STEPS = african.c afrtran.c atarist.c bangbang.c cdcnos.c \ |
| 36 |
ebcdic.c ibmpc.c iconqnx.c lat1asci.c lat1iso5426.c lat1ansel.c \ |
| 37 |
java.c mule.c strip-data.c testdump.c ucs.c utf16.c utf7.c utf8.c varia.c vn.c |
| 38 |
|
| 39 |
ALL_STEPS = $(C_STEPS) $(C_FALLBACKS) $(C_SURFACES) |
| 40 |
|
| 41 |
L_STEPS = ascilat1.l iso5426lat1.l ansellat1.l $(L_FALLBACKS) |
| 42 |
|
| 43 |
C_FALLBACKS = flat.c html.c lat1ltex.c lat1btex.c lat1txte.c rfc1345.c texinfo.c |
| 44 |
L_FALLBACKS = ltexlat1.l btexlat1.l txtelat1.l |
| 45 |
|
| 46 |
H_SURFACES = base64.h |
| 47 |
C_SURFACES = base64.c dump.c endline.c permut.c quoted.c |
| 48 |
|
| 49 |
recode_SOURCES = main.c mixed.c common.h |
| 50 |
recode_LDADD = librecode.la |
| 51 |
|
| 52 |
librecode_la_SOURCES = charname.c combine.c fr-charname.c iconv.c \ |
| 53 |
names.c outer.c recode.c request.c strip-pool.c task.c $(ALL_STEPS) \ |
| 54 |
$(include_HEADERS) $(noinst_HEADERS) $(H_STEPS) |
| 55 |
librecode_la_LDFLAGS = -no-undefined -version-info $(VERSION_INFO) $(LTLIBICONV) $(LTLIBINTL) \ |
| 56 |
$(LIB_CLOCK_GETTIME) $(LIB_GETRANDOM) $(LIB_HARD_LOCALE) $(LIB_MBRTOWC) $(LIB_SETLOCALE_NULL) |
| 57 |
librecode_la_LIBADD = ../lib/libgnu.la libmerged.la |
| 58 |
|
| 59 |
libmerged_la_SOURCES = merged.c |
| 60 |
libmerged_la_CPPFLAGS = $(NON_WARN_CFLAGS) |
| 61 |
|
| 62 |
loc: |
| 63 |
cloc \ |
| 64 |
charname.c combine.c fr-charname.c iconv.c \ |
| 65 |
names.c outer.c recode.c request.c task.c \ |
| 66 |
$(ALL_STEPS) $(L_STEPS) common.h $(H_SURFACES) \ |
| 67 |
$(top_srcdir)/tables.py mergelex.py $(top_srcdir)/tests/Recode.pyx \ |
| 68 |
Makefile.am $(top_srcdir)/configure.ac $(top_srcdir)/Makefile.am \ |
| 69 |
$(top_srcdir)/doc/Makefile.am $(top_srcdir)/tests/Makefile.am $(top_srcdir)/bootstrap.conf |
| 70 |
|
| 71 |
# Relative to $(srcdir). |
| 72 |
ALAIN = $(KELD) |
| 73 |
KELD = ../keld |
| 74 |
CHARSETS_DEF = $(KELD)/charsets.def |
| 75 |
MNEMONICS_DS = $(KELD)/iso10646.def $(KELD)/other.def $(KELD)/control.def |
| 76 |
RFC1345_TXT = $(KELD)/rfc1345.txt |
| 77 |
NOMS_CARACS = $(ALAIN)/NomsSeulsfinal.lst |
| 78 |
|
| 79 |
NON_WARN_CFLAGS = -I.. -I$(srcdir) $(ISYSTEM)$(top_builddir)/lib $(ISYSTEM)$(top_srcdir)/lib |
| 80 |
AM_CPPFLAGS = $(NON_WARN_CFLAGS) $(WARN_CFLAGS) |
| 81 |
DEFS = -DLIBDIR=\"$(libdir)\" @DEFS@ |
| 82 |
|
| 83 |
ETAGS_ARGS = $(L_STEPS) |
| 84 |
TAGS_DEPENDENCIES = $(L_STEPS) |
| 85 |
|
| 86 |
LEX = @LEX@ |
| 87 |
PYTHON = @PYTHON@ |
| 88 |
TABLES_PY = $(PYTHON) $(top_srcdir)/tables.py |
| 89 |
|
| 90 |
merged.c: mergelex.py $(L_STEPS) |
| 91 |
echo '#include "config.h"' > merged.c |
| 92 |
(cd $(srcdir) && cat $(L_STEPS)) \ |
| 93 |
| $(PYTHON) $(srcdir)/mergelex.py > merged.tm1 |
| 94 |
$(LEX) -t -8 -Plibrecode_yy merged.tm1 > merged.tm2 |
| 95 |
grep -av '^# *line [0-9]' merged.tm2 >> merged.c |
| 96 |
rm merged.tm1 merged.tm2 |
| 97 |
|
| 98 |
recode.1: main.c $(top_srcdir)/configure.ac recode$(EXEEXT) |
| 99 |
## Exit gracefully if recode.1 is not writeable, such as during distcheck! |
| 100 |
$(AM_V_GEN)if ( touch [email protected] && rm -f [email protected]; ) >/dev/null 2>&1; then \ |
| 101 |
$(top_builddir)/build-aux/x-to-1 \ |
| 102 |
$(PERL) $(HELP2MAN) \ |
| 103 |
--locale=en_US.UTF-8 \ |
| 104 |
./recode$(EXEEXT) recode.x $@; \ |
| 105 |
fi |
| 106 |
|
| 107 |
main.o: main.c ../config.status |
| 108 |
|
| 109 |
charname.lo: charname.h |
| 110 |
charname.h: ../tables.py $(MNEMONICS_DS) $(RFC1345_TXT) |
| 111 |
$(TABLES_PY) -C $(srcdir) -n $(MNEMONICS_DS) $(RFC1345_TXT) |
| 112 |
|
| 113 |
fr-charname.lo: fr-charname.h |
| 114 |
fr-charname.h: ../tables.py $(NOMS_CARACS) |
| 115 |
$(TABLES_PY) -C $(srcdir) -Fn $(NOMS_CARACS) |
| 116 |
|
| 117 |
iconv.lo: iconvdecl.h |
| 118 |
iconvdecl.h: ../tables.py |
| 119 |
$(TABLES_PY) -i |
| 120 |
|
| 121 |
lat1ansel.lo: lat1ansel.h |
| 122 |
lat1ansel.h: ansellat1.l |
| 123 |
$(top_srcdir)/build-aux/invert-l-to-h ansellat1.l > $@ |
| 124 |
|
| 125 |
lat1iso5426.lo: lat1iso5426.h |
| 126 |
lat1iso5426.h: iso5426lat1.l |
| 127 |
$(top_srcdir)/build-aux/invert-l-to-h iso5426lat1.l > $@ |
| 128 |
|
| 129 |
african.lo afrtran.lo atarist.lo bangbang.lo cdcnos.lo \ |
| 130 |
ebcdic.lo ibmpc.lo iconqnx.lo lat1asci.lo lat1iso5426.lo lat1ansel.lo \ |
| 131 |
java.lo mule.lo strip-data.lo testdump.lo ucs.lo utf16.lo utf7.lo utf8.lo \ |
| 132 |
varia.lo vn.lo flat.lo html.lo lat1ltex.lo lat1btex.lo lat1txte.lo rfc1345.lo \ |
| 133 |
texinfo.lo base64.lo dump.lo endline.lo permut.lo quoted.lo \ |
| 134 |
iconv.lo outer.lo: decsteps.h inisteps.h tersteps.h |
| 135 |
|
| 136 |
decsteps.h inisteps.h tersteps.h: stamp-steps |
| 137 |
stamp-steps: $(ALL_STEPS) merged.c |
| 138 |
@echo "Updating {dec,ini,ter}steps.h" |
| 139 |
@(cd $(srcdir) && grep -h '^module_' $(ALL_STEPS) merged.c) \ |
| 140 |
| sed 's/ .*//' > liste.tmp |
| 141 |
@sed 's/\(.*\)/bool \1 (struct recode_outer *);/' \ |
| 142 |
liste.tmp > decsteps.tmp |
| 143 |
@sed 's/\(.*\)/void del\1 (struct recode_outer *);/' \ |
| 144 |
liste.tmp >> decsteps.tmp |
| 145 |
@sed 's/\(.*\)/ if (!\1 (outer)) return false;/' \ |
| 146 |
liste.tmp > inisteps.tmp |
| 147 |
@sed 's/\(.*\)/ del\1 (outer);/' \ |
| 148 |
liste.tmp > tersteps.tmp |
| 149 |
@rm liste.tmp |
| 150 |
@if cmp -s $(srcdir)/decsteps.h decsteps.tmp; then rm decsteps.tmp; \ |
| 151 |
else mv decsteps.tmp $(srcdir)/decsteps.h; fi |
| 152 |
@if cmp -s $(srcdir)/inisteps.h inisteps.tmp; then rm inisteps.tmp; \ |
| 153 |
else mv inisteps.tmp $(srcdir)/inisteps.h; fi |
| 154 |
@if cmp -s $(srcdir)/tersteps.h tersteps.tmp; then rm tersteps.tmp; \ |
| 155 |
else mv tersteps.tmp $(srcdir)/tersteps.h; fi |
| 156 |
@echo timestamp > $(srcdir)/$@ |
| 157 |
|
| 158 |
rfc1345.lo: rfc1345.h |
| 159 |
rfc1345.h: ../tables.py $(MNEMONICS_DS) |
| 160 |
$(TABLES_PY) -C $(srcdir) -m $(MNEMONICS_DS) |
| 161 |
|
| 162 |
# There is duplication of work with making doc/rfc1345.texi. |
| 163 |
# This used to be combined, but it seems clearer to keep both separate. |
| 164 |
strip-pool.c strip-data.c: stamp-strip |
| 165 |
stamp-strip: ../tables.py $(MNEMONICS_DS) $(CHARSETS_DEF) |
| 166 |
$(TABLES_PY) -C $(srcdir) -p $(MNEMONICS_DS) $(CHARSETS_DEF) |
| 167 |
@echo timestamp > $(srcdir)/$@ |