# General UNIX Makefile v2 August 21 1996

# This makefile should compile FPL under most UNIXes that has gcc _and_
# support shared (dynamically linked) libraries.

########################################################################
#                                                                      #
# fpl.library - A shared library interpreting script langauge.         #
# Copyright (C) 1992-1996 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                       #
#                                                                      #
########################################################################

.SUFFIXES: .o .c .c~ .h .h~ .a .i

################################################
# Below follows all UNIX macros/actions/lines: #
################################################
LIB     = libfpl.a
TARGET  = FPL
OBJS    = script.o numexpr.o caller.o hash.o statement.o memory.o frontend.o \
          reference.o sprintf.o scan.o compile.o sscanf.o
LIBOBJS = script.o numexpr.o hash.o statement.o memory.o frontend.o \
          reference.o sprintf.o scan.o compile.o sscanf.o
LIBDEP  = $(LIBOBJS)

# if using the `gcc' compiler:
CFLAGS  = -DUNIX -DSHARED -ansi -pedantic -g -funsigned-char
CC      = gcc
LD      = ld


# -G makes the destination to become a sharable object!
#    -B symbolic  In dynamic mode only, when  building  a  shared
#                 object,  bind  references  to  global symbols to
#                 their definitions within the object, if  defini-
#                 tions  are  available.   Normally, references to
#                 global symbols within  shared  objects  are  not
#                 bound  until  runtime,  even  if definitions are
#                 available, so that definitions of the same  sym-
#                 bol in an executable or other shared objects can
#                 override the object's own definition.
# (The Send() function collided with the one with the same name used in
# Dancer.)
#
LDFLAGS = -G -B symbolic

all:	$(LIB) SFPL

$(LIB) : $(LIBDEP)
	$(LD) $(LDFLAGS) $(LIBOBJS) -o $(LIB) -lc
	cp -p FPL.h ../include/libraries

$(TARGET) : $(OBJS)
	$(CC) $(OBJS) -o $(TARGET)

.c.o:
	$(CC) $(CFLAGS) -c $<

clean:
	rm *.o
	rm $(LIB) SFPL

# This compiling is using -DSFPL to make the MALLOC() macro not to use the
# global `mem' variable!
SFPL: caller.c FPL.h script.h Makefile.SVR4
	$(CC) $(CFLAGS) -DSFPL -o SFPL caller.c -L. -lfpl

$(OBJS): script.h FPL.h

script.o:script.c
numexpr.o:numexpr.c
caller.o:caller.c
statement.o:statement.c
hash.o:hash.c
memory.o:memory.c memory.h
frontend.o:frontend.c
reference.o:reference.c
sprintf.o:sprintf.c
scan.o:scan.c
