# include the general makefiles using this directive

GENERALROOT=../../../
MAKEROOT=../

-include $(GENERALROOT)/general/makefile.all

# the following directive is mandatory in order to get all local stuff into this level
ifeq "$(MAKELEVEL)" "0"

SRCS_ENC = dynamicProdMetadataFrameWriter.c intracodedProdMetadataFrameWriter.c encPmcWriter.c encPmfReader.c encPmfWriter.c prodMetadataConfigWriter.c
SRCS_ENC += prodmetadataEncoder.c prodMetadataFrameWriter.c singleDynamicProdMetadataFrameWriter.c omfReader.c printHelper.c

SRCDIRS_ENC = ../src/prodmetadataEncoder
SRCDIRS_ENC += ../src/common

INCL_ENC = -I../src/prodmetadataEncoder -I../src/common -I../../writeonlybitbuf/include

COMLIBS_ENC += -lwriteonlybitbuf

OPTIONS_ENC += SRCDIRS="$(SRCDIRS_ENC)" INCL="$(INCL_ENC)" LIBPATH="$(LIBPATH)" SYSLIBS="" INCLDEP=1 DEFFLAGS="$(DEFFLAGS)" PLOT="$(PLOT)" GPROF="$(GPROF)" GLOBOPTS="$(GLOBOPTS)"

SRCS_DEC = dynamicProdMetadataFrameReader.c intracodedProdMetadataFrameReader.c decPmcReader.c decPmfReader.c prodMetadataConfigReader.c
SRCS_DEC += prodmetadataDecoder.c prodMetadataFrameReader.c singleDynamicProdMetadataFrameReader.c omfReader.c printHelper.c

SRCDIRS_DEC = ../src/prodmetadataDecoder
SRCDIRS_DEC += ../src/common

INCL_DEC = -I../src/prodmetadataDecoder -I../src/common -I../../readonlybitbuf/include

COMLIBS_DEC += -lreadonlybitbuf

OPTIONS_DEC += SRCDIRS="$(SRCDIRS_DEC)" INCL="$(INCL_DEC)" LIBPATH="$(LIBPATH)" SYSLIBS="" INCLDEP=1 DEFFLAGS="$(DEFFLAGS)" PLOT="$(PLOT)" GPROF="$(GPROF)" GLOBOPTS="$(GLOBOPTS)"

# MAKEFILE RULES AND DEPENDENCIES ######################################
# the first rule `all' has to depend from makefile.all
all: $(GENERALROOT)/general/makefile.all prodmetadataEncoder prodmetadataDecoder

prodmetadataEncoder:
	@echo DEFFLAGS="$(DEFFLAGS)"
	@$(MAKE) TARGET=$@ $(OPTIONS_ENC) COMLIBS="$(COMLIBS_ENC)" SYSLIBS="" CFLAGS="$(CFLAGS)" SRCS="$(SRCS_ENC)" binary

prodmetadataDecoder:
	@echo DEFFLAGS="$(DEFFLAGS)"
	@$(MAKE) TARGET=$@ $(OPTIONS_DEC) COMLIBS="$(COMLIBS_DEC)" SYSLIBS="" CFLAGS="$(CFLAGS)" SRCS="$(SRCS_DEC)" binary

clean:
	@$(MAKE) TARGET="prodmetadataEncoder prodmetadataDecoder" SRCS="$(SRCS)" clean

clean_all:
	@$(MAKE) TARGET="prodmetadataEncoder prodmetadataDecoder" OBJS="$(OBJS)" COMLIBS="$(COMLIBS)" clean

endif

