Page MenuHomeFreeBSD

Add necessary include dirs & clean up style
Needs ReviewPublic

Authored by moritz_schmi.tt on Sep 19 2020, 8:51 PM.

Details

Reviewers
thj
Group Reviewers
network
Summary

Make usr.bin/netstat/Makefile use the header files from the build tree like usr.bin/truss/Makefile does. Otherwise netstat won't compile on older system. Clean up formatting according to style.Makefile(5).

Test Plan

Run make in usr.bin/netstat using source from CURRENT on FreeBSD 12.1.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 33656
Build 30897: arc lint + arc unit

Event Timeline

usr.bin/netstat/Makefile
33–37

Does it make sense to group the include lines, even if not on one line

usr.bin/netstat/Makefile
33

This looks bogus to me. We're already CD'd to ${.OBJDIR} so we'll pickup files there automatically. why is it needed?

34

Why is this needed?

usr.bin/netstat/Makefile
34

More specifically, what's broken when you do a 'make buildenv' and then 'make' to build this? There's a number of issues building on older systems, and adding this only catches a small subset of them...

usr.bin/netstat/Makefile
33

This was already in the Makefile. I don't know what it's needed for and I don't know where the CD happens you mentioned but quite a few other Makefiles seem to contain such a CFLAGS line.

34

When you just do a 'make buildenv' and then 'make' things seem to become more broken. make can't even find cdefs.h. anymore. One might need to do 'make toolchain' before but that takes ages to finish. Including the above CFLAGS line makes netstat buildable from its directory without any further requirements.

On the other hand, I don't know much about your build process. Maybe my suggested fix is not the right one if one takes a wider context into account.

usr.bin/netstat/Makefile
34

'make toolchain' of a CURRENT source tree doesn't finish on 12.1. It seems to be unhappy about the FreeBSD version:

(...)
In file included from /usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/stdint.h:106:
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/__config:348:27: error: invalid token at start of a preprocessor expression
#    if __FreeBSD_version >= 1300064 || \
                          ^
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/__config:1225:56: error: invalid token at start of a preprocessor expression
      (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043)