﻿#****************************************************************************
#
# Copyright 2013-2014,2017 Altera Corporation. All Rights Reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# 
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# 
#****************************************************************************

#
# $Id: 46da6099c6a8f3e456adbb2916895883cf3730f6 $
#

ALT_DEVICE := AGILEX

#COMPILER := GNU
COMPILER := ARMCLANG

USE_UART := true

ifeq ($(USE_UART),true)
 PRINT_FLAGS := -DPRINTF_UART -DRELEASE
 #PRINT_FILES := alt_printf.c alt_16550_uart.c alt_p2uart.c
 UART_CH := 0
else
 PRINT_FLAGS := -DPRINTF_HOST
endif

ifeq ($(PLATFORM),SIMICS)
 PLATFORM_FLAGS := -DSIMICS
endif

#HWLIBS_SRC  := alt_clock_manager.c alt_cache.c alt_interrupt.c alt_timers.c alt_a53_timers.c alt_watchdog.c alt_spi.c alt_ethernet.c alt_eth_phy_ksz9031.c $(PRINT_FILES)
HWLIBS_SRC  := alt_clock_manager.c alt_cache.c alt_interrupt.c alt_timers.c alt_watchdog.c alt_a53_timers.c $(PRINT_FILES) minimal_io_armcc.c
EXAMPLE_SRC := hwlib.c stack_chk.c 
SAFECLIB_SRC := memcpy_s.c safe_str_constraint.c ignore_handler_s.c mem_primitives_lib.c safe_mem_constraint.c

BASE_INCLUDES := -Ilib
ELF	?= test

C_SRC           := $(EXAMPLE_SRC) $(HWLIBS_SRC) $(SAFECLIB_SRC)
COMPILE_FLAGS   := -DALT_DEBUG_ETHERNET $(PRINT_FLAGS) $(PLATFORM_FLAGS) -D_USE_STDLIB -fstack-protector-strong

include Makefile.inc
