# GENERIC X-WINDOW-BASED TETRIS
#
#	Makefile
#
###
#
#  Copyright (C) 1992	Qiang Alex Zhao
#			Computer Science Dept, University of Arizona
#			azhao@cs.arizona.edu
#
#			All Rights Reserved
#
#  Permission to use, copy, modify, and distribute this software and
#  its documentation for any purpose and without fee is hereby granted,
#  provided that the above copyright notice appear in all copies and
#  that both that copyright notice and this permission notice appear in
#  supporting documentation, and that the name of the author not be
#  used in advertising or publicity pertaining to distribution of the
#  software without specific, written prior permission.
#
#  This program is distributed in the hope that it will be "playable",
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#


### Configurable Settings

# destination directory
DEST		= /r/cas/usr/azhao/pub

# score file
SCOREFILE	= $(DEST)/.tetris.scores

# path to X header files
XINCLUDE	= /usr/include/X11

# path to X library files
XLIBS		= /usr/lib/X11

# the C compiler, used as linker ;o)
CC		= cc

# optimization flages
CFLAGS		= -O -I$(XINCLUDE) -DSCOREFILE='"$(SCOREFILE)"'
LDFLAGS		= -O -L$(XLIBS)

### Fixed settings

MAKEFILE	= Makefile

PROGT		= tetris
PROGS		= tscores

HDRS		= tetris.h \
		  data.h

LDLIBS		= -lX11 -lm

SRCS		= tetris.c \
		  die.c \
		  tscores.c

OBJT		= tetris.o \
		  die.o

OBJS		= tscores.o

PRINT		= enscript -2rG


### Dependencies/Actions

all:		$(PROGT) $(PROGS)

$(PROGT):	$(OBJT)
	@echo -n "Linking $(PROGT) ... "
	@$(CC) $(LDFLAGS) $(OBJT) $(LDLIBS) -o $(PROGT)
	@echo "Done."

$(PROGS):	$(OBJS)
	@echo -n "Linking $(PROGS) ... "
	@$(CC) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $(PROGS)
	@echo "Done."

clean:
	rm -rf *.o $(PROGT) $(PROGS)

install:	$(PROGT) $(PROGS)
	@echo Installing $(PROGT) and $(PROGS) in $(DEST)
	install -s $(PROGT) $(PROGS) $(DEST)

print:
	$(PRINT) $(HDRS) $(SRCS)

### dependencies for each object
tetris.o:	tetris.c tetris.h data.h
die.o:		die.c tetris.h
tscore.o:	tscore.c tetris.h

