# Makefile for JOVE char.table generator
# TODO: difftabs should be generalized to support other systems besides MS-DOG

RCSid = $$Id: Makefile,v 1.8 1993/11/07 19:14:42 tom Exp tom $$

AWK	= awk
RM	= rm -f

c	= .ctb	# source charcode table
t	= .tab	# result charcode tables
d	= .dt	# difference charcode tables

# All available charcode source tables
TABSRC= $(DIR)ascii$c \
	$(DIR)atarist$c \
	$(DIR)decmulti$c \
	$(DIR)ebcdic$c \
	$(DIR)hproman8$c \
	$(DIR)ibm_rt$c \
	$(DIR)isolatin$c \
	$(DIR)mac$c \
	$(DIR)msdos$c \
	$(DIR)msdos850$c \
	$(DIR)msdos852$c \
	$(DIR)msdos860$c \
	$(DIR)msdos861$c \
	$(DIR)msdos862$c \
	$(DIR)msdos863$c \
	$(DIR)msdos865$c \
	$(DIR)msdos866$c \
	$(DIR)next$c \
	$(DIR)sco_dos$c

# Tables for systems that generally lack AWK (non-U**X mostly).
TABLES=	$(DIR)ascii$t \
	$(DIR)atarist$t \
	$(DIR)decmulti$t \
	$(DIR)isolatin$t \
	$(DIR)mac$t \
	$(DIR)msdos$t

# All tables: 
ALLTABLES= \
	$(DIR)ebcdic$t \
	$(DIR)hproman8$t \
	$(DIR)ibm_rt$t \
	$(DIR)next$t \
	$(DIR)sco_dos$t \
	$(TABLES)

DIFFTABS= \
	$(DIR)msdos850$d \
	$(DIR)msdos852$d \
	$(DIR)msdos860$d \
	$(DIR)msdos861$d \
	$(DIR)msdos862$d \
	$(DIR)msdos863$d \
	$(DIR)msdos865$d \
	$(DIR)msdos866$d

BASE 	= ascii
DIFFBASE= msdos

CTBtoTAB= ${AWK} -f $(DIR)Mkctable.awk $(MKCTDEBUG) $(DIR)Chardefs \
	$(DIR)$(BASE)$c
TABtoDT = ${AWK} -f $(DIR)Ctabdiff.awk $(DIFFDEBUG) $(DIR)$(DIFFBASE)$t

.SUFFIXES: $d $t $c

.ctb.tab:
	${CTBtoTAB} $<

.tab.dt:
	${TABtoDT} $< >$@
	
.ctb.dt:
	${CTBtoTAB} $<
	${TABtoDT} $*$t >$@
	@-${RM} $*$t

most:	tables alldifftabs allselinc

all:	alltables alldifftabs allselinc

# Extra level of indirection, so that difftabs for other systems beside MS-DOG
# can be added more easily.
alldifftabs:	difftabs
allselinc:	selinc

tables:	$(TABLES)

alltables:	$(ALLTABLES)

difftabs:	$(DIFFTABS)

selinc:	$(DIR)$(DIFFBASE)sel.inc

$(DIFFTABS): $(DIR)Ctabdiff.awk $(DIR)$(DIFFBASE)$t

$(TABLES) $(DIFFTABS): $(DIR)Mkctable.awk $(DIR)Chardefs $(DIR)$(BASE)$c

# base table (ascii) is a special case
$(DIR)$(BASE)$t: $(DIR)$(BASE)$c
	$(CTBtoTAB)

# Create include file for use with SELECTABLE chartables.
# (avoid pipes for portability)
$(DIR)$(DIFFBASE)sel.inc: $(DIR)Makefile $(DIR)Mkselinc.awk
	@-echo $(DIFFTABS) >@@@
	$(AWK) -f Mkselinc.awk "BASE=$(DIFFBASE)" "DIR=$(DIR)" @@@ >$@
	@-${RM} @@@

# (obsolescent) Archiving:
arc-ctabsrc:
	$(UARC) $(ARCDIR)jovectab \
		$(DIR)Chardefs $(DIR)Mkctable.awk \
		$(DIR)Ctabdiff.awk $(DIR)Makefile \
		$(TABSRC)

arc-auxtab: all
	$(UARC) $(ARCDIR)joveauxt \
		$(TABLES) \
		$(DIFFTABS)

clean:
	${RM} $(DIR)%*

CLEAN:
	${RM} $(DIR)*$(t) $(DIR)*$(d) $(DIR)*.inc 

#======================================================================
# $Log: Makefile,v $
# Revision 1.8  1993/11/07  19:14:42  tom
# (RM, ALLTABLES): new variables;
# (most, alltables, alldifftabs, allselinc, *selinc, clean, CLEAN): new targets;
# (most): new default target: generates all non-U**X target tables.
#
# Revision 1.7  1993/11/04  21:39:21  tom
# (AWK, BASE, DIFFBASE, CTBtoTAB, TABtoDT): new variables;
# (DIFFTABS): new codepages 861 (Icelandic), 862 (Hebrew), 866 (Cyrillic);
# (arc-auxtab): depend on all.
#
# Revision 1.6  1993/01/26  18:39:07  tom
# add "decmulti" and "sco_dos" tables; add RCS directives.
#
#======================================================================
