<?xml version="1.0" encoding="UTF-8"?>
<model version="4.5.1" links="0">
 <documentation>Simple Blinky example for QP/C++, which demonstrates:
- Active object (Blinky) with state machine
- Board Support Package abstraction for portability
- BSP implementation for desktop OS (Windows, Linux, Mac)
- Platform-independent main() function
- make.bat batch file for Windows</documentation>
 <framework name="qpcpp"/>
 <package name="AOs" stereotype="0x02">
  <class name="Mission" superclass="qpcpp::QActive">
   <attribute name="m_timeEvt" type="QP::QTimeEvt" visibility="0x02" properties="0x00"/>
   <attribute name="StateTIMEOUT" type="QP::QTimeEvt" visibility="0x00" properties="0x00"/>
   <attribute name="MissionQ" type="QP::QEQueue" visibility="0x00" properties="0x01"/>
   <operation name="Mission" type="" visibility="0x00" properties="0x00">
    <documentation>Blinky constructor</documentation>
    <code>  : QActive(Q_STATE_CAST(&amp;Mission::initial)),
    m_timeEvt(this, TIMEOUT_SIG, 0U)</code>
   </operation>
   <statechart properties="0x00">
    <initial target="../7">
     <action brief="StartMission">// arm the private time event to expire in 1/2s
// and periodically every 1/2 second
m_timeEvt.armX(BSP::TICKS_PER_SEC/2,
               BSP::TICKS_PER_SEC/2);
(void)e; // unused parameter</action>
     <initial_glyph conn="33,11,5,3,11">
      <action box="-1,-3,10,2"/>
     </initial_glyph>
    </initial>
    <state name="InitProfile">
     <documentation>Start CTD periodic FP command</documentation>
     <entry>initProfile();</entry>
     <tran trig="IPDone" target="../../2">
      <tran_glyph conn="54,62,2,0,3">
       <action box="-6,1,10,2"/>
      </tran_glyph>
     </tran>
     <state_glyph node="44,54,21,8">
      <entry box="1,2,6,2"/>
     </state_glyph>
    </state>
    <state name="FindNeutralBuoyancy">
     <entry>startNegativeBuoyancy();
startSendFPTimer();</entry>
     <exit>startPVController(FPMode);</exit>
     <tran trig="TIMEOUT" target="../../6">
      <tran_glyph conn="50,79,2,0,4">
       <action box="-7,0,10,2"/>
      </tran_glyph>
     </tran>
     <state name="CheckDepthFNB">
      <tran trig="FoundNeutral" target="../../../6">
       <tran_glyph conn="75,75,2,0,8">
        <action box="0,2,12,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="67,69,17,6"/>
     </state>
     <state_glyph node="44,65,44,14">
      <entry box="1,2,20,6"/>
      <exit box="1,8,21,5"/>
     </state_glyph>
    </state>
    <state name="EmergencyAscend">
     <tran trig="atSurfaceRecovery" target="../../4">
      <tran_glyph conn="28,41,1,3,16">
       <action box="1,-2,13,2"/>
      </tran_glyph>
     </tran>
     <state_glyph node="3,37,25,8"/>
    </state>
    <state name="RecoverySurfaceOps">
     <entry>printf(&quot;Entering RecoverySurfaceOps State&quot;);
Sleep(1000);</entry>
     <tran trig="GotGo" target="../../1">
      <tran_glyph conn="54,50,2,0,4">
       <action box="-5,1,7,2"/>
      </tran_glyph>
     </tran>
     <state name="DownloadSBD_Rec">
      <tran trig="RestartMission" target="../../../1">
       <tran_glyph conn="125,49,2,1,7,-60">
        <action box="-15,5,12,2"/>
       </tran_glyph>
      </tran>
      <tran trig="GotNewMissionCmd" target="../../../5">
       <tran_glyph conn="126,43,0,1,-16,-61">
        <action box="-20,-16,20,2"/>
       </tran_glyph>
      </tran>
      <tran trig="SO_TIMEOUT_Rec" target="../../4">
       <tran_glyph conn="135,47,1,0,8,-9,-88,5">
        <action box="-8,-9,15,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="116,43,19,6"/>
     </state>
     <state name="BuildSBD_Rec">
      <tran trig="SBDBuiltRec" target="../../3">
       <tran_glyph conn="81,43,0,0,-2,13,2">
        <action box="4,-4,10,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="68,43,17,6"/>
     </state>
     <state name="UploadSBD_Rec">
      <entry>sendCR(4, true);</entry>
      <tran trig="SBDUploadedRec" target="../../1">
       <tran_glyph conn="101,43,0,0,-2,18,2">
        <action box="3,-4,14,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="89,43,16,6">
       <entry box="1,2,6,2"/>
      </state_glyph>
     </state>
     <state name="GetPositionRec">
      <tran trig="GotPositionRec" target="../../2">
       <tran_glyph conn="59,43,0,0,-2,13,2">
        <action box="2,-4,13,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="51,43,11,6"/>
     </state>
     <state_glyph node="44,35,103,15">
      <entry box="1,2,6,2"/>
     </state_glyph>
    </state>
    <state name="InitMission">
     <entry>initMission();</entry>
     <tran trig="IMDone" target="../../4">
      <tran_glyph conn="54,29,2,0,6">
       <action box="-6,1,10,2"/>
      </tran_glyph>
     </tran>
     <tran trig="StateTIMEOUT" target="../../4">
      <tran_glyph conn="56,29,2,0,6">
       <action box="0,1,10,2"/>
      </tran_glyph>
     </tran>
     <state_glyph node="44,21,21,8">
      <entry box="1,2,15,4"/>
     </state_glyph>
    </state>
    <state name="Descend">
     <documentation>Look for park depths
Look for anchor
</documentation>
     <tran trig="TIMEOUT" target="../../12">
      <tran_glyph conn="53,101,2,0,21">
       <action box="-8,2,8,2"/>
      </tran_glyph>
     </tran>
     <tran trig="FatalError(most states will have this)" target="../../3">
      <tran_glyph conn="44,94,3,2,-31,-49">
       <action box="-28,-2,28,3"/>
      </tran_glyph>
     </tran>
     <state name="CheckDepthAndTimeDescend">
      <tran trig="AtParkPt" target="../../../10">
       <tran_glyph conn="71,98,2,3,20,26">
        <action box="8,18,10,2"/>
       </tran_glyph>
      </tran>
      <tran trig="SampleInstr" target="../../../9">
       <tran_glyph conn="74,93,1,0,21,-7,51,39">
        <action box="4,-2,13,2"/>
       </tran_glyph>
      </tran>
      <tran trig="HitBottom" target="../../../11">
       <tran_glyph conn="74,96,1,3,23">
        <action box="4,0,12,2"/>
       </tran_glyph>
      </tran>
      <tran trig="DescendDone" target="../../../12">
       <tran_glyph conn="57,98,2,0,24">
        <action box="1,5,13,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="47,90,27,8"/>
     </state>
     <state_glyph node="44,83,47,18"/>
    </state>
    <state name="InitPlatform">
     <entry>initPlatform();</entry>
     <tran trig="IPDone" target="../../5">
      <tran_glyph conn="54,13,2,0,8">
       <action box="-6,2,10,2"/>
      </tran_glyph>
     </tran>
     <tran trig="StateTIMEOUT" target="../../5">
      <tran_glyph conn="60,13,2,0,8">
       <action box="0,2,10,2"/>
      </tran_glyph>
     </tran>
     <state_glyph node="44,5,34,8">
      <entry box="1,2,24,4"/>
     </state_glyph>
    </state>
    <state name="SurfaceOps">
     <state name="BuildSBD_SO">
      <tran trig="SO_SBDBuilt" target="../../1">
       <tran_glyph conn="99,162,0,0,-2,11,2">
        <action box="5,-4,11,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="87,162,17,6"/>
     </state>
     <state name="UploadSBD_SO">
      <tran trig="SO_SBDUploaded" target="../../2">
       <tran_glyph conn="117,162,0,0,-2,18,2">
        <action box="3,-4,15,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="107,162,16,6"/>
     </state>
     <state name="DownloadSBD_SO">
      <tran trig="SO_SBDUploaded" target="../../3/1">
       <tran_glyph conn="149,166,1,3,4,5,-100,9,9">
        <action box="-11,3,16,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="130,162,19,6"/>
     </state>
     <state name="UploadFileActions">
      <tran trig="SOGotNewMission" target="../../../5">
       <tran_glyph conn="130,183,1,1,47,-159,-112">
        <action box="28,-2,16,2"/>
       </tran_glyph>
      </tran>
      <state name="Action1">
       <tran trig="Action1Done" target="../../2">
        <tran_glyph conn="69,182,2,2,3,18,-3">
         <action box="6,1,10,2"/>
        </tran_glyph>
       </tran>
       <state_glyph node="62,176,15,6"/>
      </state>
      <state name="Action2">
       <tran trig="Action2Done" target="../../3">
        <tran_glyph conn="92,182,2,2,3,16,-3">
         <action box="3,1,10,2"/>
        </tran_glyph>
       </tran>
       <state_glyph node="83,176,15,6"/>
      </state>
      <state name="Action3">
       <tran trig="SODone" target="../../../../1">
        <tran_glyph conn="119,179,1,1,53,-120,-107">
         <action box="39,-2,12,2"/>
        </tran_glyph>
       </tran>
       <state_glyph node="102,176,17,6"/>
      </state>
      <state_glyph node="59,173,71,14"/>
     </state>
     <state name="GetAirSamples">
      <tran trig="AirSamplesDone" target="../../5">
       <tran_glyph conn="57,162,0,0,-2,15,2">
        <action box="2,-4,11,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="45,162,17,6"/>
     </state>
     <state name="GetPositionSO">
      <tran trig="GotSOPosition" target="../../0">
       <tran_glyph conn="77,162,0,0,-2,14,2">
        <action box="3,-4,10,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="68,162,13,6"/>
     </state>
     <state_glyph node="42,154,115,34"/>
    </state>
    <state name="GetSamples">
     <entry>sendSampleCommands();</entry>
     <state name="LogResponses">
      <state_glyph node="141,133,21,9"/>
     </state>
     <state_glyph node="135,125,31,18">
      <entry box="1,2,21,4"/>
     </state_glyph>
    </state>
    <state name="Park">
     <entry>stopPVController();
startDepthController();</entry>
     <state name="CheckDepthAndTimePark">
      <tran trig="SampleInstr" target="../../../9">
       <tran_glyph conn="115,127,2,3,8,20">
        <action box="4,4,13,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="102,120,23,7"/>
     </state>
     <state_glyph node="97,112,31,18">
      <entry box="1,2,17,7"/>
     </state_glyph>
    </state>
    <state name="Anchor">
     <entry>stopPVController();</entry>
     <state name="CheckDepthAndTimeAnchor">
      <tran trig="SampleInstr" target="../../../9">
       <tran_glyph conn="123,104,1,0,19,21">
        <action box="8,-2,13,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="99,99,24,7"/>
     </state>
     <state_glyph node="97,91,31,18">
      <entry box="1,2,19,4"/>
     </state_glyph>
    </state>
    <state name="ASCEND">
     <documentation>Look for park depths
Look for anchor
</documentation>
     <entry>stopSendFPTimer();
startCPMode();
startPVController(CPMode);</entry>
     <tran trig="TIMEOUT" target="../../8">
      <tran_glyph conn="52,144,2,0,10">
       <action box="-8,2,8,2"/>
      </tran_glyph>
     </tran>
     <state name="CheckDepthAndTimeAscend">
      <tran trig="AtParkPt" target="../../../10">
       <tran_glyph conn="73,137,1,2,32,-7">
        <action box="18,-2,10,2"/>
       </tran_glyph>
      </tran>
      <tran trig="SampleInstr" target="../../../9">
       <tran_glyph conn="73,140,1,3,62">
        <action box="18,-2,13,2"/>
       </tran_glyph>
      </tran>
      <tran trig="AtSurface" target="../../../8">
       <action>stopPVController();</action>
       <tran_glyph conn="56,142,2,0,12">
        <action box="1,5,13,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="46,134,27,8"/>
     </state>
     <state_glyph node="44,122,43,22">
      <entry box="1,2,24,9"/>
     </state_glyph>
    </state>
    <state name="Questions">
     <entry brief="1. FNB and CheckDepthAndTimeXXX runs when a new depth shows up.&#10;2. GetSamples state needs to run in parallel with descend, ascend, park, anchor&#10;3. Need a send command, wait, resend, get response sub-state machine (maybe an AO?)&#10;4. Is there a QP best practices way to deal with errors? &#10;5. Should UploadFiles be an AO or ???&#10;6. What activities go on in parallel?&#10;7. Why .h sometimes and .hpp others&#10;8.&#10;9.&#10;"/>
     <state_glyph node="193,59,73,24">
      <entry box="1,2,71,20"/>
     </state_glyph>
    </state>
    <state_diagram size="337,199"/>
   </statechart>
  </class>
  <class name="Controllers" superclass="qpcpp::QHsm"/>
  <class name="Logger" superclass="qpcpp::QActive"/>
  <class name="UploadFile" superclass="qpcpp::QActive"/>
  <class name="ErrorHandler" superclass="qpcpp::QActive"/>
 </package>
 <directory name=".">
  <file name="Mission.cpp" codec="UTF-8">
   <text>#include &quot;qpcpp.h&quot; // QP/C++ framework API
#include &quot;bsp.h&quot;   // Board Support Package interface

#include &lt;Windows.h&gt;
#include &lt;stdio.h&gt;

using namespace QP;

// ask QM to declare the Mission class ----------------------------------------
$declare${AOs::Mission}

// instantiate the Mission active object --------------------------------------
static Mission l_mission;
QActive * const AO_Mission = &amp;l_mission;

// ask QM to define the Mission class (including the state machine) -----------
$define${AOs::Mission}</text>
  </file>
  <file name="bsp.h">
   <text>#ifndef BSP_H
#define BSP_H

// a very simple Board Support Package (BSP) -----========--------------------
class BSP {
public:
    enum { TICKS_PER_SEC = 100 }; // numer of clock ticks in a second
    static void init(void);
    static void ledOff(void);
    static void ledOn(void);
};

enum MissionSignals {
    TIMEOUT_SIG = QP::Q_USER_SIG, // offset the first signal
    IPDone_SIG,
    IMDone_SIG,
    GotPositionRec_SIG,
    SBDBuiltRec_SIG,
    SBDUploadedRec_SIG,
    SO_TIMEOUT_Rec_SIG,
    GotNewMissionRec_SIG,
    RestartMission_SIG,
    CheckDepthFNB_SIG,
    StartDescend_SIG,
    atSurfaceRecovery_SIG,
    GotGo_SIG,
    ProfileSampleInstr_SIG,
    DescParkTIMEOUT_SIG,
    ParkCheckDandT_SIG,
    AtParkPt_SIG,
    SampleInstr_SIG,
    HitBottom_SIG,
    ProfileDone_SIG,
    DoneSampling_SIG,
    AnchorOffBottom_SIG,
    AnchorCheckDandT_SIG,
    ProfileVelCtrlrStarted_SIG,
    SO_SBDBuilt_SIG,
    SO_SBDUploaded_SIG,
    GotSOPosition_SIG,
    SOGotNewMission_SIG,
    Action1Done_SIG,
    Action2Done_SIG,
    SODone_SIG,
    NeedToDescend_SIG,
    FNB_CheckDepthTIMEOUT_SIG,
    FoundNeutral_SIG,
    FNBDescending_SIG,
    StateTIMEOUT_SIG,
    MAX_SIG
};

// active object(s) used in this application -------------------------------
extern QP::QActive * const AO_Mission; // opaque pointer to the Blinky AO

#endif // BSP_H</text>
  </file>
  <file name="bsp.cpp">
   <text>#include &quot;qpcpp.h&quot;  // QP/C++ framework API
#include &quot;bsp.h&quot;    // Board Support Package interface
#include &lt;iostream&gt; // for cout/cerr
#include &lt;cstdlib&gt;  // for exit()

using namespace std;
using namespace QP;

void BSP::init(void)   {
    cout &lt;&lt; &quot;Simple Mission example\nQP/C++ version: &quot;
         &lt;&lt; QP_VERSION_STR
         &lt;&lt; &quot;\nPress Ctrl-C to quit...&quot;
         &lt;&lt; endl; // print QP version
}
void BSP::ledOff(void) { cout &lt;&lt; &quot;LED OFF&quot; &lt;&lt; endl; }
void BSP::ledOn(void)  { cout &lt;&lt; &quot;LED ON&quot; &lt;&lt; endl;  }

// callback functions needed by the framework --------------------------------
void QF::onStartup(void) {}
void QP::QF::onCleanup(void) {}
void QP::QF_onClockTick(void) {
    QF::TICK_X(0U, 0); // QF clock tick processing for rate 0
}
void Q_onAssert(char const * const module, int loc) {
    cerr &lt;&lt; &quot;Assertion failed in &quot; &lt;&lt;  module &lt;&lt; &quot;:&quot; &lt;&lt; loc &lt;&lt; endl;
    exit(-1);
}</text>
  </file>
  <file name="main.cpp">
   <text>#include &quot;qpcpp.h&quot; // QP/C++ framework API
#include &quot;bsp.h&quot;   // Board Support Package interface

#include &quot;sbe41CTD.h&quot;

using namespace QP;

// the main function ---------------------------------------------------------
int main() {
    QF::init();  // initialize the framework
    BSP::init(); // initialize the BSP

    // start the Mission active object
    static QEvt const *mission_queueSto[10]; // event queue buffer for Mission
    AO_Mission-&gt;start(1U, // priority of the active object
        mission_queueSto, // event queue buffer
        Q_DIM(mission_queueSto), // the length of the buffer
        (void *)0, 0U);  // private stack (not used on the desktop)

    return QF::run(); // let the framework run the application
}</text>
  </file>
  <file name="Makefile">
   <text># Makefile for building QP/C application on Windows and POSIX hosts
#
# examples of invoking this Makefile:
# building configurations: Debug (default), Release, and Spy
# make
# make CONF=rel
# make CONF=spy
# make clean   # cleanup the build
# make CONF=spy clean   # cleanup the build
#
# NOTE:
# To use this Makefile on Windows, you will need the GNU make utility, which
# is included in the QTools collection for Windows, see:
#    http://sourceforge.net/projects/qpc/files/QTools/
#

#-----------------------------------------------------------------------------
# project name:
#
PROJECT := mission

#-----------------------------------------------------------------------------
# project directories:
#

# list of all source directories used by this project
VPATH := . \

# list of all include directories needed by this project
INCLUDES := -I. \

# location of the QP/C framework (if not provided in an env. variable)
ifeq ($(QPCPP),)
QPCPP := ../../..
endif

#-----------------------------------------------------------------------------
# project files:
#

# C source files...
C_SRCS :=

# C++ source files...
CPP_SRCS := \
    Mission.cpp \
    bsp.cpp \
    main.cpp

LIB_DIRS  :=
LIBS      :=

# defines...
# QP_API_VERSION controls the QP API compatibility; 9999 means the latest API
DEFINES   := -DQP_API_VERSION=9999

ifeq (,$(CONF))
    CONF := dbg
endif

#-----------------------------------------------------------------------------
# add QP/C++ framework (depends on the OS this Makefile runs on):
#
ifeq ($(OS),Windows_NT)

# NOTE:
# For Windows hosts, you can choose:
# - the single-threaded QP/C++ port (win32-qv) or
# - the multithreaded QP/C++ port (win32).
#
QP_PORT_DIR := $(QPCPP)/ports/win32-qv
#QP_PORT_DIR := $(QPCPP)/ports/win32
LIB_DIRS += -L$(QP_PORT_DIR)/$(CONF)
LIBS     += -lqp -lws2_32

else

# NOTE:
# For POSIX hosts (Linux, MacOS), you can choose:
# - the single-threaded QP/C++ port (win32-qv) or
# - the multithreaded QP/C++ port (win32).
#
QP_PORT_DIR := $(QPCPP)/ports/posix-qv
#QP_PORT_DIR := $(QPCPP)/ports/posix

CPP_SRCS += \
    qep_hsm.cpp \
    qep_msm.cpp \
    qf_act.cpp \
    qf_actq.cpp \
    qf_defer.cpp \
    qf_dyn.cpp \
    qf_mem.cpp \
    qf_ps.cpp \
    qf_qact.cpp \
    qf_qeq.cpp \
    qf_qmact.cpp \
    qf_time.cpp \
    qf_port.cpp

QS_SRCS := \
    qs.cpp \
    qs_64bit.cpp \
    qs_rx.cpp \
    qs_fp.cpp \
    qs_port.cpp

LIBS += -lpthread

endif

#============================================================================
# Typically you should not need to change anything below this line

VPATH    += $(QPCPP)/src/qf $(QP_PORT_DIR)
INCLUDES += -I$(QPCPP)/include -I$(QPCPP)/src -I$(QP_PORT_DIR)

#-----------------------------------------------------------------------------
# GNU toolset:
#
# NOTE:
# GNU toolset (MinGW) is included in the QTools collection for Windows, see:
#     http://sourceforge.net/projects/qpc/files/QTools/
# It is assumed that %QTOOLS%\bin directory is added to the PATH
#
CC    := gcc
CPP   := g++
#LINK  := gcc    # for C programs
LINK  := g++   # for C++ programs

#-----------------------------------------------------------------------------
# basic utilities (depends on the OS this Makefile runs on):
#
ifeq ($(OS),Windows_NT)
    MKDIR      := mkdir
    RM         := rm
    TARGET_EXT := .exe
else ifeq ($(OSTYPE),cygwin)
    MKDIR      := mkdir -p
    RM         := rm -f
    TARGET_EXT := .exe
else
    MKDIR      := mkdir -p
    RM         := rm -f
    TARGET_EXT :=
endif

#-----------------------------------------------------------------------------
# build configurations...

ifeq (rel, $(CONF)) # Release configuration ..................................

BIN_DIR := build_rel
# gcc options:
CFLAGS  = -c -O3 -fno-pie -std=c99 -pedantic -Wall -Wextra -W \
    $(INCLUDES) $(DEFINES) -DNDEBUG

CPPFLAGS = -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \
    -fno-rtti -fno-exceptions \
    $(INCLUDES) $(DEFINES) -DNDEBUG

else ifeq (spy, $(CONF))  # Spy configuration ................................

BIN_DIR := build_spy

CPP_SRCS += $(QS_SRCS)
VPATH    += $(QPCPP)/src/qs

# gcc options:
CFLAGS  = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \
    $(INCLUDES) $(DEFINES) -DQ_SPY

CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \
    -fno-rtti -fno-exceptions \
    $(INCLUDES) $(DEFINES) -DQ_SPY

else # default Debug configuration .........................................

BIN_DIR := build

# gcc options:
CFLAGS  = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \
    $(INCLUDES) $(DEFINES)

CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \
    -fno-rtti -fno-exceptions \
    $(INCLUDES) $(DEFINES)

endif  # .....................................................................

LINKFLAGS := -no-pie

#-----------------------------------------------------------------------------
C_OBJS       := $(patsubst %.c,%.o,   $(C_SRCS))
CPP_OBJS     := $(patsubst %.cpp,%.o, $(CPP_SRCS))

TARGET_EXE   := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT)
C_OBJS_EXT   := $(addprefix $(BIN_DIR)/, $(C_OBJS))
C_DEPS_EXT   := $(patsubst %.o,%.d, $(C_OBJS_EXT))
CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS))
CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT))

# create $(BIN_DIR) if it does not exist
ifeq (&quot;$(wildcard $(BIN_DIR))&quot;,&quot;&quot;)
$(shell $(MKDIR) $(BIN_DIR))
endif

#-----------------------------------------------------------------------------
# rules
#

all: $(TARGET_EXE)

$(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT)
    $(CPP) $(CPPFLAGS) $(QPCPP)/include/qstamp.cpp -o $(BIN_DIR)/qstamp.o
    $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS)

$(BIN_DIR)/%.d : %.c
    $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $&lt; &gt; $@

$(BIN_DIR)/%.d : %.cpp
    $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $&lt; &gt; $@

$(BIN_DIR)/%.o : %.c
    $(CC) $(CFLAGS) $&lt; -o $@

$(BIN_DIR)/%.o : %.cpp
    $(CPP) $(CPPFLAGS) $&lt; -o $@

.PHONY : clean show

# include dependency files only if our goal depends on their existence
ifneq ($(MAKECMDGOALS),clean)
  ifneq ($(MAKECMDGOALS),show)
-include $(C_DEPS_EXT) $(CPP_DEPS_EXT)
  endif
endif

.PHONY : clean show

clean :
    -$(RM) $(BIN_DIR)/*.o \
    $(BIN_DIR)/*.d \
    $(TARGET_EXE)

show :
    @echo PROJECT      = $(PROJECT)
    @echo TARGET_EXE   = $(TARGET_EXE)
    @echo VPATH        = $(VPATH)
    @echo C_SRCS       = $(C_SRCS)
    @echo CPP_SRCS     = $(CPP_SRCS)
    @echo C_DEPS_EXT   = $(C_DEPS_EXT)
    @echo C_OBJS_EXT   = $(C_OBJS_EXT)
    @echo C_DEPS_EXT   = $(C_DEPS_EXT)
    @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT)
    @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT)
    @echo LIB_DIRS     = $(LIB_DIRS)
    @echo LIBS         = $(LIBS)
    @echo DEFINES      = $(DEFINES)

</text>
  </file>
  <file name="sbe41CTD.hpp" properties="external"/>
  <file name="ublox8GPS.hpp" properties="external"/>
 </directory>
</model>
