More hacking on the Makefile to get it working nicely on both jessie + wheezy.
This commit is contained in:
parent
b213ab9a50
commit
bef563b8a3
57
Makefile
57
Makefile
|
@ -1,56 +1,33 @@
|
||||||
#
|
|
||||||
# When building a package or installing otherwise in the system, make
|
|
||||||
# sure that the variable PREFIX is defined, e.g. make PREFIX=/usr/local
|
|
||||||
#
|
|
||||||
PROGNAME=dump1090
|
PROGNAME=dump1090
|
||||||
|
|
||||||
ifndef DUMP1090_VERSION
|
CC=gcc -std=c1x
|
||||||
DUMP1090_VERSION=$(shell git describe --tags --match=v*)
|
CPPFLAGS += -DMODES_DUMP1090_VERSION=\"$(DUMP1090_VERSION)\" -DMODES_DUMP1090_VARIANT=\"dump1090-fa\"
|
||||||
|
|
||||||
|
ifneq ($(RTLSDR_PREFIX),"")
|
||||||
|
CPPFLAGS += -I$(RTLSDR_PREFIX)/include
|
||||||
|
LDFLAGS += -L$(RTLSDR_PREFIX)/lib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef PREFIX
|
ifneq ($(HTMLPATH),"")
|
||||||
BINDIR=$(PREFIX)/bin
|
CPPFLAGS += -DHTMLPATH=\"$(HTMLPATH)\"
|
||||||
SHAREDIR=$(PREFIX)/share/$(PROGNAME)
|
|
||||||
EXTRACFLAGS=-DHTMLPATH=\"$(SHAREDIR)\"
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CPPFLAGS+=-DMODES_DUMP1090_VERSION=\"$(DUMP1090_VERSION)\"
|
CFLAGS += -O2 -g -Wall -Werror -W -D_DEFAULT_SOURCE
|
||||||
CFLAGS+=-O2 -g -Wall -Werror -W
|
LIBS = -lpthread -lm -lrt
|
||||||
LIBS=-lpthread -lm
|
|
||||||
ifeq ($(STATIC), yes)
|
ifeq ($(STATIC), yes)
|
||||||
LIBS_RTL=-Wl,-Bstatic -lrtlsdr -Wl,-Bdynamic -lusb-1.0
|
LIBS_RTLSDR = -Wl,-Bstatic -lrtlsdr -Wl,-Bdynamic -lusb-1.0
|
||||||
else
|
else
|
||||||
LIBS_RTL=-lrtlsdr -lusb-1.0
|
LIBS_RTLSDR = -lrtlsdr -lusb-1.0
|
||||||
endif
|
|
||||||
CC=gcc
|
|
||||||
|
|
||||||
UNAME := $(shell uname)
|
|
||||||
|
|
||||||
ifeq ($(UNAME), Linux)
|
|
||||||
LIBS+=-lrt
|
|
||||||
CFLAGS+=-std=c11 -D_DEFAULT_SOURCE
|
|
||||||
endif
|
|
||||||
ifeq ($(UNAME), Darwin)
|
|
||||||
# TODO: Putting GCC in C11 mode breaks things.
|
|
||||||
CFLAGS+=-std=c11 -DMISSING_GETTIME -DMISSING_NANOSLEEP
|
|
||||||
COMPAT+=compat/clock_gettime/clock_gettime.o compat/clock_nanosleep/clock_nanosleep.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(UNAME), OpenBSD)
|
|
||||||
CFLAGS+= -DMISSING_NANOSLEEP
|
|
||||||
COMPAT+= compat/clock_nanosleep/clock_nanosleep.o
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: dump1090 view1090
|
all: dump1090 view1090
|
||||||
|
|
||||||
%.o: %.c *.h
|
%.o: %.c *.h
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRACFLAGS) -c $< -o $@
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
dump1090: LDFLAGS += `pkg-config --libs-only-L librtlsdr`
|
|
||||||
dump1090.o: CFLAGS += `pkg-config --cflags librtlsdr`
|
|
||||||
|
|
||||||
dump1090: dump1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o crc.o demod_2400.o stats.o cpr.o icao_filter.o track.o util.o convert.o $(COMPAT)
|
dump1090: dump1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o crc.o demod_2400.o stats.o cpr.o icao_filter.o track.o util.o convert.o $(COMPAT)
|
||||||
$(CC) -g -o $@ $^ $(LDFLAGS) $(LIBS) $(LIBS_RTL)
|
$(CC) -g -o $@ $^ $(LDFLAGS) $(LIBS) $(LIBS_RTLSDR)
|
||||||
|
|
||||||
view1090: view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o crc.o stats.o cpr.o icao_filter.o track.o util.o $(COMPAT)
|
view1090: view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o crc.o stats.o cpr.o icao_filter.o track.o util.o $(COMPAT)
|
||||||
$(CC) -g -o $@ $^ $(LDFLAGS) $(LIBS)
|
$(CC) -g -o $@ $^ $(LDFLAGS) $(LIBS)
|
||||||
|
@ -65,7 +42,7 @@ test: cprtests
|
||||||
./cprtests
|
./cprtests
|
||||||
|
|
||||||
cprtests: cpr.o cprtests.o
|
cprtests: cpr.o cprtests.o
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRACFLAGS) -g -o $@ $^ -lm
|
$(CC) $(CPPFLAGS) $(CFLAGS) -g -o $@ $^ -lm
|
||||||
|
|
||||||
crctests: crc.c crc.h
|
crctests: crc.c crc.h
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRACFLAGS) -g -DCRCDEBUG -o $@ $<
|
$(CC) $(CPPFLAGS) $(CFLAGS) -g -DCRCDEBUG -o $@ $<
|
||||||
|
|
|
@ -22,7 +22,7 @@ install_rtlsdr:
|
||||||
cd rtl-sdr-build && cmake ../rtl-sdr -DCMAKE_INSTALL_PREFIX=./install && make install
|
cd rtl-sdr-build && cmake ../rtl-sdr -DCMAKE_INSTALL_PREFIX=./install && make install
|
||||||
|
|
||||||
override_dh_auto_build: install_rtlsdr
|
override_dh_auto_build: install_rtlsdr
|
||||||
dh_auto_build -- 'EXTRACFLAGS=-DHTMLPATH=\"/usr/share/$(SRCNAME)/html\" -DMODES_DUMP1090_VARIANT=\"$(SRCNAME)\"' STATIC=yes PKG_CONFIG_PATH=rtl-sdr-build/install/lib/pkgconfig
|
dh_auto_build -- HTMLPATH=/usr/share/$(SRCNAME)/html DUMP1090_VERSION=$(DUMP1090_VERSION) STATIC=yes RTLSDR_PREFIX=rtl-sdr-build/install
|
||||||
|
|
||||||
override_dh_install:
|
override_dh_install:
|
||||||
dh_install
|
dh_install
|
||||||
|
|
4
debian/rules
vendored
4
debian/rules
vendored
|
@ -14,11 +14,11 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||||
DPKG_EXPORT_BUILDFLAGS = 1
|
DPKG_EXPORT_BUILDFLAGS = 1
|
||||||
include /usr/share/dpkg/buildflags.mk
|
include /usr/share/dpkg/buildflags.mk
|
||||||
|
|
||||||
export DUMP1090_VERSION=$(shell dpkg-parsechangelog | sed -n 's/^Version: /v/p')
|
DUMP1090_VERSION=$(shell dpkg-parsechangelog | sed -n 's/^Version: /v/p')
|
||||||
SRCNAME=$(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
|
SRCNAME=$(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
|
||||||
|
|
||||||
override_dh_auto_build:
|
override_dh_auto_build:
|
||||||
dh_auto_build -- 'EXTRACFLAGS=-DHTMLPATH=\"/usr/share/$(SRCNAME)/html\" -DMODES_DUMP1090_VARIANT=\"$(SRCNAME)\"'
|
dh_auto_build -- HTMLPATH=/usr/share/$(SRCNAME)/html DUMP1090_VERSION=$(DUMP1090_VERSION) RTLSDR_PREFIX=/usr
|
||||||
|
|
||||||
override_dh_install:
|
override_dh_install:
|
||||||
dh_install
|
dh_install
|
||||||
|
|
Loading…
Reference in a new issue