From ecf352bca9e68d7e1094ae7bde70e5045dee463e Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Mon, 25 Feb 2019 14:25:19 +0100 Subject: [PATCH] porting: Use wildcards in Makefiles This makes port build similar to when using newt tool which always builds all files in src/ folder. --- nimble/host/src/ble_eddystone.c | 1 + porting/examples/dummy/Makefile | 11 ++- porting/examples/linux/Makefile | 21 ++--- porting/examples/linux_blemesh/Makefile | 22 +++--- porting/nimble/Makefile.controller | 25 +----- porting/nimble/Makefile.defs | 77 +++---------------- porting/nimble/Makefile.mesh | 22 +----- porting/nimble/Makefile.tinycrypt | 7 +- .../linux/{src => include/nimble}/os_types.h | 0 9 files changed, 51 insertions(+), 135 deletions(-) rename porting/npl/linux/{src => include/nimble}/os_types.h (100%) diff --git a/nimble/host/src/ble_eddystone.c b/nimble/host/src/ble_eddystone.c index ec54d1330..7d80d134d 100644 --- a/nimble/host/src/ble_eddystone.c +++ b/nimble/host/src/ble_eddystone.c @@ -18,6 +18,7 @@ */ #include +#include "os/endian.h" #include "host/ble_eddystone.h" #include "host/ble_hs_adv.h" #include "ble_hs_priv.h" diff --git a/porting/examples/dummy/Makefile b/porting/examples/dummy/Makefile index 349523537..0cf476722 100644 --- a/porting/examples/dummy/Makefile +++ b/porting/examples/dummy/Makefile @@ -32,12 +32,19 @@ SIZE := $(CROSS_COMPILE)size # Configure NimBLE variables NIMBLE_ROOT := ../../.. NIMBLE_CFG_TINYCRYPT := 1 + +# Skip files that don't build for this port +NIMBLE_IGNORE := $(NIMBLE_ROOT)/nimble/host/src/ble_gatts_lcl.c \ + $(NIMBLE_ROOT)/porting/nimble/src/hal_timer.c \ + $(NIMBLE_ROOT)/porting/nimble/src/os_cputime.c \ + $(NIMBLE_ROOT)/porting/nimble/src/os_cputime_pwr2.c \ + $(NULL) + include $(NIMBLE_ROOT)/porting/nimble/Makefile.defs # Add dummy NPL, dummy HCI transport and all NimBLE sources to build SRC = \ - $(NIMBLE_ROOT)/porting/npl/dummy/src/npl_os_dummy.c \ - $(NIMBLE_ROOT)/porting/npl/dummy/src/hci_dummy.c \ + $(wildcard $(NIMBLE_ROOT)/porting/npl/dummy/src/*.c) \ $(NIMBLE_SRC) \ $(TINYCRYPT_SRC) \ main.c \ diff --git a/porting/examples/linux/Makefile b/porting/examples/linux/Makefile index 5538f2fee..faa959b66 100644 --- a/porting/examples/linux/Makefile +++ b/porting/examples/linux/Makefile @@ -13,20 +13,22 @@ SIZE := $(CROSS_COMPILE)size # Configure NimBLE variables NIMBLE_ROOT := ../../.. NIMBLE_CFG_TINYCRYPT := 1 + +# Skip files that don't build for this port +NIMBLE_IGNORE := $(NIMBLE_ROOT)/porting/nimble/src/hal_timer.c \ + $(NIMBLE_ROOT)/porting/nimble/src/os_cputime.c \ + $(NIMBLE_ROOT)/porting/nimble/src/os_cputime_pwr2.c \ + $(NULL) + include $(NIMBLE_ROOT)/porting/nimble/Makefile.defs -SRC := $(NIMBLE_SRC) +SRC := $(NIMBLE_SRC) # Source files for NPL OSAL SRC += \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_atomic.c \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_callout.c \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_eventq.cc \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_mutex.c \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_sem.c \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_task.c \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_time.c \ - $(NIMBLE_ROOT)/nimble/transport/socket/src/ble_hci_socket.c \ + $(wildcard $(NIMBLE_ROOT)/porting/npl/linux/src/*.c) \ + $(wildcard $(NIMBLE_ROOT)/porting/npl/linux/src/*.cc) \ + $(wildcard $(NIMBLE_ROOT)/nimble/transport/socket/src/*.c) \ $(TINYCRYPT_SRC) \ $(NULL) @@ -40,7 +42,6 @@ SRC += \ INC = \ ./include \ $(NIMBLE_ROOT)/porting/npl/linux/include \ - $(NIMBLE_ROOT)/porting/npl/linux/src \ $(NIMBLE_ROOT)/nimble/transport/socket/include \ $(NIMBLE_INCLUDE) \ $(TINYCRYPT_INCLUDE) \ diff --git a/porting/examples/linux_blemesh/Makefile b/porting/examples/linux_blemesh/Makefile index 8f9a18fc4..49f50447d 100644 --- a/porting/examples/linux_blemesh/Makefile +++ b/porting/examples/linux_blemesh/Makefile @@ -13,21 +13,23 @@ SIZE := $(CROSS_COMPILE)size # Configure NimBLE variables NIMBLE_ROOT := ../../.. NIMBLE_CFG_TINYCRYPT := 1 + +# Skip files that don't build for this port +NIMBLE_IGNORE := $(NIMBLE_ROOT)/porting/nimble/src/hal_timer.c \ + $(NIMBLE_ROOT)/porting/nimble/src/os_cputime.c \ + $(NIMBLE_ROOT)/porting/nimble/src/os_cputime_pwr2.c \ + $(NULL) + include $(NIMBLE_ROOT)/porting/nimble/Makefile.defs include $(NIMBLE_ROOT)/porting/nimble/Makefile.mesh -SRC := $(NIMBLE_SRC) +SRC := $(NIMBLE_SRC) # Source files for NPL OSAL SRC += \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_atomic.c \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_callout.c \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_eventq.cc \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_mutex.c \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_sem.c \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_task.c \ - $(NIMBLE_ROOT)/porting/npl/linux/src/os_time.c \ - $(NIMBLE_ROOT)/nimble/transport/socket/src/ble_hci_socket.c \ + $(wildcard $(NIMBLE_ROOT)/porting/npl/linux/src/*.c) \ + $(wildcard $(NIMBLE_ROOT)/porting/npl/linux/src/*.cc) \ + $(wildcard $(NIMBLE_ROOT)/nimble/transport/socket/src/*.c) \ $(TINYCRYPT_SRC) \ $(NULL) @@ -39,7 +41,7 @@ SRC += \ # Add NPL and all NimBLE directories to include paths INC = \ - ./include \ + ./include \ $(NIMBLE_ROOT)/porting/npl/linux/include \ $(NIMBLE_ROOT)/porting/npl/linux/src \ $(NIMBLE_ROOT)/nimble/transport/socket/include \ diff --git a/porting/nimble/Makefile.controller b/porting/nimble/Makefile.controller index 8bc2c2a0c..a3df8df34 100644 --- a/porting/nimble/Makefile.controller +++ b/porting/nimble/Makefile.controller @@ -25,25 +25,8 @@ NIMBLE_INCLUDE += \ $(NULL) NIMBLE_SRC += \ - $(NIMBLE_ROOT)/nimble/transport/ram/src/ble_hci_ram.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_sched.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_xcvr.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_whitelist.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_ctrl.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_hci.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_supp_cmd.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_adv.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_conn.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_resolv.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_conn_hci.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_rand.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_scan.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_dtm.c \ - $(NIMBLE_ROOT)/nimble/controller/src/ble_ll_hci_ev.c \ - $(NIMBLE_ROOT)/nimble/drivers/nrf52/src/ble_hw.c \ - $(NIMBLE_ROOT)/nimble/drivers/nrf52/src/ble_phy.c \ - $(NIMBLE_ROOT)/porting/nimble/src/os_cputime.c \ - $(NIMBLE_ROOT)/porting/nimble/src/os_cputime_pwr2.c \ - $(NIMBLE_ROOT)/porting/nimble/src/hal_timer.c \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT/nimble/transport/ram/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT/nimble/controller/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT/nimble/drivers/nrf52/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/porting/nimble/controller/src/*.c)) \ $(NULL) diff --git a/porting/nimble/Makefile.defs b/porting/nimble/Makefile.defs index d3c3cd690..ffb531fb6 100644 --- a/porting/nimble/Makefile.defs +++ b/porting/nimble/Makefile.defs @@ -38,71 +38,18 @@ NIMBLE_INCLUDE := \ $(NULL) NIMBLE_SRC := \ - $(NIMBLE_ROOT)/nimble/host/src/ble_att.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_att_clt.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_att_cmd.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_att_svr.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_eddystone.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_gap.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_gattc.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_gatts.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_adv.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_atomic.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_cfg.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_conn.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_dbg.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_flow.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_hci.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_hci_cmd.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_hci_evt.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_hci_util.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_id.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_log.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_mbuf.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_mqueue.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_misc.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_pvcy.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_startup.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_hs_stop.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_ibeacon.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_l2cap.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_l2cap_coc.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_l2cap_sig.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_l2cap_sig_cmd.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_monitor.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_sm_alg.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_sm.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_sm_cmd.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_sm_lgcy.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_sm_sc.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_store.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_store_util.c \ - $(NIMBLE_ROOT)/nimble/host/src/ble_uuid.c \ - $(NIMBLE_ROOT)/nimble/host/services/ans/src/ble_svc_ans.c \ - $(NIMBLE_ROOT)/nimble/host/services/bas/src/ble_svc_bas.c \ - $(NIMBLE_ROOT)/nimble/host/services/gap/src/ble_svc_gap.c \ - $(NIMBLE_ROOT)/nimble/host/services/gatt/src/ble_svc_gatt.c \ - $(NIMBLE_ROOT)/nimble/host/services/ias/src/ble_svc_ias.c \ - $(NIMBLE_ROOT)/nimble/host/services/lls/src/ble_svc_lls.c \ - $(NIMBLE_ROOT)/nimble/host/services/tps/src/ble_svc_tps.c \ - $(NIMBLE_ROOT)/nimble/host/store/ram/src/ble_store_ram.c \ - $(NIMBLE_ROOT)/nimble/host/util/src/addr.c \ - $(NIMBLE_ROOT)/nimble/src/ble_util.c \ - $(NULL) - -# Few utils and data structures copied from Mynewt -NIMBLE_SRC += \ - $(NIMBLE_ROOT)/porting/nimble/src/nimble_port.c \ - $(NULL) - -# Few utils and data structures copied from Mynewt -NIMBLE_SRC += \ - $(NIMBLE_ROOT)/porting/nimble/src/endian.c \ - $(NIMBLE_ROOT)/porting/nimble/src/mem.c \ - $(NIMBLE_ROOT)/porting/nimble/src/os_mbuf.c \ - $(NIMBLE_ROOT)/porting/nimble/src/os_mempool.c \ - $(NIMBLE_ROOT)/porting/nimble/src/os_msys_init.c \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/porting/nimble/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/nimble/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/nimble/host/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/nimble/host/util/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/nimble/host/services/ans/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/nimble/host/services/bas/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/nimble/host/services/gap/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/nimble/host/services/gatt/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/nimble/host/services/ias/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/nimble/host/services/lls/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/nimble/host/services/tps/src/*.c)) \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/nimble/host/store/ram/src/*.c)) \ $(NULL) ifneq (,$(NIMBLE_CFG_CONTROLLER)) diff --git a/porting/nimble/Makefile.mesh b/porting/nimble/Makefile.mesh index 2f47a7816..e7f6ccec6 100644 --- a/porting/nimble/Makefile.mesh +++ b/porting/nimble/Makefile.mesh @@ -20,25 +20,5 @@ NIMBLE_INCLUDE += \ $(NULL) NIMBLE_SRC += \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/access.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/adv.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/beacon.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/cfg_cli.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/cfg_srv.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/crypto.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/friend.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/glue.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/health_cli.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/health_srv.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/light_model.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/lpn.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/mesh.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/model_cli.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/model_srv.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/net.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/prov.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/proxy.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/shell.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/testing.c \ - $(NIMBLE_ROOT)/nimble/host/mesh/src/transport.c \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/nimble/host/mesh/src/*.c)) \ $(NULL) diff --git a/porting/nimble/Makefile.tinycrypt b/porting/nimble/Makefile.tinycrypt index 2acc131dc..2333e6188 100644 --- a/porting/nimble/Makefile.tinycrypt +++ b/porting/nimble/Makefile.tinycrypt @@ -22,10 +22,5 @@ TINYCRYPT_INCLUDE := \ $(NULL) TINYCRYPT_SRC := \ - $(NIMBLE_ROOT)/ext/tinycrypt/src/aes_decrypt.c \ - $(NIMBLE_ROOT)/ext/tinycrypt/src/aes_encrypt.c \ - $(NIMBLE_ROOT)/ext/tinycrypt/src/cmac_mode.c \ - $(NIMBLE_ROOT)/ext/tinycrypt/src/ecc.c \ - $(NIMBLE_ROOT)/ext/tinycrypt/src/ecc_dh.c \ - $(NIMBLE_ROOT)/ext/tinycrypt/src/utils.c \ + $(filter-out $(NIMBLE_IGNORE), $(wildcard $(NIMBLE_ROOT)/ext/tinycrypt/src/*.c)) \ $(NULL) diff --git a/porting/npl/linux/src/os_types.h b/porting/npl/linux/include/nimble/os_types.h similarity index 100% rename from porting/npl/linux/src/os_types.h rename to porting/npl/linux/include/nimble/os_types.h