Add FreeBSD support

FreeBSD support, reworked from earlier pr by @neveragainde
This commit is contained in:
Michael Norton 2019-03-31 17:57:48 -06:00 committed by GitHub
parent a2480a2769
commit f497d7481f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 9 deletions

View File

@ -1,8 +1,5 @@
PROGNAME=dump1090
RTLSDR ?= yes
BLADERF ?= yes
CPPFLAGS += -DMODES_DUMP1090_VERSION=\"$(DUMP1090_VERSION)\" -DMODES_DUMP1090_VARIANT=\"dump1090-fa\"
DIALECT = -std=c11
@ -12,8 +9,9 @@ LIBS = -lpthread -lm
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
LIBS += -lrt
CFLAGS += -D_DEFAULT_SOURCE
LIBS += -lrt
LIBS_USB += -lusb-1.0
endif
ifeq ($(UNAME), Darwin)
@ -23,13 +21,27 @@ ifeq ($(UNAME), Darwin)
endif
CFLAGS += -DMISSING_NANOSLEEP
COMPAT += compat/clock_nanosleep/clock_nanosleep.o
LIBS_USB += -lusb-1.0
BLADERF ?= no
endif
ifeq ($(UNAME), OpenBSD)
CFLAGS += -DMISSING_NANOSLEEP
COMPAT += compat/clock_nanosleep/clock_nanosleep.o
LIBS_USB += -lusb-1.0
BLADERF ?= no
endif
ifeq ($(UNAME), FreeBSD)
CFLAGS += -D_DEFAULT_SOURCE
LIBS += -lrt
LIBS_USB += -lusb
BLADERF ?= no
endif
RTLSDR ?= yes
BLADERF ?= yes
ifeq ($(RTLSDR), yes)
SDR_OBJ += sdr_rtlsdr.o
CPPFLAGS += -DENABLE_RTLSDR
@ -38,14 +50,14 @@ ifeq ($(RTLSDR), yes)
CPPFLAGS += -I$(RTLSDR_PREFIX)/include
LDFLAGS += -L$(RTLSDR_PREFIX)/lib
else
CFLAGS += $(shell pkg-config --cflags librtlsdr)
CFLAGS += $(shell pkg-config --cflags-only-I librtlsdr)
LDFLAGS += $(shell pkg-config --libs-only-L librtlsdr)
endif
ifeq ($(STATIC), yes)
LIBS_SDR += -Wl,-Bstatic -lrtlsdr -Wl,-Bdynamic -lusb-1.0
LIBS_SDR += -Wl,-Bstatic -lrtlsdr -Wl,-Bdynamic $(LIBS_USB)
else
LIBS_SDR += -lrtlsdr -lusb-1.0
LIBS_SDR += -lrtlsdr $(LIBS_USB)
endif
endif

View File

@ -44,7 +44,7 @@ Binaries are built in the source directory; you will need to arrange to
install them (and a method for starting them) yourself.
"make BLADERF=no" will disable bladeRF support and remove the dependency on
libbladeRF. This may be required on some platforms (e.g. MacOS).
libbladeRF. Default is yes on Linux, no on other platforms.
"make RTLSDR=no" will disable rtl-sdr support and remove the dependency on
librtlsdr.
librtlsdr. Default is yes.

View File

@ -18,6 +18,9 @@
# define le16toh(x) OSSwapLittleToHostInt16(x)
# define le32toh(x) OSSwapLittleToHostInt32(x)
#elif defined(__FreeBSD__)
#include <sys/endian.h>
#else // other platforms
# include <endian.h>