#-*-makefile-*-
# Usage: gmake [<general options>] [AAC_PP=0]

include ../general/makefile.all

ifeq "$(MAKELEVEL)" "0"

OBJS_AAC_QC  = aac_qc.o aac_se_enc.o aac_back_pred.o tns.o mc_enc.o ms.o is.o \
               nok_ltp_enc.o nok_pitch.o drc.o
OBJS_PSYCH   = psych.o
OBJS_AAC_ENC = util.o transfo.o imdct.o

# Some compile flag definitions:
# -DMPEG4V1 : include MPEG4 AAC extensions.
# -DSRS : include gain control.
# -DPULSE : include pulse coding in encoder.
override DEFFLAGS += -DSRS -DDOUBLE_WIN -DDOLBY_MDCT -DOLD_PRED_PARAMS -DPLOTMTV

ifndef AAC_PP
AAC_PP = 1
endif
ifeq "$(AAC_PP)" "1"
override DEFFLAGS += -DSON_AAC_PP
OBJS_SON_AACPP_ENC = son_gc_common.o son_gc_detecter.o son_gc_etc_enc.o son_pqf.o son_gc_modifier.o son_gc_pack.o son_pqf_common.o son_gc_detectreset.o
#LIBS_SON_AACPP_ENC = -lpqf_son_NBCpp -lgain_son_NBCpp
LIBS_SON_AACPP_ENC = 
endif

OBJS_ENC_TF = $(OBJS_AAC_ENC) enc_tf.o  $(OBJS_T2F_ENC)  $(OBJS_AAC_QC) $(OBJS_PSYCH) $(OBJS_VQ_ENC) $(OBJS_SON_AACPP_ENC) $(OBJS_MOT_QC) 
LIBS_ENC_TF = $(LIBS_T2F_ENC) $(LIBS_VQ) $(LIBS_SON_AACPP_ENC)

#include makefile.tf

OBJS_COM = common.o cmdline.o bitstream.o audio.o austream.o plotmtv_interf.o
OBJS_ENC = encoder.o $(OBJS_COM) $(OBJS_ENC_PAR) $(OBJS_ENC_LPC) $(OBJS_ENC_TF)
LIBS_ENC = $(LIBS_ENC_PAR) $(LIBS_ENC_LPC) $(LIBS_ENC_TF)

# local lib tsp (AFSp library) not used anymore; to be removed at this cvs locally
SRCDIRS = src
OPTIONS = SRCDIRS="$(SRCDIRS)" LIBS="$(LIBS_ENC)" DEFFLAGS="$(DEFFLAGS)" INCLDEP=1

.PHONY: all enc clean

all: enc

enc:
	@$(MAKE) $(OPTIONS) OBJS="$(OBJS_ENC)" ENCODE=1 TARGET=$@ binary

clean:
	@$(MAKE)            OBJS="$(OBJS_ENC)" ENCODE=1 TARGET=enc $@

endif # ifeq "$(MAKELEVEL)" "0"
