# SPDX-FileCopyrightText: Copyright (c) 2021-2022 KUNLUNXIN CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
ifeq ($(USE_INTERNAL_TEST),y)
  DEFINES += -DINTERNAL_TEST
  DWL_SRCS += software/linux/dwl/internal_test.c
endif

ifeq ($(SUPPORT_CACHE),y)
  DEFINES += -DSUPPORT_CACHE
  DWL_SRCS += software/linux/dwl/dwl_linux_cache.c
endif

ifeq ($(USE_ONL_SIM),y)
  DWL_SRCS += software/linux/dwl/dwl_dpi/vpu_dwl_dpi.c
  CFLAGS += -Icache/software/inc/
  DEFINES += -DASIC_ONL_SIM
endif

ifeq ($(SUPPORT_DEC400),y)
  DEFINES += -DSUPPORT_DEC400
endif

ifeq ($(PJPEG_CHECK_COEFF),y)
  DEFINES += -DCHECK_PJPEG_COEFF
endif

# list of used sourcefiles
SRC_DWL_HW = software/linux/dwl/dwl_linux.c \
             software/linux/dwl/dwl_linux_hw.c \
             software/linux/dwl/dwl_activity_trace.c \
             software/linux/dwl/dwl_buf_protect.c

SRC_DWL_SIMULATION := software/linux/dwl/dwl_pc.c \
                      software/linux/dwl/dwl_hw_core_array.c \
                      software/linux/dwl/dwl_hw_core.c \
                      software/linux/dwl/dwl_swhw_sync.c \
                      software/linux/dwl/dwl_activity_trace.c \
                      software/linux/dwl/dwl_buf_protect.c

SRC_DWL_OS_FREE := software/linux/dwl/dwl_x170_osfree.c \
                   software/linux/dwl/dwl_syncobj_osfree.c \
                   software/linux/dwl/hx170dec_osfree.c \
                   software/linux/dwl/vsi_string.c \
                   software/linux/dwl/dwl_buf_protect.c

#ifeq ($(findstring h264dec_osfree,$(MAKECMDGOALS)),h264dec_osfree)
#  DWL_SRCS += $(SRC_DWL_OS_FREE)
#else
ifeq ($(findstring h264dec_osfree,$(MAKECMDGOALS)),h264dec_osfree)
  DWL_SRCS += $(SRC_DWL_OS_FREE)
  CFLAGS +=-DNON_PTHREAD_H
else
ifeq ($(strip $(USE_MODEL_SIMULATION)),y)
  DWL_SRCS += $(SRC_DWL_SIMULATION)
else
  DWL_SRCS += $(SRC_DWL_HW)
endif
endif
#endif

