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