#
# Tom's generic makefile
#
# This makefile uses the shared libraries
# just type make
#

# program name
NAME = mahjongg

# Program specific flags
# To make background color tiles the default comment the next line
DFLAGS = -DINVERSE_VIDEO

# program source and object files
HDR = mahjongg.h
SRC = mahjongg.c window.c tiles.c event.c prewinit.c\
	bamboo.c character.c dot.c other.c
OBJ = mahjongg.o window.o tiles.o event.o prewinit.o\
	bamboo.o character.o dot.o other.o

# Uncomment the next two lines if you want to use GCC
#CC = gcc
#GNULIB = /usr/local/lib/gcc-gnulib

CFLAGS = -O $(DFLAGS)
LDFLAGS = -s
SHAREDLIB = /lib/crt0s.o /lib/shlib.ifile
BIN = /usr/games
MANDIR = /usr/man/man6
LINT = lint -xbp

all: $(NAME)

$(NAME):	$(OBJ)
	$(LD) $(LDFLAGS) -o $(NAME) $(SHAREDLIB) $(OBJ) $(GNULIB)

install: $(NAME)
	cp $(NAME) $(BIN)/$(NAME)
	chgrp bin $(BIN)/$(NAME)
	chown bin $(BIN)/$(NAME)
	cp $(NAME).6 $(MANDIR)/$(NAME).6

clean:
	rm -f *.o Makefile~ core $(NAME).sh* $(NAME)

shar:
	shar -s 50000 -h $(NAME).sh README Makefile $(HDR) $(SRC)

lint:
	$(LINT) $(SRC)

# requires gcc to build the dependencies
depend:
	cp Makefile Makefile~
	sed -e "/^#######/q" Makefile~ > Makefile
	gcc -MM $(SRC) >> Makefile
	
######### Source file dependencies - do not touch ##########
mahjongg.o : mahjongg.c mahjongg.h 
window.o : window.c mahjongg.h 
tiles.o : tiles.c mahjongg.h 
event.o : event.c mahjongg.h 
bamboo.o : bamboo.c 
character.o : character.c 
dot.o : dot.c 
other.o : other.c 
