From 882c11dbccd2f0609b512bc98df870d261780f4b Mon Sep 17 00:00:00 2001 From: gozfree Date: Sun, 12 Jul 2020 13:59:11 +0800 Subject: [PATCH] refine makefile to switch gcc version --- build.sh | 4 +- build/android.inc | 8 +- build/arm.inc | 8 +- build/autogen_lib.sh | 2 +- build/color.inc | 21 +++-- build/linux.inc | 10 ++- build/win.inc | 6 ++ gear-lib/libbase64/Makefile | 29 ++----- gear-lib/libdarray/Makefile | 28 ++----- gear-lib/libdebug/Makefile | 28 ++----- gear-lib/libdict/Makefile | 28 ++----- gear-lib/libfile/Makefile | 28 ++----- gear-lib/libfsm/Makefile | 28 ++----- gear-lib/libgevent/Makefile | 28 ++----- gear-lib/libhal/Makefile | 28 ++----- gear-lib/libhash/Makefile | 6 -- gear-lib/libhomekit/Makefile | 1 + gear-lib/libhomekit/src/mdnsresponder.c | 101 +++++++++++++++++++++++- gear-lib/libhomekit/src/mdnsresponder.h | 31 ++++++++ gear-lib/libhomekit/src/server.c | 7 +- gear-lib/libipc/Makefile | 28 ++----- gear-lib/liblog/Makefile | 26 ++---- gear-lib/libmacro/Makefile | 28 ++----- gear-lib/libmedia-io/Makefile | 28 ++----- gear-lib/libmp4parser/Makefile | 6 -- gear-lib/libp2p/Makefile | 30 +++---- gear-lib/libplugin/Makefile | 28 ++----- gear-lib/libposix/Makefile | 28 ++----- gear-lib/libqueue/Makefile | 28 ++----- gear-lib/librbtree/Makefile | 29 +++---- gear-lib/libringbuffer/Makefile | 28 ++----- gear-lib/librpc/Makefile | 28 ++----- gear-lib/librtmpc/Makefile | 28 ++----- gear-lib/librtmpc/rtmp.c | 16 ++-- gear-lib/librtsp/Makefile | 28 ++----- gear-lib/librtsp/media_source_h264.c | 3 +- gear-lib/libskt/Makefile | 28 ++----- gear-lib/libsort/Makefile | 45 +++++------ gear-lib/libstrex/Makefile | 30 +++---- gear-lib/libsubmask/Makefile | 28 ++----- gear-lib/libthread/Makefile | 28 ++----- gear-lib/libthread/libthread.c | 2 + gear-lib/libthread/libthread.h | 5 +- gear-lib/libuac/Makefile | 28 ++----- gear-lib/libuvc/Makefile | 28 ++----- gear-lib/libvector/Makefile | 26 ++---- gear-lib/libworkq/Makefile | 28 ++----- 47 files changed, 442 insertions(+), 654 deletions(-) diff --git a/build.sh b/build.sh index 6734f22..dbad243 100755 --- a/build.sh +++ b/build.sh @@ -27,9 +27,9 @@ PLATFORM="[linux|pi|android|ios]" #basic libraries BASIC_LIBS="libmacro libtime liblog libdarray libgevent libworkq libdict libhash libsort \ librbtree libringbuffer libthread libvector libbase64 libmedia-io libposix \ - libdebug libfile libuvc libmp4parser libqueue libplugin libhal libsubmask" + libdebug libfile libconfig libuvc libmp4parser libqueue libplugin libhal libsubmask" FRAMEWORK_LIBS="libipc" -NETWORK_LIBS="libskt librpc " +NETWORK_LIBS="libskt librpc librtsp librtmpc" usage() { diff --git a/build/android.inc b/build/android.inc index 841e4ab..128cd2f 100644 --- a/build/android.inc +++ b/build/android.inc @@ -1,4 +1,4 @@ -#### android.conf +#### android CROSS_PREFIX := arm-linux-androideabi- OUTPUT := `pwd`/../output/android/ @@ -30,3 +30,9 @@ ANDROID_LDFLAGS := -L$(PLATFORM_LIB) \ MAKEDIR_OUTPUT := @mkdir -p $(OUTPUT)/include -p $(OUTPUT)/lib android_CFLAGS := $(ANDROID_CFLAGS) android_LDFLAGS := $(ANDROID_LDFLAGS) + +CC := $(CROSS_PREFIX)gcc +CXX := $(CROSS_PREFIX)g++ +LD := $(CROSS_PREFIX)ld +AR := $(CROSS_PREFIX)ar +STRIP := $(CROSS_PREFIX)strip diff --git a/build/arm.inc b/build/arm.inc index e89c96c..74cf6d0 100644 --- a/build/arm.inc +++ b/build/arm.inc @@ -1,7 +1,13 @@ -#### arm.conf +#### arm CROSS_PREFIX := arm-linux-gnueabihf- OUTPUT := `pwd`/../output/arm/ TOOLCHAINS_ROOT := `$(CROSS_PREFIX)gcc -print-sysroot` PLATFORM_LIB := $(TOOLCHAINS_ROOT)/usr/lib MAKEDIR_OUTPUT := @mkdir -p $(OUTPUT)/lib -p $(OUTPUT)/include + +CC := $(CROSS_PREFIX)gcc +CXX := $(CROSS_PREFIX)g++ +LD := $(CROSS_PREFIX)ld +AR := $(CROSS_PREFIX)ar +STRIP := $(CROSS_PREFIX)strip diff --git a/build/autogen_lib.sh b/build/autogen_lib.sh index 6b15679..31c993b 100755 --- a/build/autogen_lib.sh +++ b/build/autogen_lib.sh @@ -92,7 +92,7 @@ cat > ${MAKEFILE} < #include +#endif #include #include +#include +#if 0 #include #include #include #include #include +#endif +#if 0 #include #include #include @@ -34,12 +40,15 @@ #include #include #include +#endif #include "mdnsresponder.h" +#if 0 #if !LWIP_IGMP #error "LWIP_IGMP needs to be defined in lwipopts.h" #endif +#endif // #define qDebugLog // Log activity generally // #define qLogIncoming // Log all arriving multicast packets @@ -55,6 +64,56 @@ # include "arch/bpstruct.h" #endif +/* DNS field TYPE used for "Resource Records" */ +#define DNS_RRTYPE_A 1 /* a host address */ +#define DNS_RRTYPE_NS 2 /* an authoritative name server */ +#define DNS_RRTYPE_MD 3 /* a mail destination (Obsolete - use MX) */ +#define DNS_RRTYPE_MF 4 /* a mail forwarder (Obsolete - use MX) */ +#define DNS_RRTYPE_CNAME 5 /* the canonical name for an alias */ +#define DNS_RRTYPE_SOA 6 /* marks the start of a zone of authority */ +#define DNS_RRTYPE_MB 7 /* a mailbox domain name (EXPERIMENTAL) */ +#define DNS_RRTYPE_MG 8 /* a mail group member (EXPERIMENTAL) */ +#define DNS_RRTYPE_MR 9 /* a mail rename domain name (EXPERIMENTAL) */ +#define DNS_RRTYPE_NULL 10 /* a null RR (EXPERIMENTAL) */ +#define DNS_RRTYPE_WKS 11 /* a well known service description */ +#define DNS_RRTYPE_PTR 12 /* a domain name pointer */ +#define DNS_RRTYPE_HINFO 13 /* host information */ +#define DNS_RRTYPE_MINFO 14 /* mailbox or mail list information */ +#define DNS_RRTYPE_MX 15 /* mail exchange */ +#define DNS_RRTYPE_TXT 16 /* text strings */ +#define DNS_RRTYPE_AAAA 28 /* IPv6 address */ +#define DNS_RRTYPE_SRV 33 /* service location */ +#define DNS_RRTYPE_ANY 255 /* any type */ + +/* DNS field CLASS used for "Resource Records" */ +#define DNS_RRCLASS_IN 1 /* the Internet */ +#define DNS_RRCLASS_CS 2 /* the CSNET class (Obsolete - used only for examples in some obsolete RFCs) */ +#define DNS_RRCLASS_CH 3 /* the CHAOS class */ +#define DNS_RRCLASS_HS 4 /* Hesiod [Dyer 87] */ +#define DNS_RRCLASS_ANY 255 /* any class */ +#define DNS_RRCLASS_FLUSH 0x800 /* Flush bit */ + +/* DNS protocol flags */ +#define DNS_FLAG1_RESPONSE 0x80 +#define DNS_FLAG1_OPCODE_STATUS 0x10 +#define DNS_FLAG1_OPCODE_INVERSE 0x08 +#define DNS_FLAG1_OPCODE_STANDARD 0x00 +#define DNS_FLAG1_AUTHORATIVE 0x04 +#define DNS_FLAG1_TRUNC 0x02 +#define DNS_FLAG1_RD 0x01 +#define DNS_FLAG2_RA 0x80 +#define DNS_FLAG2_ERR_MASK 0x0f +#define DNS_FLAG2_ERR_NONE 0x00 +#define DNS_FLAG2_ERR_NAME 0x03 + +#define DNS_HDR_GET_OPCODE(hdr) ((((hdr)->flags1) >> 3) & 0xF) + + +#define PACK_STRUCT_BEGIN +#define PACK_STRUCT_END +#define PACK_STRUCT_FIELD(x) x +#define PACK_STRUCT_STRUCT __attribute__((packed)) + PACK_STRUCT_BEGIN /** DNS message header */ struct mdns_hdr { @@ -126,13 +185,31 @@ typedef struct mdns_rsrc { // at rData[rKeySize] } mdns_rsrc; +#define PP_HTONS(x) ((u16_t)((((x) & (u16_t)0x00ffU) << 8) | (((x) & (u16_t)0xff00U) >> 8))) +#define PP_NTOHS(x) PP_HTONS(x) +#define PP_HTONL(x) ((((x) & (u32_t)0x000000ffUL) << 24) | \ + (((x) & (u32_t)0x0000ff00UL) << 8) | \ + (((x) & (u32_t)0x00ff0000UL) >> 8) | \ + (((x) & (u32_t)0xff000000UL) >> 24)) +#define PP_NTOHL(x) PP_HTONL(x) + +#define LWIP_MAKEU32(a,b,c,d) (((u32_t)((a) & 0xff) << 24) | \ + ((u32_t)((b) & 0xff) << 16) | \ + ((u32_t)((c) & 0xff) << 8) | \ + (u32_t)((d) & 0xff)) +#define IPADDR4_INIT(u32val) { u32val } +#define IPADDR4_INIT_BYTES(a,b,c,d) IPADDR4_INIT(PP_HTONL(LWIP_MAKEU32(a,b,c,d))) +#define DNS_MQUERY_IPV4_GROUP_INIT IPADDR4_INIT_BYTES(224,0,0,251) + static struct udp_pcb* gMDNS_pcb = NULL; static const ip_addr_t gMulticastV4Addr = DNS_MQUERY_IPV4_GROUP_INIT; #if LWIP_IPV6 #include "lwip/mld6.h" static const ip_addr_t gMulticastV6Addr = DNS_MQUERY_IPV6_GROUP_INIT; #endif +#if 0 static SemaphoreHandle_t gDictMutex = NULL; +#endif static mdns_rsrc* gDictP = NULL; // RR database, linked list //---------------------- Debug/logging utilities ------------------------- @@ -426,18 +503,24 @@ static u8_t* mdns_get_question(u8_t* hdrP, u8_t* qp, char* qStr, uint16_t* qClas //--------------------------------------------------------------------------- static void mdns_announce_netif(struct netif *netif, const ip_addr_t *addr); +#if 0 static ETSTimer announce_timer; +static ETSTimer network_monitor_timer; +#endif static bool network_down = true; -static ETSTimer network_monitor_timer; void mdns_clear() { +#if 0 sdk_os_timer_disarm(&announce_timer); sdk_os_timer_disarm(&network_monitor_timer); +#endif +#if 0 if (!xSemaphoreTake(gDictMutex, portMAX_DELAY)) return; +#endif mdns_rsrc *rsrc = gDictP; gDictP = NULL; @@ -448,7 +531,9 @@ void mdns_clear() { rsrc = next; } +#if 0 xSemaphoreGive(gDictMutex); +#endif } @@ -495,11 +580,13 @@ static void mdns_add_response(const char* vKey, u16_t vType, u32_t ttl, const vo memcpy(rsrcP->rData, vKey, keyLen); memcpy(&rsrcP->rData[keyLen], dataP, vDataSize); +#if 0 if (xSemaphoreTake(gDictMutex, portMAX_DELAY)) { rsrcP->rNext = gDictP; gDictP = rsrcP; xSemaphoreGive(gDictMutex); } +#endif #ifdef qDebugLog printf("mDNS added RR '%s' %s, %d bytes\n", vKey, mdns_qrtype(vType), vDataSize); @@ -555,7 +642,9 @@ void mdns_add_AAAA(const char* rKey, u32_t ttl, const ip6_addr_t *addr) #endif void mdns_announce() { +#if 0 struct netif *netif = sdk_system_get_netif(STATION_IF); +#endif #if LWIP_IPV4 mdns_announce_netif(netif, &gMulticastV4Addr); #endif @@ -619,8 +708,10 @@ void mdns_add_facility( const char* instanceName, // Friendly name, need not b if (sdk_wifi_station_get_connect_status() == STATION_GOT_IP) mdns_announce(); +#if 0 sdk_os_timer_arm(&announce_timer, ttl * 1000, 1); sdk_os_timer_arm(&network_monitor_timer, HOMEKIT_MDNS_NETWORK_CHECK_PERIOD, 1); +#endif } static mdns_rsrc* mdns_match(const char* qstr, u16_t qType) @@ -742,6 +833,7 @@ static void mdns_reply(const ip_addr_t *addr, struct mdns_hdr* hdrP) qp = qBase + SIZEOF_DNS_HDR; nquestions = htons(hdrP->numquestions); +#if 0 if (xSemaphoreTake(gDictMutex, portMAX_DELAY)) { for (i = 0; i < nquestions; i++) { @@ -809,6 +901,7 @@ static void mdns_reply(const ip_addr_t *addr, struct mdns_hdr* hdrP) xSemaphoreGive(gDictMutex); } +#endif if (respLen > SIZEOF_DNS_HDR) { if (extra) { @@ -849,6 +942,7 @@ static void mdns_announce_netif(struct netif *netif, const ip_addr_t *addr) int respLen = SIZEOF_DNS_HDR; +#if 0 if (xSemaphoreTake(gDictMutex, portMAX_DELAY)) { mdns_rsrc *rsrcP = gDictP; while (rsrcP) { @@ -895,6 +989,7 @@ static void mdns_announce_netif(struct netif *netif, const ip_addr_t *addr) xSemaphoreGive(gDictMutex); } +#endif if (respLen > SIZEOF_DNS_HDR) { mdns_send_mcast(addr, mdns_response, respLen); @@ -959,8 +1054,10 @@ static void mdns_check_network() { // If we are in station mode and have an IP address, start a multicast UDP receive void mdns_init() { +#if 0 sdk_os_timer_setfn(&announce_timer, mdns_announce, NULL); sdk_os_timer_setfn(&network_monitor_timer, mdns_check_network, NULL); +#endif err_t err; @@ -983,6 +1080,7 @@ void mdns_init() } } +#if 0 gDictMutex = xSemaphoreCreateBinary(); if (!gDictMutex) { printf(">>> mDNS_init: failed to initialize mutex\n"); @@ -990,6 +1088,7 @@ void mdns_init() return; } xSemaphoreGive(gDictMutex); +#endif gMDNS_pcb = udp_new_ip_type(IPADDR_TYPE_ANY); if (!gMDNS_pcb) { diff --git a/gear-lib/libhomekit/src/mdnsresponder.h b/gear-lib/libhomekit/src/mdnsresponder.h index 4144171..f284b1f 100644 --- a/gear-lib/libhomekit/src/mdnsresponder.h +++ b/gear-lib/libhomekit/src/mdnsresponder.h @@ -14,13 +14,44 @@ #ifndef __MDNSRESPONDER_H__ #define __MDNSRESPONDER_H__ +#include +#if 0 #include +#endif /* The default maximum reply size, increase as necessary. */ #ifndef MDNS_RESPONDER_REPLY_SIZE #define MDNS_RESPONDER_REPLY_SIZE 1460 #endif +#define u8_t uint8_t +#define u16_t uint16_t +#define u32_t uint32_t + +struct ip4_addr { + u32_t addr; +}; +typedef struct ip4_addr ip4_addr_t; + +struct ip6_addr { + u32_t addr[4]; +#if LWIP_IPV6_SCOPES + u8_t zone; +#endif /* LWIP_IPV6_SCOPES */ +}; + +/** IPv6 address */ +typedef struct ip6_addr ip6_addr_t; + +typedef struct ip_addr { + union { + ip6_addr_t ip6; + ip4_addr_t ip4; + } u_addr; + /** @ref lwip_ip_addr_type */ + u8_t type; +} ip_addr_t; + // Starts the mDNS responder task, call first void mdns_init(); diff --git a/gear-lib/libhomekit/src/server.c b/gear-lib/libhomekit/src/server.c index 18dc6d2..1b1e287 100644 --- a/gear-lib/libhomekit/src/server.c +++ b/gear-lib/libhomekit/src/server.c @@ -3247,7 +3247,7 @@ void homekit_server_close_clients(homekit_server_t *server) { static void homekit_run_server(homekit_server_t *server) { - DEBUG("Staring HTTP server"); + INFO("Staring HTTP server"); struct sockaddr_in serv_addr; server->listen_fd = socket(AF_INET, SOCK_STREAM, 0); @@ -3515,7 +3515,10 @@ void homekit_server_init(homekit_server_config_t *config) { } #else pthread_t tid; - pthread_create(&tid, NULL, homekit_server_task, server); + int ret = pthread_create(&tid, NULL, homekit_server_task, server); + if (ret) { + ERROR("pthread_create homekit_server_task failed!\n"); + } #endif ERROR("homekit_server_init done"); diff --git a/gear-lib/libipc/Makefile b/gear-lib/libipc/Makefile index 9900ec2..04b3485 100644 --- a/gear-lib/libipc/Makefile +++ b/gear-lib/libipc/Makefile @@ -1,34 +1,22 @@ ############################################################################## # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/liblog/Makefile b/gear-lib/liblog/Makefile index 506b30d..a220a03 100644 --- a/gear-lib/liblog/Makefile +++ b/gear-lib/liblog/Makefile @@ -3,32 +3,20 @@ ############################################################################### #ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libmacro/Makefile b/gear-lib/libmacro/Makefile index 683e032..4c621eb 100644 --- a/gear-lib/libmacro/Makefile +++ b/gear-lib/libmacro/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libmedia-io/Makefile b/gear-lib/libmedia-io/Makefile index 1922530..efd538c 100644 --- a/gear-lib/libmedia-io/Makefile +++ b/gear-lib/libmedia-io/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libmp4parser/Makefile b/gear-lib/libmp4parser/Makefile index f549b50..4d2f3ce 100644 --- a/gear-lib/libmp4parser/Makefile +++ b/gear-lib/libmp4parser/Makefile @@ -13,12 +13,6 @@ ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) endif -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) else diff --git a/gear-lib/libp2p/Makefile b/gear-lib/libp2p/Makefile index 84d6086..4611103 100644 --- a/gear-lib/libp2p/Makefile +++ b/gear-lib/libp2p/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local -BUILD_DIR := $(shell pwd)/../build/ +BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libplugin/Makefile b/gear-lib/libplugin/Makefile index 99440fd..14f2d95 100644 --- a/gear-lib/libplugin/Makefile +++ b/gear-lib/libplugin/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libposix/Makefile b/gear-lib/libposix/Makefile index 19e6c36..1049c0f 100644 --- a/gear-lib/libposix/Makefile +++ b/gear-lib/libposix/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libqueue/Makefile b/gear-lib/libqueue/Makefile index c18133a..cb5540e 100644 --- a/gear-lib/libqueue/Makefile +++ b/gear-lib/libqueue/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/librbtree/Makefile b/gear-lib/librbtree/Makefile index fab3b80..7c871ed 100644 --- a/gear-lib/librbtree/Makefile +++ b/gear-lib/librbtree/Makefile @@ -1,32 +1,21 @@ -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) + ######## LIBNAME = librbtree diff --git a/gear-lib/libringbuffer/Makefile b/gear-lib/libringbuffer/Makefile index 25c7b23..add77fd 100644 --- a/gear-lib/libringbuffer/Makefile +++ b/gear-lib/libringbuffer/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/librpc/Makefile b/gear-lib/librpc/Makefile index b82751b..b123cc3 100644 --- a/gear-lib/librpc/Makefile +++ b/gear-lib/librpc/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/librtmpc/Makefile b/gear-lib/librtmpc/Makefile index ce211a0..a525ba4 100644 --- a/gear-lib/librtmpc/Makefile +++ b/gear-lib/librtmpc/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/librtmpc/rtmp.c b/gear-lib/librtmpc/rtmp.c index 83e7087..b4ce2b2 100644 --- a/gear-lib/librtmpc/rtmp.c +++ b/gear-lib/librtmpc/rtmp.c @@ -3236,9 +3236,9 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize) } if (r->Link.protocol & RTMP_FEATURE_WRITE) { - for (int i = 0; i < r->Link.nStreams; i++) + for (i = 0; i < r->Link.nStreams; i++) SendReleaseStream(r, i); - for (int i = 0; i < r->Link.nStreams; i++) + for (i = 0; i < r->Link.nStreams; i++) SendFCPublish(r, i); } else @@ -3247,7 +3247,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize) RTMP_SendCtrl(r, 3, 0, 300); } - for (int i = 0; i < r->Link.nStreams; i++) + for (i = 0; i < r->Link.nStreams; i++) RTMP_SendCreateStream(r); if (!(r->Link.protocol & RTMP_FEATURE_WRITE)) @@ -3260,7 +3260,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize) SendFCSubscribe(r, &r->Link.subscribepath); else if (r->Link.lFlags & RTMP_LF_LIVE) { - for (int i = 0; i < r->Link.nStreams; i++) + for (i = 0; i < r->Link.nStreams; i++) SendFCSubscribe(r, &r->Link.streams[i].playpath); } } @@ -4435,11 +4435,11 @@ RTMP_Serve(RTMP *r) void RTMP_Close(RTMP *r) { - int i; + int i, idx; if (RTMP_IsConnected(r)) { - for (int idx = 0; idx < r->Link.nStreams; idx++) + for (idx = 0; idx < r->Link.nStreams; idx++) { if (r->Link.streams[idx].id > 0) { @@ -4460,7 +4460,7 @@ RTMP_Close(RTMP *r) RTMPSockBuf_Close(&r->m_sb); } - for (int idx = 0; idx < r->Link.nStreams; idx++) + for (idx = 0; idx < r->Link.nStreams; idx++) r->Link.streams[idx].id = -1; r->m_stream_id = -1; @@ -4537,7 +4537,7 @@ RTMP_Close(RTMP *r) #if defined(CRYPTO) || defined(USE_ONLY_MD5) if (!(r->Link.protocol & RTMP_FEATURE_WRITE) || (r->Link.pFlags & RTMP_PUB_CLEAN)) { - for (int idx = 0; idx < r->Link.nStreams; idx++) + for (idx = 0; idx < r->Link.nStreams; idx++) { free(r->Link.streams[idx].playpath.av_val); r->Link.streams[idx].playpath.av_val = NULL; diff --git a/gear-lib/librtsp/Makefile b/gear-lib/librtsp/Makefile index 2b643fd..880c391 100644 --- a/gear-lib/librtsp/Makefile +++ b/gear-lib/librtsp/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/librtsp/media_source_h264.c b/gear-lib/librtsp/media_source_h264.c index 99097e4..d5650b2 100644 --- a/gear-lib/librtsp/media_source_h264.c +++ b/gear-lib/librtsp/media_source_h264.c @@ -59,7 +59,8 @@ static void item_free_hook(void *data) static inline const uint8_t* h264_find_start_code(const uint8_t* ptr, const uint8_t* end) { - for (const uint8_t *p = ptr; p + 3 < end; p++) { + const uint8_t *p; + for (p = ptr; p + 3 < end; p++) { if (0x00 == p[0] && 0x00 == p[1] && (0x01 == p[2] || (0x00==p[2] && 0x01==p[3]))) { return p; } diff --git a/gear-lib/libskt/Makefile b/gear-lib/libskt/Makefile index 3360d10..0f51a44 100644 --- a/gear-lib/libskt/Makefile +++ b/gear-lib/libskt/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libsort/Makefile b/gear-lib/libsort/Makefile index 31900fe..ba38789 100644 --- a/gear-lib/libsort/Makefile +++ b/gear-lib/libsort/Makefile @@ -1,38 +1,28 @@ -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif -######## +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) + + LIBNAME = libsort +VERSION_SH = $(shell pwd)/version.sh $(LIBNAME) TGT_LIB_H = $(LIBNAME).h TGT_LIB_A = $(LIBNAME).a TGT_LIB_SO = $(LIBNAME).so +TGT_LIB_SO_VER = $(TGT_LIB_SO).${VER} TGT_UNIT_TEST = test_$(LIBNAME) OBJS_LIB = $(LIBNAME).o @@ -91,11 +81,12 @@ clean: install: $(MAKEDIR_OUTPUT) if [ "$(MODE)" = "release" ];then $(STRIP) $(TGT); fi - $(CP_V) -r $(TGT_LIB_H) $(OUTPUT)/include - $(CP_V) -r $(TGT_LIB_A) $(OUTLIBPATH)/lib - $(CP_V) -r $(TGT_LIB_SO) $(OUTLIBPATH)/lib + $(CP_V) -r $(TGT_LIB_H) $(OUTPUT)/include/gear-lib + $(CP_V) -r $(TGT_LIB_A) $(OUTLIBPATH)/lib/gear-lib + $(CP_V) -r $(TGT_LIB_SO) $(OUTLIBPATH)/lib/gear-lib uninstall: - cd $(OUTPUT)/include/ && rm -f $(TGT_LIB_H) - $(RM_V) -f $(OUTLIBPATH)/lib/$(TGT_LIB_A) - $(RM_V) -f $(OUTLIBPATH)/lib/$(TGT_LIB_SO) + cd $(OUTPUT)/include/gear-lib/ && rm -f $(TGT_LIB_H) + $(RM_V) -f $(OUTLIBPATH)/lib/gear-lib/$(TGT_LIB_A) + $(RM_V) -f $(OUTLIBPATH)/lib/gear-lib/$(TGT_LIB_SO) + $(RM_V) -f $(OUTLIBPATH)/lib/gear-lib/$(TGT_LIB_SO_VER) diff --git a/gear-lib/libstrex/Makefile b/gear-lib/libstrex/Makefile index c22cb04..2bc43db 100644 --- a/gear-lib/libstrex/Makefile +++ b/gear-lib/libstrex/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local -BUILD_DIR := $(shell pwd)/../build/ +BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libsubmask/Makefile b/gear-lib/libsubmask/Makefile index 1443e9b..9330a98 100644 --- a/gear-lib/libsubmask/Makefile +++ b/gear-lib/libsubmask/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libthread/Makefile b/gear-lib/libthread/Makefile index ea1a90b..148ed1b 100644 --- a/gear-lib/libthread/Makefile +++ b/gear-lib/libthread/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libthread/libthread.c b/gear-lib/libthread/libthread.c index f7775c8..6a420da 100644 --- a/gear-lib/libthread/libthread.c +++ b/gear-lib/libthread/libthread.c @@ -151,6 +151,8 @@ int thread_set_name(struct thread *t, const char *name) } strncpy(t->name, name, strlen(name)); return 0; +#else + return 0; #endif } diff --git a/gear-lib/libthread/libthread.h b/gear-lib/libthread/libthread.h index 2cb20ca..01ab487 100644 --- a/gear-lib/libthread/libthread.h +++ b/gear-lib/libthread/libthread.h @@ -22,6 +22,7 @@ #ifndef LIBTHREAD_H #define LIBTHREAD_H +#include #include #include #include @@ -29,10 +30,6 @@ #define _GNU_SOURCE #include #include -#elif defined (__WIN32__) || defined (WIN32) || defined (_MSC_VER) -#include "libposix4win.h" -#elif defined (FREERTOS) -#include "libposix4rtos/libposix4rtos.h" #endif #ifdef __cplusplus diff --git a/gear-lib/libuac/Makefile b/gear-lib/libuac/Makefile index f7a9a0c..46077ec 100644 --- a/gear-lib/libuac/Makefile +++ b/gear-lib/libuac/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libuvc/Makefile b/gear-lib/libuvc/Makefile index 343bc64..cceaaf9 100644 --- a/gear-lib/libuvc/Makefile +++ b/gear-lib/libuvc/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/win ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libvector/Makefile b/gear-lib/libvector/Makefile index a64af4e..e76162a 100644 --- a/gear-lib/libvector/Makefile +++ b/gear-lib/libvector/Makefile @@ -3,32 +3,20 @@ ############################################################################### #ARCH: linux/pi/android/ios/ ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object diff --git a/gear-lib/libworkq/Makefile b/gear-lib/libworkq/Makefile index d6081f3..a89c819 100644 --- a/gear-lib/libworkq/Makefile +++ b/gear-lib/libworkq/Makefile @@ -1,34 +1,22 @@ ############################################################################### # common ############################################################################### -#ARCH: linux/pi/android/ios/ +#ARCH: linux/arm/android/ios/ ARCH ?= linux -CROSS_PREFIX ?= OUTPUT ?= /usr/local BUILD_DIR := $(shell pwd)/../../build/ ARCH_INC := $(BUILD_DIR)/$(ARCH).inc COLOR_INC := $(BUILD_DIR)/color.inc -ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC))) include $(ARCH_INC) -endif - -CC = $(CROSS_PREFIX)gcc -CXX = $(CROSS_PREFIX)g++ -LD = $(CROSS_PREFIX)ld -AR = $(CROSS_PREFIX)ar -STRIP = $(CROSS_PREFIX)strip - -ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC))) include $(COLOR_INC) -else -CC_V = $(CC) -CXX_V = $(CXX) -LD_V = $(LD) -AR_V = $(AR) -CP_V = $(CP) -RM_V = $(RM) -endif + +CC_V ?= $(CC) +CXX_V ?= $(CXX) +LD_V ?= $(LD) +AR_V ?= $(AR) +CP_V ?= $(CP) +RM_V ?= $(RM) ############################################################################### # target and object