# File: Makefile
#
#	GRENDSYS sample program "cuben"
#		Makefile
#
#	Written by Toshio Fukui. (07/19/2001-10/06/2001)
#

include MCONFIG

DEFINES	= $(GDEFINES)
CFLAGS	= $(GCFLAGS) $(DEFINES)
INCDIRS = $(GINCDIRS)
LFLAGS  = $(GLFLAGS)
LIBS    = $(GLIBS)

TARGET	= cuben
OBJS	= init.o main.o cube.o

all:	$(TARGET)

run:	all
	$(TARGET)

grendlib:
	$(MAKE) -C ../../grendlib

clean:
	$(RM) -rf tmp .depend
	$(RM) *~ *.bak *.BAK \#* *.o *.tmp *.TMP
	$(RM) *.map *.lst core *.dis *.elf
	$(RM) $(TARGET)

depend:
	$(DEPEND) -f- $(DEFINES) $(INCDIRS) $(OBJS:.o=.c) >.depend

$(TARGET) : $(OBJS) $(GRENDLIBDIR)/libgrend.a
	$(CC) $(LFLAGS) -o $(TARGET) $(OBJS) $(LIBS)

.c.o	:
	$(CC) -c $(CFLAGS) $(INCDIRS) $<

# include dependencies
ifneq ($(wildcard .depend),)
include .depend
endif
