#	Makefile for building the window management code
#	
CC=	cc

# Libraries that live in subdirectories, and have makefiles of their own.
#
SUBDIR=	patterns raster rectangle graphics ucode


#directories needed for all of this
HDIR=	./h
VTDIR=	../vt

#libraries to link to
GLIB=	graphics/graphics.a
GLIB20=	graphics/graphics.20.a
RLIB=	raster/raster.a
ULIB=	ucode/ucode.a
ELIB=	rectangle/rectangle.a
PLIB=	patterns/patterns.a

CFLAGS=	-O -DKERNEL -DUNIX -I${HDIR} -I../h -I${VTDIR}

FILES=	tile.o window.o paint.o clipping.o mapping.o cursor.o \
	block.o general.o gipinit.o
FILES20= tile.O window.O paint.O clipping.O mapping.O cursor.O \
	block.O general.O gipinit.O

all:	windows.20.a windows.a

windows.a:	${FILES} ${GLIB} ${RLIB} ${ELIB} ${ULIB} ${PLIB}
	ld -r ${FILES} ${GLIB} ${RLIB} ${ELIB} ${ULIB} -o windows.a

windows.20.a:	${FILES20} ${GLIB20} ${RLIB} ${ELIB} ${ULIB} ${PLIB}
	ld -r ${FILES20} ${GLIB20} ${RLIB} ${ELIB} ${ULIB} -o windows.20.a

.SUFFIXES:	.O

.c.o:
	${CC} -c ${CFLAGS} $<

.s.o:
	${CC} -c ${CFLAGS} $<

.c.O:
	${CC} -20 -c ${CFLAGS} $<; mv $*.o $@

.s.O:
	${CC} -20 -c ${CFLAGS} $<; mv $*.o $@

${SUBDIR}: FRC
	cd $@; make ${MFLAGS}

clean:
	for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
	rm -f *.o *.O Errs rslts makeout errs core tags

# dependences
${GLIB}:	graphics
${GLIB20}:	graphics
${RLIB}:	raster
${ULIB}:	ucode
${ELIB}:	rectangle
${PLIB}:	patterns
FRC:
