#include <SDDAS.rules> 

LIB_NAME = PIDF

INCLUDES = -I. $(SDDAS_WINCLUDE) $(SDDAS_INCLUDE)

/**************************************************************************/
/* Other stuff for dump_pidf                                              */
/**************************************************************************/

LDLIBS = \
         -L. $(SDDAS_WLIBS) $(SDDAS_LIBDIR) \
         -lPIDF -lPromote $(DBLIB) -lCfg -lant -lm \
         $(LEXLIB) $(CPPLIB) $(EXTRA_LIBRARIES)

SOURCES.h = libPIDF.h pidf.h pidf_ret.h

OTHER_FILES = pidf.l sed_cmds pidf-parse.y pidf_parse.h pidf_local.h symtab.h dump_pidf.c

SRCS =  Avg.c Bin.c Cal.c CoordSys.c CoordSysDef.c DataQual.c FindPidf.c \
	FindPidfPath.c Group.c Image.c Mode.c Moments.c MkOnLine.c \
	newRead.c ReadPidfRec.c Sensor.c Sweep.c Unit.c \
	PitchAngle.c SpinAngle.c SCPotential.c pidf_err_str.c \
	chk_stubs.c \
        mapPIDF.C \
        BinIndex.c MomentsDef.c FlowIntoDef.c \
        SweepUnits.c ScanUnits.c PidfGroup.c DTNames.c DTNums.c CalData.c ReadPidf.c \
        Tensor.c TensorDef.c


OBJS = \
	Avg.o Bin.o Cal.o CoordSys.o CoordSysDef.o DataQual.o FindPidf.o \
        FindPidfPath.o Group.o Image.o Mode.o Moments.o MkOnLine.o \
        newRead.o ReadPidfRec.o Sensor.o Sweep.o Unit.o \
        PitchAngle.o SpinAngle.o SCPotential.o pidf_err_str.o \
        pidf.y.tab.o pidf.lex.yy.o \
        mapPIDF.o \
        BinIndex.o MomentsDef.o FlowIntoDef.o \
        SweepUnits.o ScanUnits.o PidfGroup.o DTNames.o DTNums.o CalData.o ReadPidf.o \
        Tensor.o TensorDef.o


CHK_OBJS = chk_stubs.o \
        pidf.y.tab.o pidf.lex.yy.o newRead.o \
        Avg.o Bin.o Cal.o DataQual.o \
        Group.o Image.o Mode.o Moments.o \
        PitchAngle.o SpinAngle.o SCPotential.o pidf_err_str.o \
        ReadPidfRec.o Sensor.o Sweep.o Unit.o

NormalLibraryTarget (chkPidf,$(CHK_OBJS))
SpecialObjectRule (pidf.y.tab.o,pidf.y.tab.h,NullParameter)
DependTarget ()
SDTestingRelease ($(SDDAS_TEST_DIR)/libPIDF)
SDBetaRelease ($(SDDAS_TEST_DIR)/libPIDF,$(SRCS) $(SOURCES.h) $(OTHER_FILES) Imakefile)

pidf.lex.yy.o: 		pidf.lex.yy.c y.tab.h
	
pidf.y.tab.h pidf.y.tab.c:        pidf-parse.y
	$(YACC) -d pidf-parse.y
	sed -f sed_cmds y.tab.c > pidf.y.tab.c
	sed -f sed_cmds y.tab.h > pidf.y.tab.h

pidf.lex.yy.c:       	pidf.l
	$(LEX) -t pidf.l | sed -f sed_cmds > pidf.lex.yy.c

clean::
	$(RM) pidf.lex.yy.c pidf.y.tab.c pidf.y.tab.h y.tab.c y.tab.h checker/newRead.o

SDMakeSharedLibrary($(LIB_NAME),$(OBJS),1)
SDMakeSharedLibrary(newPidf,$(OBJS),1)
SDReleaseLib($(LIB_NAME))
SDReleaseLib(newPidf)
SDReleaseLib(chkPidf)

AllTarget (dump_pidf$(EXTENSION))
NormalProgramTarget (dump_pidf,dump_pidf.o,lib$(LIB_NAME).a,NullParameter,NullParameter)
NormalProgramTarget (unitsList,unitsList.o,lib$(LIB_NAME).a,NullParameter,NullParameter)
SDReleaseProgram (dump_pidf)