#
# Base qmake configuration for GCC on RTEMS
#
#
#
MAKEFILE_GENERATOR      = UNIX

QMAKE_PLATFORM          = rtems

include(unix.conf)
include(gcc-base-unix.conf)
include(g++-unix.conf)

rtems_bsp = $$(RTEMS_BSP)
isEmpty(rtems_bsp) {
    error("This qmakespec requires $RTEMS_BSP to be set")
}

rtems_compiler = $$(RTEMS_COMPILER)
isEmpty(rtems_compiler) {
    error("This qmakespec requires $RTEMS_COMPILER to be set")
}

isEmpty(RTEMS_CPU_FLAGS) {
    error("The qmakespec is expected to set \$\$RTEMS_CPU_FLAGS")
}

RTEMS_FLAGS = \
    -B$$rtems_bsp \
    -specs bsp_specs \
    -qrtems \
    $$RTEMS_CPU_FLAGS

QMAKE_CFLAGS_OPTIMIZE_FULL  = $$QMAKE_CFLAGS_OPTIMIZE
QMAKE_CFLAGS_OPTIMIZE_DEBUG = -O0 -g

QMAKE_CFLAGS_DEBUG      = $$QMAKE_CFLAGS_OPTIMIZE_DEBUG
QMAKE_CFLAGS_WARN_ON    = -Wall
QMAKE_CFLAGS_PIC        =
QMAKE_CFLAGS_SHLIB      =
QMAKE_CFLAGS_STATIC_LIB =
QMAKE_CFLAGS_APP        =
QMAKE_CFLAGS           += $$RTEMS_FLAGS

QMAKE_CXXFLAGS_DEBUG    = $$QMAKE_CFLAGS_DEBUG
QMAKE_CXXFLAGS_WARN_ON  = $$QMAKE_CFLAGS_WARN_ON
QMAKE_CXXFLAGS_SHLIB    =
QMAKE_CXXFLAGS_STATIC_LIB =
QMAKE_CXXFLAGS_APP      =
QMAKE_CXXFLAGS         += $$RTEMS_FLAGS

QMAKE_CXXFLAGS_CXX11    =
QMAKE_CXXFLAGS_CXX14    =
QMAKE_CXXFLAGS_CXX1Z    =

QMAKE_LFLAGS_GCSECTIONS = -Wl,--gc-sections
QMAKE_LFLAGS           += $$RTEMS_FLAGS $$QMAKE_LFLAGS_GCSECTIONS

QMAKE_CC                = $${rtems_compiler}-gcc
QMAKE_CXX               = $${rtems_compiler}-g++
QMAKE_AR                = $${rtems_compiler}-ar cqs
QMAKE_OBJCOPY           = $${rtems_compiler}-objcopy
QMAKE_NM                = $${rtems_compiler}-nm -P
QMAKE_RANLIB            = $${rtems_compiler}-ranlib
QMAKE_STRIP             = $${rtems_compiler}-strip

QMAKE_LINK_C            = $$QMAKE_CC
QMAKE_LINK_C_SHLIB      =

QMAKE_LINK              = $$QMAKE_CXX
QMAKE_LINK_SHLIB        =

load(qt_config)
