# Makefile
# makefile for L1 Processor

GOAL = ./../../bin/L1Processor
SRCS = IngestTelemetry.C CalibrateRadiances.C PostProcInL1.C L1Processor.C
OBJS = ${SRCS:.C=.o}
INCS =  -I$(HDFEOS5_INC) -I$(HDF5INC) -I$(HDFEOS_INC) -I$(HDFINC) -I$(PGSINC) -I. \
        -I./../diagnostics -I./../time -I./../file -I./../l0 \
        -I./../hdf -I./../science -I./../mopip -I./../engineering -I./../table -I./../metadata -I./../mopch \
        -I./../mopir -I./../parameters -I./../calibrations -I./../mop01 -I./../swath -I./../mopes \
        -I./../earthviews -I./../mopq1 -I./../parameters
LIBS =  -L./../table -lTable -L./../engineering -lEngineering -L./../mopip -lMOPIP -L./../parameters -lParameters \
	-L./../earthviews -lEarthviews -L./../calibrations -lCalibrations -L./../mopir -lMOPIR -L./../mop01 -lMOP01 \
	-L./../swath -lSwath -L./../mopq1 -lMOPQ1 -L./../diagnostics -lDiagnostics \
	-L./../time -lMOPITTTime -L./../l0 -lL0 -L./../mopes -lMOPES -L./../science -lScience  -L./../mopch -lMOPCH \
	-L./../hdf -lHDF -L./../metadata -lMetadata -L./../file -lFile \
        -L$(JPEGLIB) -ljpeg  \
	-L$(PGSLIB) -lPGSTK -L$(HDFLIB) -lmfhdf -ldf -lm -lz  -L$(SZLIB) -lsz -L$(HDF5LIB) -lhdf5_hl -lhdf5 -lblas -ldl \
	-L$(HDFEOS_LIB) -lhdfeos -lGctp -L$(HDFEOS5_LIB) -lhe5_hdfeos -lGctp 

# define C preprocessor symbols
DFLAGS  = -D$(HDFSYS)

CFLAGS = -DLINUX64 -mtune=nocona -m64 -ansi -c -g
LINKFLAGS = -DLINUX64 -mtune=nocona -m64 -ansi
CC = g++

.C.o:
	$(CC) $(CFLAGS) $(DFLAGS) $< $(INCS)

debug:
	make tidy exec "CFLAGS=$(CFLAGS) -g" clean

warn:
	make tidy exec "CFLAGS=$(CFLAGS) -fullwarn -g" clean

exec:   $(OBJS)
	$(CC) $(LINKFLAGS) $(DFLAGS) -o $(GOAL) $(OBJS) $(LIBS)

system:	diagnostics time file l0 hdf table science mopip engineering metadata mopch mopir parameters calibrations \
        mop01 swath mopes earthviews mopq1 exec clean

pastsci:	mopip engineering metadata mopch mopir parameters calibrations mop01 swath mopes earthviews \
                mopq1 debug

pastmopir:	parameters calibrations mop01 swath mopes earthviews mopq1 all 

pastcal:	mop01 swath mopes earthviews mopq1 all

clean:
	rm -f $(OBJS)

tidy:
	rm -f $(OBJS) $(GOAL)

lint:
	lint -mux $(SRCS) $(INCS)

calibrations:
	cd ./../calibrations; make all

diagnostics:
	cd ./../diagnostics; make all

earthviews:
	cd ./../earthviews; make all

engineering:
	cd ./../engineering; make all

file:
	cd ./../file; make all

hdf:
	cd ./../hdf; make all 

l0:
	cd ./../l0; make all

metadata:
	cd ./../metadata; make all

mop01:
	cd ./../mop01; make all

mopch:
	cd ./../mopch; make all

mopes:
	cd ./../mopes; make all

mopip:
	cd ./../mopip; make all

mopir:
	cd ./../mopir; make all

mopq1:
	cd ./../mopq1; make all

parameters:
	cd ./../parameters; make all

science:
	cd ./../science; make all

swath:
	cd ./../swath; make  all

table:
	cd ./../table; make all

time:
	cd ./../time; make all
