1# Special Makefile for `recode' tables.			-*- Makefile -*-
2# Copyright � 1997, 1998, 1999, 2000 Progiciels Bourbeau-Pinard inc.
3# Fran�ois Pinard <pinard@iro.umontreal.ca>, 1997.
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 2, 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, write to the Free Software
17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18# 02111-1307, USA.
19
20include Makefile
21
22## Some files in the `recode' distribution are mechanically derived
23## from data files while is available from the net using FTP or HTTP.
24## These original files are not distributed.  From the *distribution*
25## standpoint, one might consider those derived files just as sources,
26## forgetting there is some hidden magic behind them.  But the magic
27## is revealed here! :-).  The distribution already contains all
28## non-trivial derivation tools I made.  For completeness, this
29## special Makefile holds the accompanying derivation recipes.
30
31## For activating the included recipes, it suffices to link this
32## `Makemore' file as `GNUmakefile' in the `doc/' directory of your
33## *build* hierarchy.  You need GNU make, GNU wget, Python and Internet
34## connectivity for all this to work.  However, be warned that if
35## external files changed, you may be hit.  I am interested in hearing
36## about such problems (maybe at `recode-bugs@iro.umontreal.ca'), but
37## I do not want to commit myself at maintaining the derivation stuff
38## at the same level as for the the remainder of `recode'.
39
40CHSET = chset32a
41LIBICONV =
42MAPURL = ftp://ftp.unicode.org/MAPPINGS
43
44MNEMONICS_DS = mnemonic,ds
45ISO10646_DEF = $(CHSET)/iso10646.def
46CHARSETS_DEF = $(CHSET)/charsets.def
47ENCODINGS_DEF = ../libiconv/encodings.def ../libiconv/encodings_local.def
48MNEMONICS_DS = keld-email/iso10646.def
49ISO10646_DEF = keld-email/iso10646.def
50CHARSETS_DEF = keld-email/charsets.def
51MNEMONICS_DS = keld-email/iso10646.def keld-email/other.def keld-email/control.def
52NOMS_CARACS = noms_juc_19981216.txt
53NOMS_CARACS = NomsSeulsfinal.lst
54
55PYTHON = python
56SURF = netscape
57WGET = wget
58
59# Merely add our things to standard `all' goal.
60all: $(srcdir)/libiconv.texi $(srcdir)/rfc1345.texi \
61$(srcdir)/fr-libiconv.texi $(srcdir)/fr-rfc1345.texi \
62$(top_srcdir)/src/libiconv.h $(top_srcdir)/src/rfc1345.h \
63$(top_srcdir)/src/charname.h $(top_srcdir)/src/fr-charname.h
64
65doc-check: all
66	-cd $(top_srcdir)/src && diff -u charname.h{-,}
67	-cd $(top_srcdir)/src && diff -u fr-charname.h{-,}
68	-cd $(top_srcdir)/src && diff -u rfc1345.h{-,}
69	-cd $(top_srcdir)/src && diff -u strip-data.c{-,}
70	-cd $(top_srcdir)/src && diff -u strip-pool.c{-,}
71	-cd $(srcdir) && diff -u libiconv.texi{-,}
72	-cd $(srcdir) && diff -u fr-libiconv.texi{-,}
73	-cd $(srcdir) && diff -u rfc1345.texi{-,}
74	-cd $(srcdir) && diff -u fr-rfc1345.texi{-,}
75
76# The next rules, when written, for example:
77#rfc1345.texi pool.c tables.c: ...
78# may launch many parallel occurrences of the action.  This is bad.
79# Any idea, someone?  For now, just list one of them.
80
81$(top_srcdir)/src/charname.h: tables.py $(MNEMONICS_DS) rfc1345.txt
82	cd $(srcdir) && $(PYTHON) tables.py -n $(MNEMONICS_DS) rfc1345.txt
83	mv $(srcdir)/charname.h $@
84
85$(top_srcdir)/src/fr-charname.h: tables.py $(NOMS_CARACS)
86	cd $(srcdir) && $(PYTHON) tables.py -Fn $(NOMS_CARACS)
87	mv $(srcdir)/fr-charname.h $@
88
89$(top_srcdir)/src/libiconv.h: tables.py $(ENCODINGS_DEF)
90	cd $(srcdir) && $(PYTHON) tables.py -l $(ENCODINGS_DEF)
91	mv $(srcdir)/libiconv.h $@
92
93$(top_srcdir)/src/rfc1345.h: tables.py $(MNEMONICS_DS)
94	cd $(srcdir) && $(PYTHON) tables.py -m $(MNEMONICS_DS)
95	mv $(srcdir)/rfc1345.h $@
96
97$(srcdir)/libiconv.texi: tables.py $(ENCODINGS_DEF)
98	cd $(srcdir) && $(PYTHON) tables.py -s $(ENCODINGS_DEF)
99
100$(srcdir)/fr-libiconv.texi: tables.py $(ENCODINGS_DEF)
101	cd $(srcdir) && $(PYTHON) tables.py -Fs $(ENCODINGS_DEF)
102
103$(srcdir)/rfc1345.texi: tables.py $(MNEMONICS_DS) $(CHARSETS_DEF)
104	cd $(srcdir) && $(PYTHON) tables.py -pt $(MNEMONICS_DS) $(CHARSETS_DEF)
105	mv $(srcdir)/strip-pool.c $(top_srcdir)/src/strip-pool.c
106	mv $(srcdir)/strip-data.c $(top_srcdir)/src/strip-data.c
107
108$(srcdir)/fr-rfc1345.texi: tables.py $(MNEMONICS_DS) $(CHARSETS_DEF)
109	cd $(srcdir) && $(PYTHON) tables.py -Ft $(MNEMONICS_DS) $(CHARSETS_DEF)
110
111# -----------------------------------#
112# External files built into recode.  #
113# -----------------------------------#
114
115$(srcdir)/$(CHARSET_DEFS): $(srcdir)/$(CHSET)
116
117$(srcdir)/$(CHSET):
118	mkdir $@-tmp
119	$(WGET) ftp://dkuug.dk/pub/$(CHSET).tar
120	tar xfC $(CHSET).tar $@-tmp
121	rm $(CHSET).tar
122	mv $@-tmp $@
123
124# Also look in `ftp://dkuug.dk/i18n/WG15-collection/charmaps/iso10646'.
125$(srcdir)/mnemonic,ds:
126	$(WGET) ftp://dkuug.dk/i18n/WG15-collection/repertoiremaps/mnemonic,ds
127	test $(srcdir) = . || mv mnemonic,ds $@
128
129$(srcdir)/rfc1345.txt:
130	$(WGET) ftp://nic.ddn.mil/rfc/rfc1345.txt
131	test $(srcdir) = . || mv rfc1345.txt $@
132
133# -------------------------------------------------#
134# Useful external files, but unbuilt into recode.  #
135# -------------------------------------------------#
136
137$(srcdir)/cp1250.txt:
138	$(WGET) $(MAPURL)/VENDORS/MICSFT/WINDOWS/CP1250.TXT
139	mv CP1250.TXT $@
140
141$(srcdir)/cp1251.txt:
142	$(WGET) $(MAPURL)/VENDORS/MICSFT/WINDOWS/CP1251.TXT
143	mv CP1251.TXT $@
144
145$(srcdir)/cp1252.txt:
146	$(WGET) $(MAPURL)/VENDORS/MICSFT/WINDOWS/CP1252.TXT
147	mv CP1252.TXT $@
148
149# Index at `http://www.dkuug.dk/jtc1/sc22/wg20/docs/projects.html.en'.
150i18n.txt:
151	$(WGET) http://www.dkuug.dk/jtc1/sc22/wg20/docs/i18n.txt
152i18nrep.txt:
153	$(WGET) http://www.dkuug.dk/jtc1/sc22/wg20/docs/i18nrep.txt
154
155# Various files.
156iso2375reg.txt:
157	$(WGET) ftp://dkuug.dk/i18n/iso2375reg.txt
158
159# Online documentation.
160# Index at `http://osiris.dkuug.dk/jtc1/sc2/wg3'.
161character-sets:
162	$(SURF) http://www.ewos.be/tg-cs/gtop.htm
163