#
#

#if you change BIN you will need to change the mahjongg scriptfile too
BIN = /usr/games
MANDIR = /usr/man/man6
LINT = lint -x
# cross compiler for DMD terminal
CC = dmdcc
# compiler for host machine
NCC = cc
CFLAGS = -g

SRC = mahjongg.c window.c tiles.c event.c convert.c oldtiles.c
OBJ = mahjongg.o window.o tiles.o event.o

all:	mahjongg

mahjongg:	$(OBJ)
	$(CC) $(LDFLAGS) $(OBJ) $(SHAREDLIB) -o mahjongg.m

install: mahjongg
	cp mahjongg $(BIN)/mahjongg
	cp mahjongg.m $(BIN)/mahjongg.m
	rm mahjongg.m
#	cp mahjongg.6 $(MANDIR)/mahjongg.6

clean:
	rm -f *.o mahjongg.m convert core tiles/all

lint:
	$(LINT) $(SRC)

window.o : window.c mahjongg.h
mahjongg.o : mahjongg.c mahjongg.h
tiles.o : tiles.c mahjongg.h tiles/all
event.o : event.c mahjongg.h
tiles/all : convert
	./convert > tiles/all
convert : convert.c oldtiles.o
	$(NCC) convert.c oldtiles.o -o convert
oldtiles.o : oldtiles.c
	$(NCC) -c oldtiles.c 
