# Makefile for ShapeSort

LIBS = Desk:o.Desk AJWLib:o.AJWLib


OBJECTS = Main.o Questions.o


CFLAGS = -mthrowback -mlibscl -Wall -O3 -IDesk: -IAJWLib:

CC = gcc

LINK = gcc

VERSION = 3D


all:	../!Shape$(VERSION)/!RunImage ../!Shape$(VERSION)/Messages ../!Shape$(VERSION)/Templates \
        ../!Shape$(VERSION)/!Sprites ../!Shape$(VERSION)/!Sprites22 ../!Shape$(VERSION)/!Boot \
        ../!Shape$(VERSION)/!Run ../!Shape$(VERSION)/TreeData ../!Shape$(VERSION)/Pictures \
        ../!Shape$(VERSION)/!Help

.c.o:
	$(CC) -c $(CFLAGS) -DBUILD$(VERSION) $< -o $@

!RunImage:	$(OBJECTS)
	$(LINK) -o $@ $(CFLAGS) $(OBJECTS) $(LIBS)


../!Shape$(VERSION):
	mkdir $@

../!Shape$(VERSION)/!RunImage:	!RunImage ../!Shape$(VERSION)
	cp !RunImage $@

../!Shape$(VERSION)/Templates:	Templates ../!Shape$(VERSION)
	cp Templates $@

../!Shape$(VERSION)/!Sprites:	!Sprites ../!Shape$(VERSION)
	cp !Sprites $@

../!Shape$(VERSION)/!Sprites22:	!Sprites22 ../!Shape$(VERSION)
	cp !Sprites22 $@

../!Shape$(VERSION)/!Help:	!Help ../!Shape$(VERSION)
	cp !Help $@

../!Shape$(VERSION)/Messages:	Messages ../!Shape$(VERSION)
	sed s/XD/$(VERSION)/ Messages > $@

../!Shape$(VERSION)/!Boot:	!Boot ../!Shape$(VERSION)
	sed s/XD/$(VERSION)/ !Boot > $@
	filetype $@ Obey

../!Shape$(VERSION)/!Run:	!Run ../!Shape$(VERSION)
	sed s/XD/$(VERSION)/ !Run > $@
	filetype $@ Obey

../!Shape$(VERSION)/TreeData:	TreeData$(VERSION) ../!Shape$(VERSION)
	cp TreeData$(VERSION) $@

../!Shape$(VERSION)/Pictures:	Pictures$(VERSION) ../!Shape$(VERSION)
	cp -r Pictures$(VERSION) $@
	rm -rf $@/CVS
	touch $@

clean:
	-rm -f !RunImage
	-rm -f $(OBJECTS)

distclean:	clean
	-rm -rf ../!Shape2D
	-rm -rf ../!Shape3D

