#######################################################################
##
##  File:        makefile
##  Description: Builts the VGA_Graphics demo programs
##  Rev:         0.7
##  Date:        01-feb-98
##  Author:      Jerry van Dijk
##  Mail:        jdijk@acm.org
##
##  Copyright (c) Jerry van Dijk, 1996, 1997, 1998
##  Billie Holidaystraat 28
##  2324 LK Leiden
##  THE NETHERLANDS
##  tel int + 31 71 531 4365
##
##  Permission granted to use for any purpose, provided this copyright
##  remains attached and unmodified.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
##  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
##  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
##
#######################################################################

##  Compiler flags
CFLAGS = -O2 -c -gnatp -gnatn -s -m486 -fomit-frame-pointer

##  Builts the main targets
#.PHONY: programs
programs:   demo.exe shows.exe mandelbr.exe

## Built demonstration executable
demo.exe: demo.o vgagraph.o djgplibr.o pckeyboa.o
	gnatbind -x demo.ali
	gnatlink demo.ali
	strip --strip-all demo.exe
	del demo

## Built shows executable
shows.exe: shows.o vgagraph.o djgplibr.o pckeyboa.o
	gnatbind -x shows.ali
	gnatlink shows.ali
	strip --strip-all shows.exe
	del shows

## Built mandelbr executable
mandelbr.exe: mandelbr.o vgagraph.o djgplibr.o pckeyboa.o
	gnatbind -x mandelbr.ali
	gnatlink mandelbr.ali
	strip --strip-all mandelbr.exe
	del mandelbr

##  Compile the shows program
shows.o: shows.adb vgagraph.ads pckeyboa.ads
	gcc $(CFLAGS) shows.adb

##  Compile the demo program
demo.o: demo.adb vgagraph.ads pckeyboa.ads
	gcc $(CFLAGS) demo.adb

##  Compile the mandelbr program
mandelbr.o: mandelbr.adb vgagraph.ads pckeyboa.ads
	gcc $(CFLAGS) mandelbr.adb

##  Compile the VGA package
vgagraph.o: vgagraph.adb vgagraph.ads djgplibr.ads
	gcc $(CFLAGS) vgagraph.adb

##  Compile the djgpp library specifications
djgplibr.o: djgplibr.ads
	gcc $(CFLAGS) djgplibr.ads

##  Compile the keyboard functions
pckeyboa.o: pckeyboa.adb pckeyboa.ads djgplibr.ads
	gcc $(CFLAGS) pckeyboa.adb

##########################
##  Clean Up Directory  ##
##########################
.PHONY: clean
clean:
	@if exist shows         del shows
	@if exist shows.exe     del shows.exe
	@if exist demo          del demo
	@if exist demo.exe      del demo.exe
	@if exist mandelbr      del mandelbr
	@if exist mandelbr.exe  del mandelbr.exe
	@if exist *.ali         del *.ali
	@if exist *.o           del *.o
	@if exist b_*.c         del b_*.c
	@if exist *.bak         del *.bak
	@if exist errlist       del errlist
