Browse Source

【增加】各模块代码宏开关。

Signed-off-by: armink <armink.ztl@gmail.com>
armink 7 years ago
parent
commit
f1a0631a07
6 changed files with 21 additions and 3 deletions
  1. 3 1
      iperf/iperf.c
  2. 5 0
      netio/netio.c
  3. 4 1
      ntp/ntp.c
  4. 4 0
      ping/ping.c
  5. 3 1
      tcpdump/tcpdump.c
  6. 2 0
      telnet/telnet.c

+ 3 - 1
iperf/iperf.c

@@ -3,8 +3,9 @@
 *
 */
 
-#include <rtdef.h>
 #include <rtthread.h>
+
+#ifdef PKG_NETUTILS_IPERF
 #include <rtdevice.h>
 
 #include <stdint.h>
@@ -325,3 +326,4 @@ __usage:
 #include <finsh.h>
 MSH_CMD_EXPORT(iperf, - the network bandwidth measurement tool);
 #endif
+#endif /* PKG_NETUTILS_IPERF */

+ 5 - 0
netio/netio.c

@@ -30,6 +30,10 @@
  * This file is part of the lwIP TCP/IP stack.
  *
  */
+
+#include <rtthread.h>
+
+#ifdef PKG_NETUTILS_NETIO
 #include "lwip/opt.h"
 
 #if LWIP_TCP
@@ -446,3 +450,4 @@ FINSH_FUNCTION_EXPORT(netio_init, netio server);
 MSH_CMD_EXPORT(netio_init, netio server);
 #endif /* FINSH_USING_MSH */
 #endif /* RT_USING_FINSH */
+#endif /* PKG_NETUTILS_NETIO */

+ 4 - 1
ntp/ntp.c

@@ -18,6 +18,9 @@
  *
  */
 
+#include <rtthread.h>
+
+#ifdef PKG_NETUTILS_NTP
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -27,7 +30,6 @@
 #include <sys/select.h>
 #include <netinet/in.h>
 #include <netdb.h>
-#include <rtthread.h>
 
 #ifdef NETUTILS_NTP_TIMEZONE
 #define NTP_TIMEZONE                   NETUTILS_NTP_TIMEZONE
@@ -302,3 +304,4 @@ static void cmd_ntp_sync(int argc, char **argv)
 FINSH_FUNCTION_EXPORT(ntp_sync, Update time by NTP(Network Time Protocol): ntp_sync(host_name));
 MSH_CMD_EXPORT_ALIAS(cmd_ntp_sync, ntp_sync, Update time by NTP(Network Time Protocol): ntp_sync [host_name]);
 #endif /* RT_USING_FINSH */
+#endif /* PKG_NETUTILS_NTP */

+ 4 - 0
ping/ping.c

@@ -23,6 +23,9 @@
  * 2018-01-25     armink       Add ping domain name
  */
 
+#include <rtthread.h>
+
+#ifdef PKG_NETUTILS_PING
 #include <lwip/opt.h>
 #include <lwip/init.h>
 #include <lwip/mem.h>
@@ -245,3 +248,4 @@ int cmd_ping(int argc, char **argv)
 }
 FINSH_FUNCTION_EXPORT_ALIAS(cmd_ping, __cmd_ping, ping network host);
 #endif
+#endif /* PKG_NETUTILS_PING */

+ 3 - 1
tcpdump/tcpdump.c

@@ -24,8 +24,9 @@
  */
 
 #include <rtthread.h>
+
+#ifdef PKG_NETUTILS_TCPDUMP
 #include <dfs_posix.h>
-#include <rtdef.h>
 #include "netif/ethernetif.h"
 #include "optparse.h"
 
@@ -733,3 +734,4 @@ static int tcpdump_test(int argc, char *argv[])
     #include <finsh.h>
     MSH_CMD_EXPORT_ALIAS(tcpdump_test, tcpdump, test optparse_short cmd.);
 #endif
+#endif /* PKG_NETUTILS_TCPDUMP */

+ 2 - 0
telnet/telnet.c

@@ -25,6 +25,7 @@
 #include <rtthread.h>
 #include <rtdevice.h>
 
+#ifdef PKG_NETUTILS_TELNET
 #if defined(RT_USING_DFS_NET) || defined(SAL_USING_POSIX)
 #include <sys/socket.h>
 #else
@@ -488,3 +489,4 @@ FINSH_FUNCTION_EXPORT(telnet_server, startup telnet server);
 MSH_CMD_EXPORT(telnet_server, startup telnet server)
 #endif /* FINSH_USING_MSH */
 #endif /* RT_USING_FINSH */
+#endif /* PKG_NETUTILS_TELNET */