mirror of
https://github.com/espressif/openthread.git
synced 2026-06-06 05:24:51 +00:00
[makefile] update example platform makefiles
This commit makes the following changes to (platform) makefiles: - Removes conditional source file inclusions in Makefiles and adopts the model where the source files themselves would add `#if` check for the config option (this is the model adopted in OpenThread core). - Defines `PLATFORM_SOURCES` to include all the sources files - Adds `PRETTY_FILES` to specify files for "make pretty-check" This commit also adds `PRETTY_FILES` in unit test makefile.
This commit is contained in:
committed by
Jonathan Hui
parent
00299f2e91
commit
4207f41f91
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="openthread.configuration.props" />
|
||||
<Import Project="openthread.configuration.props" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{30723C38-BA3B-44C9-8D64-C5861A26934F}</ProjectGuid>
|
||||
<Keyword>StaticLibrary</Keyword>
|
||||
@@ -42,6 +42,7 @@
|
||||
_CRT_SECURE_NO_WARNINGS;
|
||||
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
||||
OPENTHREAD_FTD=1;
|
||||
OPENTHREAD_ENABLE_NCP_SPI=1;
|
||||
OTBUILD;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
|
||||
@@ -36,8 +36,9 @@ libopenthread_cc2538_a_CPPFLAGS = \
|
||||
-I$(top_srcdir)/src/core \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_cc2538_a_SOURCES = \
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
diag.c \
|
||||
flash.c \
|
||||
misc.c \
|
||||
platform.c \
|
||||
@@ -48,11 +49,9 @@ libopenthread_cc2538_a_SOURCES = \
|
||||
uart.c \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_ENABLE_DIAG
|
||||
libopenthread_cc2538_a_SOURCES += \
|
||||
diag.c \
|
||||
libopenthread_cc2538_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
noinst_HEADERS = \
|
||||
cc2538-reg.h \
|
||||
@@ -60,6 +59,11 @@ noinst_HEADERS = \
|
||||
rom-utility.h \
|
||||
$(NULL)
|
||||
|
||||
PRETTY_FILES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(noinst_HEADERS) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
libopenthread_cc2538_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
|
||||
#include "platform-cc2538.h"
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
/**
|
||||
* Diagnostics mode variables.
|
||||
*
|
||||
@@ -83,3 +85,5 @@ void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
@@ -34,7 +34,6 @@ lib_LIBRARIES = libopenthread-cc2650.a
|
||||
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
|
||||
|
||||
|
||||
libopenthread_cc2650_a_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src \
|
||||
@@ -46,8 +45,9 @@ libopenthread_cc2650_a_CPPFLAGS = \
|
||||
$(MBEDTLS_CPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_cc2650_a_SOURCES = \
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
diag.c \
|
||||
flash.c \
|
||||
misc.c \
|
||||
logging.c \
|
||||
@@ -62,20 +62,23 @@ libopenthread_cc2650_a_SOURCES = \
|
||||
cc2650_startup.c \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_cc2650_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_cc2650_a_DEPENDENCIES = \
|
||||
$(top_srcdir)/third_party/ti/devices/cc26x0/driverlib/bin/gcc/driverlib.a \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_ENABLE_DIAG
|
||||
libopenthread_cc2650_a_SOURCES += \
|
||||
diag.c \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
noinst_HEADERS = \
|
||||
platform-cc2650.h \
|
||||
$(NULL)
|
||||
|
||||
PRETTY_FILES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(noinst_HEADERS) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
libopenthread_cc2650_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
@@ -29,8 +29,11 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <openthread/config.h>
|
||||
#include <openthread/platform/diag.h>
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
/**
|
||||
* Diagnostics mode variables.
|
||||
*
|
||||
@@ -39,7 +42,7 @@ static bool sDiagMode = false;
|
||||
|
||||
void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOutput, size_t aOutputMaxLen)
|
||||
{
|
||||
// Add more plarform specific diagnostics features here.
|
||||
// Add more platform specific diagnostics features here.
|
||||
if (argc > 1)
|
||||
{
|
||||
snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", argv[0]);
|
||||
@@ -80,3 +83,5 @@ void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
@@ -45,8 +45,9 @@ libopenthread_cc2652_a_CPPFLAGS = \
|
||||
$(MBEDTLS_CPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_cc2652_a_SOURCES = \
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
diag.c \
|
||||
flash.c \
|
||||
logging.c \
|
||||
misc.c \
|
||||
@@ -60,20 +61,23 @@ libopenthread_cc2652_a_SOURCES = \
|
||||
cxx_helpers.c \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_cc2652_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_cc2652_a_DEPENDENCIES = \
|
||||
$(top_srcdir)/third_party/ti/devices/cc26x2/driverlib/bin/gcc/driverlib.a \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_ENABLE_DIAG
|
||||
libopenthread_cc2652_a_SOURCES += \
|
||||
diag.c \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
noinst_HEADERS = \
|
||||
platform-cc2652.h \
|
||||
$(NULL)
|
||||
|
||||
PRETTY_FILES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(noinst_HEADERS) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
libopenthread_cc2652_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
@@ -32,12 +32,15 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <openthread/config.h>
|
||||
#include <openthread/openthread.h>
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
#include "platform-cc2652.h"
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
/**
|
||||
* Diagnostics mode variables.
|
||||
*
|
||||
@@ -86,3 +89,5 @@ void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
@@ -73,6 +73,7 @@ libopenthread_efr32_a_CPPFLAGS =
|
||||
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
diag.c \
|
||||
flash.c \
|
||||
logging.c \
|
||||
misc.c \
|
||||
@@ -83,12 +84,6 @@ PLATFORM_SOURCES =
|
||||
uart.c \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_ENABLE_DIAG
|
||||
PLATFORM_SOURCES += \
|
||||
diag.c \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
nodist_libopenthread_efr32_a_SOURCES = \
|
||||
@top_builddir@/third_party/silabs/gecko_sdk_suite/v2.0/hardware/kit/common/bsp/bsp_bcc.c \
|
||||
@top_builddir@/third_party/silabs/gecko_sdk_suite/v2.0/hardware/kit/common/bsp/bsp_init.c \
|
||||
@@ -129,6 +124,7 @@ libopenthread_efr32_a_SOURCES =
|
||||
|
||||
PRETTY_FILES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(noinst_HEADERS) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
|
||||
#include "platform-efr32.h"
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
/**
|
||||
* Diagnostics mode variables.
|
||||
*
|
||||
@@ -88,3 +90,5 @@ void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
#endif // #if OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
@@ -38,12 +38,9 @@ libopenthread_gp712_a_CPPFLAGS = \
|
||||
-lpthread \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
libopenthread_gp712_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
libopenthread_gp712_a_SOURCES = \
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
diag.c \
|
||||
misc.c \
|
||||
logging.c \
|
||||
platform.c \
|
||||
@@ -53,15 +50,20 @@ libopenthread_gp712_a_SOURCES = \
|
||||
flash.c \
|
||||
$(NULL)
|
||||
|
||||
# uart-socket.c \
|
||||
# uart-socket.c \
|
||||
#
|
||||
|
||||
if OPENTHREAD_ENABLE_DIAG
|
||||
libopenthread_gp712_a_SOURCES += \
|
||||
diag.c \
|
||||
$(NULL)
|
||||
endif
|
||||
Dash = -
|
||||
libopenthread_gp712_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
libopenthread_gp712_a_SOURCES = \
|
||||
$(PLATFORM_SORUCES) \
|
||||
$(NULL)
|
||||
|
||||
PRETTY_FILES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_BUILD_COVERAGE
|
||||
CLEANFILES = $(wildcard *.gcda *.gcno)
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
/**
|
||||
* Diagnostics mode variables.
|
||||
*
|
||||
@@ -81,3 +83,5 @@ void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
@@ -50,6 +50,7 @@ libopenthread_kw41z_a_CPPFLAGS
|
||||
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
diag.c \
|
||||
flash.c \
|
||||
logging.c \
|
||||
misc.c \
|
||||
@@ -87,12 +88,6 @@ libopenthread_kw41z_a_SOURCES
|
||||
@top_builddir@/third_party/nxp/MKW41Z4/XCVR/cfgs_kw4x_3x_2x/fsl_xcvr_zgbe_config.c \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_ENABLE_DIAG
|
||||
PLATFORM_SOURCES += \
|
||||
diag.c \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
libopenthread_kw41z_a_SOURCES += \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
@@ -36,11 +36,14 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "openthread/config.h"
|
||||
#include "openthread/openthread.h"
|
||||
|
||||
#include "openthread/platform/alarm-milli.h"
|
||||
#include "openthread/platform/radio.h"
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
/**
|
||||
* Diagnostics mode variables.
|
||||
*
|
||||
@@ -86,3 +89,5 @@ void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
@@ -37,8 +37,9 @@ libopenthread_posix_a_CPPFLAGS = \
|
||||
-D_GNU_SOURCE \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_posix_a_SOURCES = \
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
diag.c \
|
||||
misc.c \
|
||||
logging.c \
|
||||
platform.c \
|
||||
@@ -46,27 +47,25 @@ libopenthread_posix_a_SOURCES = \
|
||||
random.c \
|
||||
uart-posix.c \
|
||||
flash.c \
|
||||
spi-stubs.c \
|
||||
sim/alarm-sim.c \
|
||||
sim/platform-sim.c \
|
||||
sim/radio-sim.c \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_ENABLE_DIAG
|
||||
libopenthread_posix_a_SOURCES += \
|
||||
diag.c \
|
||||
libopenthread_posix_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
if OPENTHREAD_ENABLE_NCP_SPI
|
||||
libopenthread_posix_a_SOURCES += \
|
||||
spi-stubs.c \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
noinst_HEADERS = \
|
||||
platform-posix.h \
|
||||
$(NULL)
|
||||
|
||||
PRETTY_FILES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(noinst_HEADERS) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
libopenthread_posix_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
/**
|
||||
* Diagnostics mode variables.
|
||||
*
|
||||
@@ -83,3 +85,5 @@ void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
@@ -31,9 +31,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <openthread/config.h>
|
||||
#include <openthread/platform/spi-slave.h>
|
||||
#include <openthread/platform/uart.h>
|
||||
|
||||
#if OPENTHREAD_ENABLE_NCP_SPI
|
||||
|
||||
// Spi-slave stubs
|
||||
|
||||
otError otPlatSpiSlaveEnable(otPlatSpiSlaveTransactionCompleteCallback aCompleteCallback,
|
||||
@@ -80,3 +83,5 @@ void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
|
||||
(void)aBuf;
|
||||
(void)aBufLength;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_NCP_SPI
|
||||
|
||||
@@ -97,6 +97,7 @@ libopenthread_samr21_a_CPPFLAGS
|
||||
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
diag.c \
|
||||
cxx_helpers.c \
|
||||
flash.c \
|
||||
logging.c \
|
||||
@@ -107,12 +108,6 @@ PLATFORM_SOURCES
|
||||
uart.c \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_ENABLE_DIAG
|
||||
PLATFORM_SOURCES += \
|
||||
diag.c \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
libopenthread_samr21_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
@@ -34,8 +34,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <openthread/config.h>
|
||||
#include <openthread/platform/diag.h>
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
/**
|
||||
* Diagnostics mode variables.
|
||||
*
|
||||
@@ -82,3 +85,5 @@ void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DIAG
|
||||
@@ -208,6 +208,31 @@ test_diag_LDADD = $(top_builddir)/src/diag/libopenthread-diag.a
|
||||
test_diag_SOURCES = test_diag.cpp
|
||||
endif
|
||||
|
||||
PRETTY_FILES = \
|
||||
$(test_address_sanitizer_SOURCES) \
|
||||
$(test_aes_SOURCES) \
|
||||
$(test_child_SOURCES) \
|
||||
$(test_heap_SOURCES) \
|
||||
$(test_hmac_sha256_SOURCES) \
|
||||
$(test_link_quality_SOURCES) \
|
||||
$(test_lowpan_SOURCES) \
|
||||
$(test_network_data_SOURCES) \
|
||||
$(test_mac_frame_SOURCES) \
|
||||
$(test_message_SOURCES) \
|
||||
$(test_message_queue_SOURCES) \
|
||||
$(test_ncp_buffer_SOURCES) \
|
||||
$(test_priority_queue_SOURCES) \
|
||||
$(test_pskc_SOURCES) \
|
||||
$(test_strlcat_SOURCES) \
|
||||
$(test_strlcpy_SOURCES) \
|
||||
$(test_strnlen_SOURCES) \
|
||||
$(test_spinel_decoder_SOURCES) \
|
||||
$(test_spinel_encoder_SOURCES) \
|
||||
$(test_timer_SOURCES) \
|
||||
$(test_toolchain_SOURCES) \
|
||||
$(test_diag_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_BUILD_COVERAGE
|
||||
CLEANFILES = $(wildcard *.gcda *.gcno)
|
||||
endif # OPENTHREAD_BUILD_COVERAGE
|
||||
|
||||
Reference in New Issue
Block a user