LIBNAME = libsparks

include ../Makefile.include

TARGET   = $(LIBDIR)/$(LIBNAME).a
RUNTIMEPATH    = $(VOBROOT)/runtime/$(PRODUCTDIR)/sparks

########################################################################
#
#     SOURCE FILES
#
########################################################################

SPARK_CFILES = \
	sparkAverage1.c \
	sparkAverage2.c \
	sparkBlend.c \
	sparkBroadcast.c \
	sparkComposite.c \
	sparkCompress.c \
	sparkFractal.c \
	sparkImage.c \
	sparkInvert.c \
	sparkKey24.c \
	sparkKey64.c \
	sparkReverse.c \
	sparkWipe.c 


CFILES = \
	spark.c 


EXPORT_HFILE = \
	$(RUNTIMEPATH)/spark.h

OFILES := $(patsubst %.c,$(OBJDIR)/%.o,$(CFILES))

TARGETS := $(addprefix $(RUNTIMEPATH)/,$(SPARK_CFILES)) \
	   $(patsubst %.c,$(RUNTIMEPATH)/%$(DEBEXT).spark,$(SPARK_CFILES))

#########################################################################
#
#    COMPILATION  OPTIONS
#
#########################################################################

#
#  The following list of compilation options may be useful in the future:
#
#  -wlint,-fp   Turn on full lint warnings and portability warnings
#
#  -woff 828    Turn off warning about global symbols having the same first
#               8 charactes (cc complains in many systems .h files)
#  -woff 813    Turn off warning about struct/union/enum used, but not defined
#               (cc complains in many systems .h files)
#  -woff 827    Turn off waring about implicit conversion and possible
#               rounding / loss of accuracy
#  -woff 852    Turn off warning about functions argument that should be 
#               declared const
#  -woff 826    Turn off warning about width of hex constant is smaller 
#               than size of type
#  -woff 835 
#
#  -woff 814    Turn off warning about unused static variables and functions
#
#  -woff 819    Turn off warning about unused function arguments
#
CLINT =	-wlint,-fp \
	-woff 828 \
	-woff 813 \
	-woff 827 \
	-woff 852 \
	-woff 826 \
        -woff 814 \
        -woff 819



CFLAGS = $(AUXCFLAGS) \
	 -fullwarn \
	 -DSPARK_OGL \
	 $(CLINT) \
	 $(COPTS) \
	 -I.. \
         -I. 

#########################################################################
#
#    LINKER  OPTIONS
#
#########################################################################

LDFLAGS =   -shared \
	    -check_registry /usr/lib/so_locations 


#########################################################################
#
#    TARGETS
#
#########################################################################



lib: $(TARGET) $(TARGETS) $(EXPORT_HFILE) $(RUNTIMEPATH)/Makefile

$(RUNTIMEPATH)/%.c: %.c
	-rm -f $@
	-cp $^ $@

$(RUNTIMEPATH)/%$(DEBEXT).spark: $(OBJDIR)/%.o
	-rm -f $@
	ld $(LDFLAGS) $^ -o $@;


$(RUNTIMEPATH)/%: %
	-rm -f $@
	-cp $^ $@

$(TARGET): $(OFILES)
	-/bin/rm -f $@
	ar src $@ $^

clean_lib:
	-rm -f $(OBJDIR)/*.o $(TARGET) 
	-rm -f $(RUNTIMEPATH)/*.c $(RUNTIMEPATH)/*.spark 
	-rm -f $(RUNTIMEPATH)/*.h $(RUNTIMEPATH)/Makefile








