From 8f58e5a3ec0e4a15fc8ae0911cc864f5dbf86c6e Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Fri, 18 Aug 2017 15:56:55 +0200 Subject: build: Revise the build system This revises the build system to have configuration per system component. System settings can now be set using cmake. The standard compliance defines were removed from configuration header and are set in the sources where needed. Also some small code refactors, such as moving the data for shims out of the ipcp structure to the respective shims were performed. --- src/ipcpd/normal/CMakeLists.txt | 11 +++++++++-- src/ipcpd/normal/addr_auth.c | 1 - src/ipcpd/normal/connmgr.c | 6 ++++-- src/ipcpd/normal/dht.c | 5 ++++- src/ipcpd/normal/dir.c | 3 ++- src/ipcpd/normal/dt.c | 5 ++++- src/ipcpd/normal/dt_pci.c | 1 - src/ipcpd/normal/enroll.c | 4 +++- src/ipcpd/normal/fa.c | 5 ++++- src/ipcpd/normal/gam.c | 3 ++- src/ipcpd/normal/main.c | 5 ++++- src/ipcpd/normal/neighbors.c | 3 ++- src/ipcpd/normal/pff.c | 5 ++++- src/ipcpd/normal/pol/complete.c | 3 ++- src/ipcpd/normal/pol/flat.c | 3 ++- src/ipcpd/normal/pol/graph.c | 3 ++- src/ipcpd/normal/pol/link_state.c | 3 ++- src/ipcpd/normal/pol/tests/graph_test.c | 3 ++- src/ipcpd/normal/ribmgr.c | 3 ++- src/ipcpd/normal/routing.c | 3 ++- src/ipcpd/normal/sdu_sched.c | 5 ++++- 21 files changed, 60 insertions(+), 23 deletions(-) (limited to 'src/ipcpd/normal') diff --git a/src/ipcpd/normal/CMakeLists.txt b/src/ipcpd/normal/CMakeLists.txt index 8c2d4efc..7a40e94c 100644 --- a/src/ipcpd/normal/CMakeLists.txt +++ b/src/ipcpd/normal/CMakeLists.txt @@ -12,7 +12,7 @@ include_directories(${CURRENT_BINARY_PARENT_DIR}) include_directories(${CMAKE_SOURCE_DIR}/include) include_directories(${CMAKE_BINARY_DIR}/include) -set(IPCP_NORMAL_TARGET ipcpd-normal CACHE STRING "IPCP_NORMAL_TARGET") +set(IPCP_NORMAL_TARGET ipcpd-normal CACHE INTERNAL "") protobuf_generate_c(FLOW_ALLOC_SRCS FLOW_ALLOC_HDRS flow_alloc.proto) protobuf_generate_c(KAD_PROTO_SRCS KAD_PROTO_HDRS kademlia.proto) @@ -20,6 +20,10 @@ protobuf_generate_c(KAD_PROTO_SRCS KAD_PROTO_HDRS kademlia.proto) # Add GPB sources of policies last protobuf_generate_c(FSO_SRCS FSO_HDRS pol/fso.proto) +math(EXPR PFT_EXPR "1 << 12") +set(PFT_SIZE ${PFT_EXPR} CACHE STRING + "Size of the PDU forwarding table") + set(SOURCE_FILES # Add source files here addr_auth.c @@ -56,4 +60,7 @@ endif (CMAKE_BUILD_TYPE MATCHES Debug) install(TARGETS ipcpd-normal RUNTIME DESTINATION sbin) add_subdirectory(pol/tests) -add_subdirectory(tests) + +if (NOT GNU) + add_subdirectory(tests) +endif () diff --git a/src/ipcpd/normal/addr_auth.c b/src/ipcpd/normal/addr_auth.c index 56b41384..e327e2fa 100644 --- a/src/ipcpd/normal/addr_auth.c +++ b/src/ipcpd/normal/addr_auth.c @@ -22,7 +22,6 @@ #define OUROBOROS_PREFIX "addr_auth" -#include #include #include "addr_auth.h" diff --git a/src/ipcpd/normal/connmgr.c b/src/ipcpd/normal/connmgr.c index 1513c12a..f48175fa 100644 --- a/src/ipcpd/normal/connmgr.c +++ b/src/ipcpd/normal/connmgr.c @@ -20,14 +20,16 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + #define OUROBOROS_PREFIX "normal-ipcp" -#include -#include #include #include #include #include +#include +#include #include "ae.h" #include "connmgr.h" diff --git a/src/ipcpd/normal/dht.c b/src/ipcpd/normal/dht.c index f41541d2..65e26406 100644 --- a/src/ipcpd/normal/dht.c +++ b/src/ipcpd/normal/dht.c @@ -20,9 +20,12 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + +#include "config.h" + #define OUROBOROS_PREFIX "dht" -#include #include #include #include diff --git a/src/ipcpd/normal/dir.c b/src/ipcpd/normal/dir.c index 231ba110..feae7013 100644 --- a/src/ipcpd/normal/dir.c +++ b/src/ipcpd/normal/dir.c @@ -20,9 +20,10 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + #define OUROBOROS_PREFIX "directory" -#include #include #include #include diff --git a/src/ipcpd/normal/dt.c b/src/ipcpd/normal/dt.c index 290c409d..173266f4 100644 --- a/src/ipcpd/normal/dt.c +++ b/src/ipcpd/normal/dt.c @@ -20,9 +20,12 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + +#include "config.h" + #define OUROBOROS_PREFIX "dt-ae" -#include #include #include #include diff --git a/src/ipcpd/normal/dt_pci.c b/src/ipcpd/normal/dt_pci.c index e139cf91..9e6dfa89 100644 --- a/src/ipcpd/normal/dt_pci.c +++ b/src/ipcpd/normal/dt_pci.c @@ -20,7 +20,6 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#include #include #include diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c index be1596d0..471230bc 100644 --- a/src/ipcpd/normal/enroll.c +++ b/src/ipcpd/normal/enroll.c @@ -19,9 +19,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., http://www.fsf.org/about/contact/. */ + +#define _POSIX_C_SOURCE 199309L + #define OUROBOROS_PREFIX "enrollment" -#include #include #include #include diff --git a/src/ipcpd/normal/fa.c b/src/ipcpd/normal/fa.c index 2488f017..682dc5c6 100644 --- a/src/ipcpd/normal/fa.c +++ b/src/ipcpd/normal/fa.c @@ -20,9 +20,12 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + +#include "config.h" + #define OUROBOROS_PREFIX "flow-allocator" -#include #include #include #include diff --git a/src/ipcpd/normal/gam.c b/src/ipcpd/normal/gam.c index 9997506c..3b4cc5de 100644 --- a/src/ipcpd/normal/gam.c +++ b/src/ipcpd/normal/gam.c @@ -20,9 +20,10 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + #define OUROBOROS_PREFIX "dt-gam" -#include #include #include #include diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 27fefdb6..95b0ed56 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -20,9 +20,12 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200809L + +#include "config.h" + #define OUROBOROS_PREFIX "normal-ipcp" -#include #include #include #include diff --git a/src/ipcpd/normal/neighbors.c b/src/ipcpd/normal/neighbors.c index 0ac5e958..5da0f0df 100644 --- a/src/ipcpd/normal/neighbors.c +++ b/src/ipcpd/normal/neighbors.c @@ -20,9 +20,10 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 199309L + #define OUROBOROS_PREFIX "neighbors" -#include #include #include #include diff --git a/src/ipcpd/normal/pff.c b/src/ipcpd/normal/pff.c index acf4db1a..d6c9ddee 100644 --- a/src/ipcpd/normal/pff.c +++ b/src/ipcpd/normal/pff.c @@ -20,9 +20,12 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + +#include "config.h" + #define OUROBOROS_PREFIX "pff" -#include #include #include #include diff --git a/src/ipcpd/normal/pol/complete.c b/src/ipcpd/normal/pol/complete.c index e31f345a..6c6e7372 100644 --- a/src/ipcpd/normal/pol/complete.c +++ b/src/ipcpd/normal/pol/complete.c @@ -20,9 +20,10 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + #define OUROBOROS_PREFIX "complete" -#include #include #include #include diff --git a/src/ipcpd/normal/pol/flat.c b/src/ipcpd/normal/pol/flat.c index 966d0d03..1fece07f 100644 --- a/src/ipcpd/normal/pol/flat.c +++ b/src/ipcpd/normal/pol/flat.c @@ -20,9 +20,10 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + #define OUROBOROS_PREFIX "flat-addr-auth" -#include #include #include #include diff --git a/src/ipcpd/normal/pol/graph.c b/src/ipcpd/normal/pol/graph.c index 7ec9c035..3611f0b0 100644 --- a/src/ipcpd/normal/pol/graph.c +++ b/src/ipcpd/normal/pol/graph.c @@ -20,9 +20,10 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + #define OUROBOROS_PREFIX "graph" -#include #include #include #include diff --git a/src/ipcpd/normal/pol/link_state.c b/src/ipcpd/normal/pol/link_state.c index 322b22d7..9dfed5c0 100644 --- a/src/ipcpd/normal/pol/link_state.c +++ b/src/ipcpd/normal/pol/link_state.c @@ -20,9 +20,10 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + #define OUROBOROS_PREFIX "link-state-routing" -#include #include #include #include diff --git a/src/ipcpd/normal/pol/tests/graph_test.c b/src/ipcpd/normal/pol/tests/graph_test.c index 30201800..87574187 100644 --- a/src/ipcpd/normal/pol/tests/graph_test.c +++ b/src/ipcpd/normal/pol/tests/graph_test.c @@ -20,7 +20,8 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#include +#define _POSIX_C_SOURCE 200112L + #include #include diff --git a/src/ipcpd/normal/ribmgr.c b/src/ipcpd/normal/ribmgr.c index ee81581f..ab2aa430 100644 --- a/src/ipcpd/normal/ribmgr.c +++ b/src/ipcpd/normal/ribmgr.c @@ -20,9 +20,10 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + #define OUROBOROS_PREFIX "rib-manager" -#include #include #include #include diff --git a/src/ipcpd/normal/routing.c b/src/ipcpd/normal/routing.c index 5bf985fb..c00ec67c 100644 --- a/src/ipcpd/normal/routing.c +++ b/src/ipcpd/normal/routing.c @@ -20,9 +20,10 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 200112L + #define OUROBOROS_PREFIX "routing" -#include #include #include "routing.h" diff --git a/src/ipcpd/normal/sdu_sched.c b/src/ipcpd/normal/sdu_sched.c index b46f2563..f3550d5c 100644 --- a/src/ipcpd/normal/sdu_sched.c +++ b/src/ipcpd/normal/sdu_sched.c @@ -20,9 +20,12 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#define _POSIX_C_SOURCE 199309L + +#include "config.h" + #define OUROBOROS_PREFIX "sdu-scheduler" -#include #include #include -- cgit v1.2.3