diff --git a/doc/F-Stack_Build_Guide.md b/doc/F-Stack_Build_Guide.md index 8ca628c63..655ab82c4 100644 --- a/doc/F-Stack_Build_Guide.md +++ b/doc/F-Stack_Build_Guide.md @@ -58,15 +58,6 @@ $ cd ../examples $ make ``` -## Compile tools in Ubuntu - -- remove '\\' in statement printf at f-stack/tools/netstat/Makefile line 70, now it should be: - -``` -- printf("\#define\tN%s\t%s\n", toupper($$2), i++); -+ printf("#define\tN%s\t%s\n", toupper($$2), i++); -``` - ## Compile dpdk in virtual machine - f-stack/dpdk/kernel/linux/igb_uio/igb_uio.c line 274: diff --git a/tools/netstat/Makefile b/tools/netstat/Makefile index 9bcb93dce..3ebbd61f0 100644 --- a/tools/netstat/Makefile +++ b/tools/netstat/Makefile @@ -49,6 +49,8 @@ endif include ${TOPDIR}/tools/prog.mk +UNAME := $(shell uname) + nl_symbols.c: nlist_symbols awk '\ BEGIN { \ @@ -60,6 +62,7 @@ nl_symbols.c: nlist_symbols END { print "\t{ .n_name = NULL },\n};" } \ ' < $^ > $@ +ifeq ($(UNAME), Linux) nl_defs.h: nlist_symbols awk '\ BEGIN { \ @@ -67,6 +70,16 @@ nl_defs.h: nlist_symbols print "extern struct nlist nl[];"; \ i = 0; \ } \ - !/^\#/ { printf("\#define\tN%s\t%s\n", toupper($$2), i++); }' \ + !/^\#/ { printf("#define\tN%s\t%s\n", toupper($$2), i++); }' \ < $^ > $@ - +else +nl_defs.h: nlist_symbols + awk '\ + BEGIN { \ + print "#include "; \ + print "extern struct nlist nl[];"; \ + i = 0; \ + } \ + !/^\#/ { printf("\#define\tN%s\t%s\n", toupper($$2), i++); }' \ + < $^ > $@ +endif