# -------------------------------------------------
#
#                       CEKANI
#
#         .ANI File Loader Library to DJGPP.
#
#    Copyright (c) 2000 by Cristian EmmericK (CEK)
#
#            E-mail: cek@mailbr.com.br
#
#               ICQ(UIN): 52438873
#
# -------------------------------------------------


# -------- variables and definitions --------------
LIB = lib/libani.a
INC = src/cekani.h
OBJ = obj/

OBJS = obj/load_ani.o
SRC = src/

LIBDEST = $(DJDIR)/$(LIB)
INCDEST = $(DJDIR)/include/
CPLIBDEST = $(subst /,\,$(LIBDEST))
CPINCDEST = $(subst /,\,$(INCDEST))
RM = rm -v -f
FLAGS =-m386 -O3

# -------- Rules start here -----------------------

all : msg $(LIB) install examples 
	@echo 
	@echo DONE. If you want to unistall CEKANI type: make uninstall
	@echo 

install : $(LIBDEST) $(INCDEST)
	@echo 

$(LIBDEST) : $(LIB)
	@echo Copying lib to DJGPPs directory...
	copy lib\libani.a $(CPLIBDEST)

$(INCDEST): $(INC)
	@echo 
	copy src\cekani.h $(CPINCDEST)cekani.h

uninstall :
	$(RM) $(LIBDEST)
	$(RM) $(INCDEST)cekani.h

$(LIB) : $(OBJS)
	@echo 
	ar rs $(LIB) $(OBJS)

$(OBJ)%.o : $(SRC)%.c
	gcc $(FLAGS) -c $< -o $@

examples : examples/ex01.exe \
           examples/ex02.exe \
	   tools/aniview.exe

examples/ex01.exe : examples/ex01.c $(LIB)
	gcc $(FLAGS) -o examples/ex01.exe examples/ex01.c $(LIB) -lalleg -s

examples/ex02.exe : examples/ex02.c $(LIB)
	gcc $(FLAGS) -o examples/ex02.exe examples/ex02.c $(LIB) -lalleg -s

tools/aniview.exe :  tools/aniview.c $(LIB) 
	gcc $(FLAGS) -o tools/aniview.exe tools/aniview.c $(LIB) -lbgui -lalleg  -s

clean:
	$(RM) obj/*.o lib/*.a examples/*.exe tools/*.exe

msg :
	@echo Compiling CEKANI, Please wait...
