#************************************************************************
#       -= SEER - C-Scripting engine v 0.94a =-
#State      : under implementation
#Author     : Przemyslaw Podsiadly
#             email: ppodsiad@elka.pw.edu.pl
#             WWW:   http://home.elka.pw.edu.pl/~ppodsiad
#File:makefile
#Desc:makefile for examples
#************************************************************************/
.PRECIOUS: %.o
#defines:
#****Compilation options:
Optimize=1
#PGCC=1
#DEBUG=1
ifdef DJDIR
DOS=1
else
Linux=1
endif

#****output filename:
EXEcs =exhello exsimple exinside exlotr\
     excpp exclassc exmulti exstdlib exscript

ifdef DOS
EXEs = $(addsuffix .exe,$(EXEcs))
else
EXEs = $(EXEcs)
endif     

#****program objs
OBJp=
ifdef DEBUG
LIBc=../lib/libseerd.a
else
LIBc=../lib/libseer.a
endif
LIBs=-lm
#-lalleg
HDRs=

#****Compilation parameters
ifdef Optimize
ifdef PGCC
FLAGS = -Wall -s -mpentium -O6 -ffast-math -fomit-frame-pointer
else
FLAGS=-Wall -s -m486 -O3 -ffast-math -fomit-frame-pointer
endif
LINK=-Wall -s
else

ifdef DEBUG
FLAGS=-Wall -g -m486
LINK=-Wall -g -m486
else
FLAGS=-Wall -s -m486
LINK=-Wall -s -m486
endif

endif

#****compiler and linker:
AR=ar rs
CC=gcc
all:$(EXEs) exsimple.cs seerc_exstdlib

#****compile
./%.o:./%.c $(HDRs);$(CC) $(FLAGS) -I.. -c -o $@ $<
./%.o:./%.cpp $(HDRs);$(CC) $(FLAGS) -I.. -c -o $@ $<
msg2 :;@echo Compiling SeeR examples...
%.cs:%.sc;../bin/seerc -s $< -o $@ -author "Theur"

#****link program:
ifdef DOS
%.exe:%.o $(LIBc) msg2 $(OBJp) $(HDRs);$(CC) $(LINK) -o $@ $< $(LIBc) $(LIBs)
else
ex%:ex%.o $(LIBc) msg2 $(OBJp) $(HDRs);$(CC) $(LINK) -o $@ $< $(LIBc) $(LIBs)
endif

#example of you can make script in Unix with SeeR
ifdef Linux
seerc_exstdlib:;chmod +x exstdlib.sc; ./exstdlib.sc Enjoy!!!
else
seerc_exstdlib:;../bin/seerc -r exstdlib.sc Enjoy!!!
endif
