# $VER: fpl.library makefile v2.0 93-03-24

########################################################################
#                                                                      #
# fpl.library - A shared library interpreting script langauge.         #
# Copyright (C) 1992-1994 FrexxWare                                    #
# Author: Daniel Stenberg                                              #
#                                                                      #
# This program is free software; you may redistribute for non          #
# commercial purposes only. Commercial programs must have a written    #
# permission from the author to use FPL. FPL is *NOT* public domain!   #
# Any provided source code is only for reference and for assurance     #
# that users should be able to compile FPL on any operating system     #
# he/she wants to use it in!                                           #
#                                                                      #
# You may not change, resource, patch files or in any way reverse      #
# engineer anything in the FPL package.                                #
#                                                                      #
# This program is distributed in the hope that it will be useful,      #
# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                 #
#                                                                      #
# Daniel Stenberg                                                      #
# Ankdammsgatan 36, 4tr                                                #
# S-171 43 Solna                                                       #
# Sweden                                                               #
#                                                                      #
# FidoNet 2:201/328    email:dast@sth.frontec.se                       #
#                                                                      #
########################################################################

LIBRARY = fpl.library	# library version
TARGET2 = FPL		# executable file version
SFPL	= SFPL		# library using executable

#
# These flags build the .library:
#
FLAGS = STRINGMERGE UNSIGNEDCHAR NOSTKCHK NOSTANDARDIO DATA=NEAR IGNORE=183\
NOVERSION DEFINE=AMIGA DEFINE=SHARED LIBCODE\
OPTIMIZE CPU=68020
#DEBUG=S
#DEFINE=DEBUG



ASMFLAGS = IDIR=Include: ASSEMBLER
LINKFLAGS = SC SD
LIBS = LIB:sc.lib
OBJS = script.o numexpr.o hash.o statement.o liballoc.o memory.o frontend.o\
       compile.o
CC = sc
ASM = sc
LINK = slink

#
# These flags build the file version:
#
#CFLAGS = STRINGMERGE UNSIGNEDCHAR STKCHK DATA=NEAR IGNORE=217+183 DEBUG=S\
# STANDARDIO DEFINE=DEBUG DEFINE=AMIGA NOVERSION
# DEFINE=SHARED DEFINE=SFPL # use these when building 'SFPL'
#TARGETDEP2 = caller.o script.o numexpr.o hash.o statement.o
#OBJS2 = LIB:c.o $(TARGETDEP2)

all: $(LIBRARY) $(SFPL)

$(LIBRARY): $(OBJS)
      slink with <<
LIBFD fpl.fd 
to $(LIBRARY)
FROM lib:libent.o lib:libinit.o $(OBJS)
lib $(LIBS)
noicons
SD SC
FWIDTH 20 PWIDTH 20 WIDTH 20
map FPL.map H
libid "fpl.library 6.0 (5.2.93)"
libversion 6 librevision 0
<
	copy $(LIBRARY) LIBS: CLONE
	copy FPL.h /include/libraries/ CLONE
	copy FPL.h include:libraries/ CLONE


$(TARGET2): $(TARGETDEP2)
	$(LINK) SC SD FROM $(OBJS2) TO $(TARGET2) LIB $(LIBS)

$(SFPL): caller.o
	$(LINK) SC SD FROM LIB:c.o caller.o to $(SFPL) LIB $(LIBS)
  
script.o: script.c script.h FPL.h
	$(CC) $(FLAGS) $< SOURCEIS=FPL:src/script.c 

numexpr.o: numexpr.c script.h FPL.h
	$(CC) $(FLAGS) $< SOURCEIS=FPL:src/numexpr.c 

hash.o: hash.c script.h FPL.h
	$(CC) $(FLAGS) $< SOURCEIS=FPL:src/hash.c 

statement.o: statement.c script.h FPL.h
	$(CC) $(FLAGS) $< SOURCEIS=FPL:src/statement.c 

frontend.o: frontend.c script.h FPL.h
	$(CC) $(FLAGS) $< SOURCEIS=FPL:src/frontend.c 

compile.o: compile.c script.h FPL.h
	$(CC) $(FLAGS) $< SOURCEIS=FPL:src/token/compile.c 

liballoc.o: liballoc.a
	$(CC) $(FLAGS) SOURCEIS=FPL:src/liballoc.a  $(ASMFLAGS) $<

memory.o: memory.c
	$(CC) $(FLAGS) $< SOURCEIS=FPL:src/memory.c 

caller.o: caller.c FPL.h /include/pragmas/FPL_pragmas.h
	$(CC) STRINGMERGE UNSIGNEDCHAR DATA=NEAR NOSTACKCHECK NOVERSION\
DEFINE=AMIGA DEFINE=SHARED DEBUG=S DEFINE=SFPL IGNORE=183 $<
