# Makefile for labeller (standard version)
# Does not include some of the minor utilities.
CC = gcc
CCOPT = -g -ansi -W -Wall -DNo_Phrase -c
LINK = gcc
LINKOPT =
LINKLIB =
LIB = ar
LIBOPT = rc
RANLIB = ranlib
# LIBOPT1 = -s
DOLINK = $(LINK) $(LINKOPT) -o $@
LABELLIB = labellib.a
.c.o:
	$(CC) $(CCOPT) $<

# Main target
all: cmptran dephrase dmerge dtinfo exdict label outcomp readtr rules

# Library
labellib.a: common.o unkcommon.o diction.o unkdiction.o io.o list.o low.o map.o trans.o
	$(LIB) $(LIBOPT) $@ $?
	$(RANLIB) $@
#	$(LIB) $(LIBOPT1) $@

# Targets
cmptran: cmptran.o $(LABELLIB)
	$(DOLINK) cmptran.o $(LABELLIB) $(LINKLIB)
dephrase: dephrase.o $(LABELLIB)
	$(DOLINK) dephrase.o $(LABELLIB) $(LINKLIB)
dmerge: dmerge.o $(LABELLIB)
	$(DOLINK) dmerge.o $(LABELLIB) $(LINKLIB)
dtinfo: dtinfo.o $(LABELLIB)
	$(DOLINK) dtinfo.o $(LABELLIB) $(LINKLIB)
exdict: exdict.o $(LABELLIB)
	$(DOLINK) exdict.o $(LABELLIB) $(LINKLIB)
label: analyse.o mainl.o label.o stack.o  $(LABELLIB)
	$(DOLINK) analyse.o mainl.o label.o stack.o  $(LABELLIB) -lm $(LINKLIB)
outcomp: outcomp.o $(LABELLIB)
	$(DOLINK) outcomp.o $(LABELLIB) $(LINKLIB)
readtr: readtr.o $(LABELLIB)
	$(DOLINK) readtr.o $(LABELLIB) $(LINKLIB)
rules: rules.o $(LABELLIB)
	$(DOLINK) rules.o $(LABELLIB) $(LINKLIB)

# c -> o
analyse.o: analyse.c common.h map.h diction.h label.h analyse.h
cmptran.o: cmptran.c common.h trans.h map.h
common.o: common.c common.h
unkcommon.o: unkcommon.c common.h diction.h unkcommon.h unkdiction.h \
 map.h
dephrase.o: dephrase.c common.h map.h
diction.o: diction.c common.h diction.h map.h
unkdiction.o: unkdiction.c common.h diction.h unkcommon.h unkdiction.h \
 map.h
dmerge.o: dmerge.c common.h map.h diction.h trans.h
dtinfo.o: dtinfo.c common.h map.h diction.h trans.h
exdict.o: exdict.c common.h diction.h trans.h map.h
io.o: io.c common.h diction.h low.h map.h label.h stack.h unkcommon.h \
 unkdiction.h analyse.h
label.o: label.c common.h diction.h trans.h label.h map.h stack.h \
 analyse.h unkcommon.h
list.o: list.c common.h list.h
low.o: low.c common.h low.h map.h
mainl.o: mainl.c common.h diction.h trans.h label.h map.h low.h \
 unkcommon.h unkdiction.h analyse.h
map.o: map.c common.h list.h map.h
outcomp.o: outcomp.c
readtr.o: readtr.c common.h trans.h map.h
rules.o: rules.c common.h map.h low.h
stack.o: stack.c common.h map.h diction.h label.h stack.h unkcommon.h \
 unkdiction.h list.h
trans.o: trans.c common.h trans.h map.h
