mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
[linux] Static link LIBC library
This commit is contained in:
@@ -39,12 +39,12 @@ else
|
||||
FLOAT_ABI ?= -mfloat-abi=softfp -mfpu=vfp
|
||||
endif
|
||||
|
||||
ARCH_FLAGS ?= -mtune=cortex-a8 -march=armv7-a
|
||||
ARCH_CFLAGS ?= -mtune=cortex-a8 -march=armv7-a
|
||||
|
||||
# add ARM specifc flags to CFLAGS, LDFLAGS
|
||||
CFLAGS += $(FLOAT_ABI) $(ARCH_FLAGS)
|
||||
CFLAGS += $(FLOAT_ABI) $(ARCH_CFLAGS)
|
||||
LDFLAGS += $(FLOAT_ABI)
|
||||
CXXFLAGS += $(FLOAT_ABI) $(ARCH_FLAGS)
|
||||
CXXFLAGS += $(FLOAT_ABI) $(ARCH_CFLAGS)
|
||||
|
||||
# include the common linux Makefile (common CFLAGS, actual targets)
|
||||
include $(PAPARAZZI_SRC)/conf/Makefile.linux
|
||||
|
||||
@@ -42,6 +42,10 @@ $(TARGET).CFLAGS +=-DARDRONE2_RAW
|
||||
# handle linux signals by hand
|
||||
$(TARGET).CFLAGS += -DUSE_LINUX_SIGNAL
|
||||
|
||||
# Link static (Done for GLIBC)
|
||||
$(TARGET).CFLAGS += -DLINUX_LINK_STATIC
|
||||
$(TARGET).LDFLAGS += -static
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
# default LED configuration
|
||||
|
||||
@@ -34,6 +34,10 @@ $(TARGET).CFLAGS += -DUSE_LINUX_SIGNAL
|
||||
# Compile the video specific parts
|
||||
$(TARGET).srcs += $(SRC_BOARD)/video.c
|
||||
|
||||
# Link static (Done for GLIBC)
|
||||
$(TARGET).CFLAGS += -DLINUX_LINK_STATIC
|
||||
$(TARGET).LDFLAGS += -static
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
# default LED configuration
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/**
|
||||
* Create UDP socket and bind it.
|
||||
* @param[out] sock pointer to already allocated UdpSocket struct
|
||||
* @param[in] host hostname/address
|
||||
* @param[in] host ip address or hostname (hostname not possible if static linking)
|
||||
* @param[in] port_out output port
|
||||
* @param[in] port_in input port (set to < 0 to disable)
|
||||
* @param[in] broadcast if TRUE enable broadcasting
|
||||
@@ -52,6 +52,7 @@ int udp_socket_create(struct UdpSocket *sock, char *host, int port_out, int port
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifndef LINUX_LINK_STATIC
|
||||
/* try to convert host ipv4 address to binary format */
|
||||
struct in_addr host_ip;
|
||||
if (!inet_aton(host, &host_ip)) {
|
||||
@@ -71,6 +72,7 @@ int udp_socket_create(struct UdpSocket *sock, char *host, int port_out, int port
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Create the socket with the correct protocl
|
||||
sock->sockfd = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
@@ -96,7 +98,11 @@ int udp_socket_create(struct UdpSocket *sock, char *host, int port_out, int port
|
||||
// set the output/destination address for use in sendto later
|
||||
sock->addr_out.sin_family = PF_INET;
|
||||
sock->addr_out.sin_port = htons(port_out);
|
||||
#ifndef LINUX_LINK_STATIC
|
||||
sock->addr_out.sin_addr.s_addr = host_ip.s_addr;
|
||||
#else
|
||||
sock->addr_out.sin_addr.s_addr = inet_addr(host);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user