xref: /illumos-gate/usr/src/lib/iconv_modules/euro/utils/gentbl/Makefile (revision 66582b606a8194f7f3ba5b3a3a6dca5b0d346361)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23#
24
25# Toolset to unify the code conversion tables.
26# Created for one-time use.
27
28include $(SRC)/Makefile.master
29
30INTEGRATED = \
31	646%8859.c \
32	646da%8859.c \
33	646de%8859.c \
34	646en%8859.c \
35	646es%8859.c \
36	646fr%8859.c \
37	646it%8859.c \
38	646sv%8859.c \
39	8859%646.c \
40	8859%646da.c \
41	8859%646de.c \
42	8859%646en.c \
43	8859%646es.c \
44	8859%646fr.c \
45	8859%646it.c \
46	8859%646sv.c \
47	8859-1%IBM-037.c \
48	8859-1%IBM-500.c \
49	8859-1%IBM-850.c \
50	IBM-037%8859-1.c \
51	IBM-500%8859-1.c \
52	IBM-850%8859-1.c \
53	alt%iso5.c \
54	alt%koi8.c \
55	alt%mac.c \
56	alt%win5.c \
57	dhn%dos2.c \
58	dhn%iso2.c \
59	dhn%maz.c \
60	dhn%win2.c \
61	dos2%dhn.c \
62	dos2%iso2.c \
63	dos2%maz.c \
64	dos2%win2.c \
65	iso2%dhn.c \
66	iso2%dos2.c \
67	iso2%maz.c \
68	iso2%win2.c \
69	iso5%alt.c \
70	iso5%koi8.c \
71	iso5%mac.c \
72	iso5%win5.c \
73	koi8%alt.c \
74	koi8%iso5.c \
75	koi8%mac.c \
76	koi8%win5.c \
77	mac%alt.c \
78	mac%iso5.c \
79	mac%koi8.c \
80	mac%win5.c \
81	maz%dhn.c \
82	maz%dos2.c \
83	maz%iso2.c \
84	maz%win2.c \
85	win2%dhn.c \
86	win2%dos2.c \
87	win2%iso2.c \
88	win2%maz.c \
89	win5%alt.c \
90	win5%iso5.c \
91	win5%koi8.c \
92	win5%mac.c
93
94MISSING = \
95	alt%iso.c \
96	alt%koi.c \
97	alt%win.c \
98	dhn%ib2.c \
99	dhn%is2.c \
100	dhn%wi2.c \
101	ib2%dhn.c \
102	ib2%is2.c \
103	ib2%maz.c \
104	ib2%wi2.c \
105	is2%dhn.c \
106	is2%ib2.c \
107	is2%maz.c \
108	is2%wi2.c \
109	iso%alt.c \
110	iso%koi.c \
111	iso%mac.c \
112	iso%win.c \
113	koi%alt.c \
114	koi%iso.c \
115	koi%mac.c \
116	koi%win.c \
117	mac%iso.c \
118	mac%koi.c \
119	mac%win.c \
120	maz%ib2.c \
121	maz%is2.c \
122	maz%wi2.c \
123	wi2%dhn.c \
124	wi2%ib2.c \
125	wi2%is2.c \
126	wi2%maz.c \
127	win%alt.c \
128	win%iso.c \
129	win%koi.c \
130	win%mac.c
131
132MODULES	= $(INTEGRATED)
133# $(MISSING)
134
135BINARYTABLES = \
136        8859-16%8859-2 \
137        8859-16%ibm850 \
138        8859-16%ibm870 \
139        8859-2%8859-16 \
140        ibm850%8859-16 \
141        ibm870%8859-16
142
143TABLES = table.8859-1.IBM-500.c table.IBM-500.8859-1.c table.alt.iso.c table.alt.koi.c \
144table.alt.mac.c table.alt.win.c table.dhn.ib2.c table.dhn.is2.c table.dhn.maz.c table.dhn.wi2.c table.ib2.dhn.c table.ib2.is2.c \
145table.ib2.maz.c table.ib2.wi2.c table.is2.dhn.c table.is2.ib2.c table.is2.maz.c table.is2.wi2.c table.iso.alt.c table.iso.koi.c \
146table.iso.mac.c table.iso.win.c table.koi.alt.c table.koi.iso.c table.koi.mac.c table.koi.win.c table.mac.alt.c table.mac.iso.c \
147table.mac.koi.c table.mac.win.c table.maz.dhn.c table.maz.ib2.c table.maz.is2.c table.maz.wi2.c table.wi2.dhn.c table.wi2.ib2.c \
148table.wi2.is2.c table.wi2.maz.c table.win.alt.c table.win.iso.c table.win.koi.c table.win.mac.c
149
150GEN_SRC = $(MODULES:%.c=gen_%.c)
151GEN_BIN = $(MODULES:%.c=gen_%)
152TBL = $(MODULES:%.c=%.tbl)
153HEADERS = $(MODULES:%.c=%.head)
154BTBL = $(BINARYTABLES:%=%.btbl)
155
156all: $(TBL) $(BTBL)
157	echo Now run: ./rename
158
159# .c -> .tbl
160gen_%.c: ../%.c debug.inc
161	cat $< debug.inc > $@
162
163%.head: ../%.c
164	awk '/stdio.h/{x=1} x==0 && !/^#ident/ && $$1!="" {print}' $< > $@
165
166gen_%: gen_%.c
167	$(CC) -xO3 -I. -I.. -DDEBUG -o $@ $<
168
169%.tbl: gen_% %.head input copyright
170	./$< input > $@.tmp
171	ID=`echo $@ | perl -pe 's:\.tbl::'` ; \
172	echo "\n/*\n * Automatically generated from: $$ID.c\n */" > $$ID.info ; \
173	cat $$ID.head $$ID.info copyright $@.tmp > $@
174	$(RM) $@.tmp
175
176debug.inc:
177	printf "\n#include \"debug.c\"\n\n" > $@
178
179geninput: geninput.c
180	$(CC) -o $@ geninput.c
181
182input: geninput
183	./geninput > $@
184
185gentbl: gentbl.c
186	$(CC) -o $@ gentbl.c
187
188
189# .bt -> .btbl
190%.btbl: %.out btbl.head
191	./rewritetbl $< > $@.tmp
192	ID=`echo $@ | perl -pe 's:\.btbl::'` ; \
193	echo "\n/*\n * Automatically generated from: $$ID.bt\n */" > $$ID.info ; \
194	cat btbl.head $$ID.info $@.tmp > $@
195	$(RM) $@.tmp
196
197%.out: input
198	FROM=`echo $@ | perl -pe 's:%.*::'` ; \
199	TO=`echo $@ | perl -pe 's:.*%:: ; s:\.out::'` ; \
200	/usr/bin/iconv -f $$FROM -t $$TO input > $@
201
202btbl.head: rewritetbl.c
203	awk '/stdio.h/{x=1} x==0 && $$1!="" {print}' rewritetbl.c  > $@
204
205rewritetbl: rewritetbl.c
206	$(CC) -o $@ rewritetbl.c
207
208clean:
209	$(RM) -r *.head *.tbl gen_* *info debug.inc *.out *.btbl
210