##
##		Example Shared Library Code
##		Compiles with DICE
##		
##		By Wez Furlong <wez@twinklestar.demon.co.uk>
##
##		Based on code by Geert Uytterhoeven and Matt Dillon
##
##		This source was produced:	Monday 23-Jun-1997 
##
##		DISCLAIMER
##
##		Please read the code FULLY before use... I could have put ANYTHING in
##		here; I may have the code format your bootdrive for example.
##
##		NEVER trust example code without fully understanding what it does.
##
##		This code comes with no warranty; I am NOT responsible for any damage
##		that may ensue from its use, be it physical, mental or otherwise.
##
##		This code may be modified, so long as the names of myself, Geert and
##		Matt are mentioned within any release or distribution produced using it,
##		and a copy sent to myself.
##
##		This code may be redistributed freely; no profit is allowed to be made
##		from its distribution.
##
##		This code may be included on an Aminet or Fred Fish CD.
##

#### The name of the library
PROJECT= example

####	The names of your source modules
##	LibHeader should be first to prevent accidental execution
SRCS= LibHeader.c Misc.c Memory.c StdLibFunc.c Functions.c 
HDRS= $(PROJECT).h  

EXEDIR= distribution/
OD= objects/
CFLAGS= -3.0 -d0 -R -l0 -// -f0 

#### You shouldn't need to edit below here
PROTOS= $(OD)$(PROJECT)-protos.h
EXE= $(EXEDIR)$(PROJECT).library
FD= $(PROJECT).fd
LINKLIB= $(EXEDIR)$(PROJECT).lib
PRAGMAS= $(EXEDIR)$(PROJECT)_pragmas.h
COMPFLAGS = -no-env $(CFLAGS) $(OD:"*":-I*) -R0 -l0 -lc -lamiga30 -lautos -ms

OBJS= $(SRCS:"*.a":"$(OD)*.o") $(SRCS:"*.c":"$(OD)*.o")

all: $(PROTOS) $(LINKLIB) $(OD)$(PROJECT).library_rev.h $(PRAGMAS) $(EXE)

$(PROJECT).library_rev.h:	$(SRCS) $(HDRS)
	uprev $(PROJECT).library `type $(PROJECT).library_rev.ver`
	
nopro: $(EXE)

$(EXE): $(OBJS)
    fwrite $(OD)$(PROJECT).lnktmp $(OBJS)
    dcc $(COMPFLAGS) @$(OD)$(PROJECT).lnktmp -o %(left)

$(OBJS) : $(SRCS)
    dcc %(right) -o %(left) -c $(COMPFLAGS)

$(PROTOS) : $(SRCS)
    -delete %(left)
    makeproto -o %(left) %(right)

$(PRAGMAS) : $(FD)
    fdtopragma $(FD) -o %(left)
	 -copy $(FD) $(EXEDIR)

$(LINKLIB) : $(FD)
    fdtolib $(FD) -o %(left) -auto $(EXE)

clean:
    -delete $(OBJS) $(PROTOS) $(PRAGMAS) $(LINKLIB) $(OD)$(PROJECT).lnktmp $(PROJECT).library_rev.h

relink: rmexe $(EXE)

rmexe:
    -delete $(EXE)

