Skip to content

Instantly share code, notes, and snippets.

@gvanem
Created February 8, 2025 14:54
Show Gist options
  • Save gvanem/334e515789cc052e0d2a0409a87ded32 to your computer and use it in GitHub Desktop.
Save gvanem/334e515789cc052e0d2a0409a87ded32 to your computer and use it in GitHub Desktop.
GNU-makefile for Qt-DAB (Qt5 and clang-cl only)
#
# GNU-makefile for Qt-DAB-6 using clang-cl.
# (MSVC cannot build this due to heavy use of VLA etc.)
#
# By G. Vanem <gvanem@yahoo.no>.
#
THIS_FILE := Makefile.Windows
TODAY := $(shell date +%d-%B-%Y)
MAKEFLAGS += --warn-undefined-variables
#
# Main Qt-DAB sources are here:
#
DAB_DIR = ./qt-dab-6.9
#
# From 'qt-dab-6.9/CMakeLists.txt':
#
VER_MAJOR = 6
VER_MINOR = 9
VER_MICRO = 0
VERSION = $(VER_MAJOR).$(VER_MINOR).$(VER_MICRO)
#
# Options:
#
USE_AIRSPY = 0
USE_EPG_TRACE = 0
USE_EXTIO = 1
USE_HACKRF = 0
USE_LIME = 0
USE_PLUTO = 0
USE_RTLSDR = 1
USE_RTL_TCP = 1
USE_SDRPLAY_V2 = 0
USE_SDRPLAY_V3 = 1
USE_SOAPY = 0
USE_SPYSERVER_8 = 1
USE_SPYSERVER_16 = 1
USE_WSOCK_TRACE = 0
USE_GUI_LDFLAGS = 0
#
# Use the 'src/support/viterbi-spiral/spiral-sse.c'?
# It could crash due to alignment problems.
#
USE_SSE_SPIRAL = 0
USE_TCP_STREAMER = 0
TARGETS = bin/qt-DAB-6.exe
EX_LIBS =
OS_LIBS =
#
# The roots for the various SDR APIs.
#
AIRSPY_ROOT ?= f:/gv/dx-radio/AirSpy
AD9361_ROOT ?= f:/gv/dx-radio/libad9361-iio
BLADERF_ROOT ?= f:/gv/dx-radio/Blade-RF
HACKRF_ROOT ?= f:/gv/dx-radio/Hack-RF
LIME_ROOT ?= f:/gv/dx-radio/LimeSuite
RTLSDR_ROOT ?= f:/gv/dx-radio/Osmocom-SDR/other-librtlsdr-from-Github/old-DAB
SDRPLAY2_ROOT ?= f:/gv/dx-radio/SDRplay/APIs/v3.07
SDRPLAY3_ROOT ?= f:/gv/dx-radio/SDRplay/APIs/v3.15
#
# Select Qt5 or Qt6:
#
QT_ROOT = $(realpath $(QTDIR))
QT_MAJOR = $(word 1, $(subst ., ,$(QT_VER)))
qt_lib = $(addprefix $(QT_ROOT)/lib/Qt$(QT_MAJOR), $(1))
#
# The roots for other packages.
#
FAAD2_ROOT ?= f:/gv/dx-radio/Coders-Decoders/faad2
LIBIIO_ROOT ?= f:/gv/dx-radio/libiio
QWT_ROOT ?= f:/gv/Qt/Qwt6
SERIALPORT_ROOT ?= f:/MinGW32/src/libserialport
ZLIB_ROOT ?= f:/MinGW32/src/Compression/zlib
FFTW_ROOT ?= f:/MinGW32/src/Sound/FFTW-3.x
PORTAUDIO_ROOT ?= f:/MinGW32/src/Sound/Portaudio
#
# Option for C/C++ preprocess rules.
#
USE_ASTYLE ?= 1
#
# Compile a lot faster. For 'cl' only.
#
USE_MP_COMPILE = 1
PYTHON ?= py -3
define Usage
Usage: "make -f $(THIS_FILE) <CPU=x86|x64> [CC=cl | clang-cl] [all | clean | vclean | depend]")
Specify CC=cl - build with MSVC
Specify CC=clang-cl - build with clang-cl
endef
CFLAGS = -nologo -MD -W3 -Zi -Ot -GF -GS \
-arch:AVX2 -FI./$(OBJ_DIR)/config.h
LDFLAGS = -nologo -debug -incremental:no \
-verbose -map -machine:$(CPU) \
-nodefaultlib:dsound.lib \
-nodefaultlib:oldnames.lib \
-nodefaultlib:uuid.lib
ifeq ($(USE_WSOCK_TRACE),1)
LDFLAGS += -nodefaultlib:ws2_32.lib
WS2_32_LIB = wsock_trace-$(CPU).lib
else
WS2_32_LIB = ws2_32.lib
endif
#
# 'c_to_obj' returns a list of object files for .c-files.
# 'cpp_to_obj' returns a list of object files for .cpp-files.
#
c_to_obj = $(addprefix $(OBJ_DIR)/, $(notdir $(1:.c=.obj)) )
cpp_to_obj = $(addprefix $(OBJ_DIR)/, $(notdir $(1:.cpp=.obj)) )
c_to_i = $(notdir $(1:.c=.i))
cpp_to_i = $(notdir $(1:.cpp=.i))
ui_to_h = $(addprefix $(OBJ_DIR)/ui_, $(notdir $(1:.ui=.h)))
h_to_moc = $(addprefix $(OBJ_DIR)/moc_, $(notdir $(1:.h=.cpp)))
default: all
qt_test:
$(call green_msg, QT_ROOT: $(QT_ROOT))
$(call green_msg, QT_MAJOR: $(QT_MAJOR))
ifeq ($(CC),clang-cl)
CC_NAME = clang-cl
#
# '-C': Retain comments in /E mode
# '-d1PP': Retain macro definitions in /E mode
#
CPP_CMD = $(CC) -E -C -d1PP
else ifeq ($(CC),cl)
CC_NAME = MSVC
CPP_CMD = $(CC) -E
else
$(error $(Usage))
endif
#
# Do not allow 'CFLAGS' from this env-var.
#
export CL=
#
# 'clang-cl' could pick up .h-files from these places.
# Avoid that.
#
export C_INCLUDE_PATH=
export CPLUS_INCLUDE_PATH=
OBJ_DIR = objects
CFLAGS += -I$(DAB_DIR) \
-I$(DAB_DIR)/forms-v7 \
-I$(DAB_DIR)/forms-v7/new-display \
-I$(DAB_DIR)/forms-v7/new-display/scopes \
-I$(DAB_DIR)/forms-v7/snr-viewer \
-I$(DAB_DIR)/support \
# -D__ARCH_X86__
CFLAGS += -I. \
-I./eti-handler \
-I./src/support/tii-library \
-I./includes \
-I./includes/backend \
-I./includes/backend/data \
-I./includes/backend/data/epg \
-I./includes/backend/data/epg-2 \
-I./includes/backend/data/journaline \
-I./includes/backend/data/mot \
-I./includes/ofdm \
-I./includes/output \
-I./includes/output/Qt$(QT_MAJOR) \
-I./includes/protection \
-I./includes/scopes-qwt6 \
-I./includes/support \
-I./includes/support/buttons \
-I./qt-devices \
-I./qt-devices/filereaders \
-I./qt-devices/filereaders/new-reader \
-I./qt-devices/filereaders/rawfiles-new \
-I./qt-devices/filereaders/xml-filereader \
-I./$(OBJ_DIR)
#
# This must come before '$(FAAD2_ROOT)/include' which MAY contain
# an incompatible 'getopt.h'.
#
CFLAGS += -I./src/support
CFLAGS += -I$(QT_ROOT)/include \
-I$(QT_ROOT)/include/QtCore \
-I$(QT_ROOT)/include/QtWidgets \
-I$(QT_ROOT)/include/QtMultimedia \
-I$(QT_ROOT)/include/QtNetwork \
-I$(QT_ROOT)/include/QtXml \
-I$(QWT_ROOT)/src \
-I$(FFTW_ROOT)/api \
-I$(PORTAUDIO_ROOT)/include \
-I$(ZLIB_ROOT)
#
# Disable the 'Pa_memory' barries CPU hogs.
#
# CFLAGS += -DALLOW_SMP_DANGERS
#
# We MUST use the newer version (3 March 2012) of 'neaacdec.h'.
# Since the one in 'includes/backend/audio/neaacdec.h' is much
# older (26 Jan 2009) and is incompatible with the one installed
# using 'vcpkg'.
#
# It's also vital that 'moc' uses the correct path to this header;
# $(MOC_FLAGS) contains the same order of '_i' paths.
#
# CFLAGS += -I$(FAAD2_ROOT)/include
#
# The older 'neaacdec.h' is here:
#
CFLAGS += -I./includes/backend/audio
#
# CFLAGS specific to C++.
# But add '-Zc:__cplusplus' to 'CFLAGS' (gets ignored for plain C).
#
CXXFLAGS = -std:c++17 -EHsc
CFLAGS += -Zc:__cplusplus
#
# CFLAGS specific for clang-cl.
# (but the warnings are different in different sub-projects).
#
ifeq ($(CC),clang-cl)
CFLAGS += -fms-compatibility \
-ferror-limit=5
endif
#
# .DLL files to be copied to './bin'.
#
COPY_DLLs = $(FAAD2_ROOT)/bin/faad2-$(CPU).{dll,pdb}
ifeq ($(USE_GUI_LDFLAGS),1)
LDFLAGS += -subsystem:windows
CFLAGS += -DQT_NO_DEBUG \
-DQT_NO_DEBUG_OUTPUT \
-DNDEBUG
ifeq ($(QT_MAJOR),5)
EX_LIBS += $(QT_ROOT)/lib/qtmain.lib
endif
else
LDFLAGS += -subsystem:console
endif
OS_LIBS += advapi32.lib \
ole32.lib \
shell32.lib \
user32.lib \
uuid.lib \
winmm.lib \
$(WS2_32_LIB)
EX_LIBS += $(call qt_lib, \
Core.lib \
Gui.lib \
Svg.lib \
Widgets.lib \
Xml.lib)
EX_LIBS += $(FAAD2_ROOT)/lib/faad2-$(CPU).lib \
$(ZLIB_ROOT)/lib/zlib-$(CPU).lib \
$(FFTW_ROOT)/lib/fftw3f-$(CPU).lib \
$(PORTAUDIO_ROOT)/lib/portaudio-$(CPU).lib \
$(QWT_ROOT)/lib/Qwt$(QT_MAJOR)_static-$(CPU).lib
ifeq ($(USE_WSOCK_TRACE),1)
COPY_DLLs += $(realpath $(VSINSTALLDIR))/bin/wsock_trace-$(CPU).{dll,pdb}
endif
vpath %.cpp $(DAB_DIR)
CPP_SOURCES = $(DAB_DIR)/main.cpp \
$(DAB_DIR)/radio.cpp
vpath %.h $(DAB_DIR)
MOC_HEADERS = $(DAB_DIR)/http-handler.h \
$(DAB_DIR)/radio.h
MOC_HEADERS += ofdm-handler.h
vpath %.c src/backend/data/journaline
C_SOURCES = $(addprefix src/backend/data/journaline/, \
crc_8_16.c \
dabdgdec_impl.c \
log.c)
vpath %.c src/support
C_SOURCES += src/support/missing.c
vpath %.c src/support/viterbi-spiral
ifeq ($(USE_SSE_SPIRAL),1)
CFLAGS += -I./src/support/viterbi-spiral -DSSE_AVAILABLE
vpath %.cpp src/support/viterbi-spiral
CPP_SOURCES += src/support/viterbi-spiral/viterbi.cpp
C_SOURCES += src/support/viterbi-spiral/spiral-sse.c
else
CFLAGS += -I./src/support/viterbi
vpath %.cpp src/support/viterbi
CPP_SOURCES += src/support/viterbi/viterbi.cpp
C_SOURCES += src/support/viterbi-spiral/spiral-no-sse.c
endif
vpath %.cpp $(DAB_DIR)/forms-v7/new-display
CPP_SOURCES += $(DAB_DIR)/forms-v7/new-display/display-widget.cpp
vpath %.cpp $(DAB_DIR)/forms-v7/new-display/scopes
CPP_SOURCES += $(addprefix $(DAB_DIR)/forms-v7/new-display/scopes/, \
audio-display.cpp \
channel-scope.cpp \
correlation-scope.cpp \
dev-scope.cpp \
iqdisplay.cpp \
null-scope.cpp \
spectrogramdata.cpp \
spectrum-scope.cpp \
waterfall-scope.cpp)
CPP_SOURCES += ofdm-handler.cpp
vpath %.cpp eti-handler
CPP_SOURCES += eti-handler/eti-generator.cpp
vpath %.cpp qt-devices
CPP_SOURCES += $(addprefix qt-devices/, \
device-chooser.cpp \
device-handler.cpp \
xml-filewriter.cpp)
vpath %.h qt-devices
MOC_HEADERS += qt-devices/device-handler.h
vpath %.cpp qt-devices/filereaders/new-reader
CPP_SOURCES += $(addprefix qt-devices/filereaders/new-reader/, \
new-reader.cpp \
newfiles.cpp \
riff-reader.cpp)
vpath %.h qt-devices/filereaders/new-reader
MOC_HEADERS += $(addprefix qt-devices/filereaders/new-reader/, \
new-reader.h \
newfiles.h)
vpath %.cpp qt-devices/filereaders/rawfiles-new
CPP_SOURCES += $(addprefix qt-devices/filereaders/rawfiles-new/, \
raw-reader.cpp \
rawfiles.cpp)
vpath %.h qt-devices/filereaders/rawfiles-new
MOC_HEADERS += $(addprefix qt-devices/filereaders/rawfiles-new/, \
raw-reader.h \
rawfiles.h)
vpath %.cpp qt-devices/filereaders/xml-filereader
CPP_SOURCES += $(addprefix qt-devices/filereaders/xml-filereader/, \
xml-descriptor.cpp \
xml-filereader.cpp \
xml-reader.cpp)
vpath %.h qt-devices/filereaders/xml-filereader
MOC_HEADERS += $(addprefix qt-devices/filereaders/xml-filereader/, \
xml-filereader.h \
xml-reader.h)
CPP_SOURCES += $(OBJ_DIR)/qrc_resources.cpp
vpath %.cpp src/backend
CPP_SOURCES += $(addprefix src/backend/, \
backend.cpp \
backend-deconvolver.cpp \
backend-driver.cpp \
charsets.cpp \
firecode-checker.cpp \
galois.cpp \
msc-handler.cpp \
reed-solomon.cpp \
rscodec.cpp)
vpath %.cpp src/backend/audio
CPP_SOURCES += $(addprefix src/backend/audio/, \
bitWriter.cpp \
faad-decoder.cpp \
mp2processor.cpp \
mp4processor.cpp)
vpath %.cpp src/backend/data
CPP_SOURCES += $(addprefix src/backend/data/, \
adv-datahandler.cpp \
data-processor.cpp \
ip-datahandler.cpp \
journaline-datahandler.cpp \
journaline-screen.cpp \
pad-handler.cpp \
tdc-datahandler.cpp)
vpath %.cpp src/backend/data/journaline
CPP_SOURCES += $(addprefix src/backend/data/mot/journaline/, \
newsobject.cpp \
newssvcdec_impl.cpp \
Splitter.cpp \
NML.cpp)
vpath %.cpp src/backend/data/mot
CPP_SOURCES += $(addprefix src/backend/data/mot/, \
mot-dir.cpp \
mot-handler.cpp \
mot-object.cpp)
#
# Enable "Electronic Programme Guide" decoding.
# Ref: https://www.etsi.org/deliver/etsi_ts/102300_102399/102371/01.01.01_60/ts_102371v010101p.pdf
#
vpath %.cpp src/backend/data/epg
CPP_SOURCES += src/backend/data/epg/epgdec.cpp
vpath %.cpp src/backend/data/epg-2
CPP_SOURCES += src/backend/data/epg-2/epg-decoder.cpp
ifeq ($(USE_EPG_TRACE),1)
CFLAGS += -D__EPG_TRACE__
endif
vpath %.cpp src/ofdm
CPP_SOURCES += $(addprefix src/ofdm/, \
correlator.cpp \
fib-decoder.cpp \
fic-handler.cpp \
freq-interleaver.cpp \
freqsyncer.cpp \
estimator.cpp \
ofdm-decoder.cpp \
phasetable.cpp \
sample-reader.cpp \
tii-detector.cpp \
tii-detector-1.cpp \
tii-detector-2.cpp \
timesyncer.cpp)
vpath %.cpp src/output
CPP_SOURCES += $(addprefix src/output/, \
audio-player.cpp \
audiosink.cpp \
fir-filters.cpp)
vpath %.cpp src/output/Qt$(QT_MAJOR)
CPP_SOURCES += $(addprefix src/output/Qt$(QT_MAJOR)/, \
Qt-audio.cpp \
Qt-audiodevice.cpp)
vpath %.cpp src/protection
CPP_SOURCES += $(addprefix src/protection/, \
eep-protection.cpp \
protTables.cpp \
protection.cpp \
uep-protection.cpp)
vpath %.cpp src/support
CPP_SOURCES += $(addprefix src/support/, \
band-handler.cpp \
coordinates.cpp \
color-selector.cpp \
content-table.cpp \
converter_48000.cpp \
dab-params.cpp \
dab-tables.cpp \
distances.cpp \
element-selector.cpp \
fft-handler.cpp \
findfilenames.cpp \
font-chooser.cpp \
http-handler.cpp \
ITU_Region_1.cpp \
logger.cpp \
mapport.cpp \
position-handler.cpp \
preset-handler.cpp \
presetcombobox.cpp \
scanlist-handler.cpp \
scheduler.cpp \
schedule-selector.cpp \
settings-handler.cpp \
skin-handler.cpp \
time-converter.cpp \
time-table.cpp \
wavwriter.cpp)
vpath %.cpp src/support/tii-library
CPP_SOURCES += $(addprefix src/support/tii-library/, \
tii-mapper.cpp \
tii-reader.cpp \
uploader.cpp)
vpath %.cpp src/support/buttons
CPP_SOURCES += $(addprefix src/support/buttons/, \
newpushbutton.cpp \
normalpushbutton.cpp \
smallcombobox.cpp \
smallpushbutton.cpp \
smallqlistview.cpp \
smallspinbox.cpp \
verysmallpushbutton.cpp)
vpath %.cpp $(DAB_DIR)/support
CPP_SOURCES += $(addprefix $(DAB_DIR)/support/, \
aboutdialog.cpp \
audiosystem-selector.cpp \
clickable-label.cpp \
config-handler.cpp \
dxDisplay.cpp \
ensemble-handler.cpp \
scan-handler.cpp \
scantable-handler.cpp \
super-frame.cpp \
techdata.cpp)
vpath %.cpp $(DAB_DIR)/forms-v7/snr-viewer
CPP_SOURCES += $(DAB_DIR)/snr-viewer/snr-viewer.cpp
vpath %.h $(DAB_DIR)/support
MOC_HEADERS += $(addprefix $(DAB_DIR)/support/, \
aboutdialog.h \
audiosystem-selector.h \
clickable-label.h \
config-handler.h \
dxDisplay.h \
ensemble-handler.h \
icon-label.h \
scan-handler.h \
scantable-handler.h \
super-frame.h \
techdata.h)
vpath %.h includes/backend/audio
MOC_HEADERS += $(addprefix includes/backend/audio/, \
faad-decoder.h \
mp2processor.h \
mp4processor.h)
vpath %.h includes/backend/data
MOC_HEADERS += $(addprefix includes/backend/data/, \
adv-datahandler.h \
data-processor.h \
ip-datahandler.h \
journaline-datahandler.h \
journaline-screen.h \
pad-handler.h \
tdc-datahandler.h \
virtual-datahandler.h)
vpath %.h includes/backend/data/epg-2
MOC_HEADERS += includes/backend/data/epg-2/epg-decoder.h
vpath %.h includes/backend/data/mot
MOC_HEADERS += includes/backend/data/mot/mot-object.h
vpath %.h includes/ofdm
MOC_HEADERS += $(addprefix includes/ofdm/, \
correlator.h \
estimator.h \
fic-handler.h \
fib-decoder.h \
freqsyncer.h \
ofdm-decoder.h \
sample-reader.h)
vpath %.h includes/output \
includes/output/Qt$(QT_MAJOR)
MOC_HEADERS += $(addprefix includes/output/, \
audio-player.h \
Qt$(QT_MAJOR)/Qt-audio.h \
Qt$(QT_MAJOR)/Qt-audiodevice.h)
vpath %.h includes/scopes-qwt6
MOC_HEADERS += includes/scopes-qwt6/audio-display.h
vpath %.h includes/support
MOC_HEADERS += $(addprefix includes/support/, \
band-handler.h \
coordinates.h \
color-selector.h \
content-table.h \
converter_48000.h \
element-selector.h \
font-chooser.h \
scanlist-handler.h \
skin-handler.h \
mapport.h \
preset-handler.h \
presetcombobox.h \
scheduler.h \
schedule-selector.h \
time-table.h)
vpath %.h includes/support/buttons
MOC_HEADERS += $(addprefix includes/support/buttons/, \
newpushbutton.h \
normalpushbutton.h \
smallcombobox.h \
smallpushbutton.h \
smallqlistview.h \
smallspinbox.h \
verysmallpushbutton.h)
vpath %.h $(DAB_DIR)/forms-v7/snr-viewer
MOC_HEADERS += $(DAB_DIR)/forms-v7/snr-viewer/snr-viewer.h
vpath %.h $(DAB_DIR)/forms-v7/new-display \
$(DAB_DIR)/forms-v7/new-display/scopes
MOC_HEADERS += $(addprefix $(DAB_DIR)/forms-v7/new-display/, \
display-widget.h \
scopes/channel-scope.h \
scopes/correlation-scope.h \
scopes/dev-scope.h \
scopes/iqdisplay.h \
scopes/null-scope.h \
scopes/spectrum-scope.h \
scopes/waterfall-scope.h)
vpath %.ui $(DAB_DIR)/forms-v7
UI_FILES = $(DAB_DIR)/forms-v7/audio-description.ui \
$(DAB_DIR)/forms-v7/config-helper.ui \
$(DAB_DIR)/forms-v7/dabradio-6.ui \
$(DAB_DIR)/forms-v7/data-description.ui \
$(DAB_DIR)/forms-v7/technical_data.ui
vpath %.ui $(DAB_DIR)/forms-v7/new-display
UI_FILES += $(DAB_DIR)/forms-v7/new-display/scopewidget.ui
vpath %.ui $(DAB_DIR)/forms-v7/snr-viewer
UI_FILES += $(DAB_DIR)forms-v7/snr-viewer/snr-widget.ui
vpath %.ui $(DAB_DIR)/support
UI_FILES += $(DAB_DIR)/support/aboutdialog.ui
vpath %.ui qt-devices/filereaders/xml-filereader
UI_FILES += qt-devices/filereaders/xml-filereader/xmlfiles.ui
ifeq ($(USE_AIRSPY),1)
CFLAGS += -I./qt-devices/airspy-handler -DHAVE_AIRSPY
vpath %.cpp qt-devices/airspy-handler
CPP_SOURCES += $(addprefix qt-devices/airspy-handler/, \
airspy-handler.cpp \
airspyfilter.cpp \
airspyselect.cpp)
vpath %.h qt-devices/airspy-handler
MOC_HEADERS += qt-devices/airspy-handler/airspy-handler.h \
qt-devices/airspy-handler/airspyselect.h
vpath %.ui qt-devices/airspy-handler
UI_FILES += qt-devices/airspy-handler/airspy-widget.ui
endif
ifeq ($(USE_EXTIO),1)
CFLAGS += -I./qt-devices/extio-handler -DHAVE_EXTIO
vpath %.cpp qt-devices/extio-handler
CPP_SOURCES += $(addprefix qt-devices/extio-handler/, \
extio-handler.cpp \
common-readers.cpp \
virtual-reader.cpp)
vpath %.h qt-devices/extio-handler
MOC_HEADERS += qt-devices/extio-handler/extio-handler.h
vpath %.ui qt-devices/extio-handler
UI_FILES += qt-devices/extio-handler/extio-widget.ui
endif
ifeq ($(USE_HACKRF),1)
CFLAGS += -I./qt-devices/hackrf-handler -DHAVE_HACKRF
vpath %.cpp qt-devices/hackrf-handler
CPP_SOURCES += qt-devices/hackrf-handler/hackrf-handler.cpp
vpath %.h qt-devices/hackrf-handler
MOC_HEADERS += qt-devices/hackrf-handler/hackrf-handler.h
vpath %.ui qt-devices/hackrf-handler
UI_FILES += qt-devices/hackrf-handler/hackrf-widget.ui
endif
ifeq ($(USE_LIME),1)
CFLAGS += -I./qt-devices/lime-handler -DHAVE_LIME
vpath %.cpp qt-devices/lime-handler
CPP_SOURCES += qt-devices/lime-handler/lime-handler.cpp
vpath %.h qt-devices/lime-handler
MOC_HEADERS += qt-devices/lime-handler/lime-handler.h
vpath %.ui qt-devices/lime-handler
UI_FILES += qt-devices/lime-handler/lime-widget.ui
endif
ifeq ($(USE_PLUTO),1)
CFLAGS += -I./qt-devices/pluto-handler -I$(AD9361_ROOT) -DHAVE_PLUTO
vpath %.cpp qt-devices/pluto-handler
CPP_SOURCES += qt-devices/pluto-handler/pluto-handler.cpp
vpath %.h qt-devices/pluto-handler
MOC_HEADERS += qt-devices/pluto-handler/pluto-handler.h
vpath %.ui qt-devices/pluto-handler
UI_FILES += qt-devices/pluto-handler/pluto-widget.ui
EX_LIBS += $(AD9361_ROOT)/libad9361.lib \
$(LIBIIO_ROOT)/libiio-$(CPU).lib
COPY_DLLs += $(AD9361_ROOT)/libad9361.{dll,pdb} \
$(LIBIIO_ROOT)/libiio-$(CPU).{dll,pdb}
endif
ifeq ($(USE_RTL_TCP),1)
CFLAGS += -I./qt-devices/rtl_tcp -DHAVE_RTL_TCP
vpath %.cpp qt-devices/rtl_tcp
CPP_SOURCES += qt-devices/rtl_tcp/rtl_tcp_client.cpp
vpath %.h qt-devices/rtl_tcp
MOC_HEADERS += qt-devices/rtl_tcp/rtl_tcp_client.h
vpath %.ui qt-devices/rtl_tcp
UI_FILES += qt-devices/rtl_tcp/rtl_tcp-widget.ui
EX_LIBS += $(call qt_lib, Network.lib)
endif
ifeq ($(USE_RTLSDR),1)
CFLAGS += -I./qt-devices/rtlsdr-handler-win -I./qt-devices/rtlsdr-handler-linux -DHAVE_RTLSDR -DHAVE_RTLSDR_V3
vpath %.cpp qt-devices/rtlsdr-handler-common
CPP_SOURCES += qt-devices/rtlsdr-handler-common/rtl-dongleselect.cpp
vpath %.cpp qt-devices/rtlsdr-handler-linux
CPP_SOURCES += qt-devices/rtlsdr-handler-linux/rtlsdr-handler.cpp
vpath %.cpp qt-devices/rtlsdr-handler-win
CPP_SOURCES += qt-devices/rtlsdr-handler-win/rtlsdr-handler-win.cpp
vpath %.h qt-devices/rtlsdr-handler-common
MOC_HEADERS += qt-devices/rtlsdr-handler-common/rtl-dongleselect.h
vpath %.h qt-devices/rtlsdr-handler-linux
MOC_HEADERS += qt-devices/rtlsdr-handler-linux/rtlsdr-handler.h
vpath %.h qt-devices/rtlsdr-handler-win
MOC_HEADERS += qt-devices/rtlsdr-handler-win/rtlsdr-handler-win.h
vpath %.ui qt-devices/rtlsdr-handler-common
UI_FILES += qt-devices/rtlsdr-handler-common/rtlsdr-widget.ui
EX_LIBS += $(RTLSDR_ROOT)/lib/rtlsdr_imp-$(CPU).lib
COPY_DLLs += $(RTLSDR_ROOT)/bin/rtlsdr-$(CPU).{dll,pdb}
endif
ifeq ($(USE_SDRPLAY_V2),1)
CFLAGS += -I./qt-devices/sdrplay-handler-v2 \
-I$(SDRPLAY2_ROOT)/inc \
-DHAVE_SDRPLAY_V2
vpath %.cpp qt-devices/sdrplay-handler-v2
CPP_SOURCES += qt-devices/sdrplay-handler-v2/sdrplay-handler-v2.cpp \
qt-devices/sdrplay-handler-v2/sdrplayselect.cpp
vpath %.h qt-devices/sdrplay-handler-v2
MOC_HEADERS += qt-devices/sdrplay-handler-v2/sdrplay-handler-v2.h \
qt-devices/sdrplay-handler-v2/sdrplayselect.h
vpath %.ui qt-devices/sdrplay-handler-v2
UI_FILES += qt-devices/sdrplay-handler-v2/sdrplay-widget-v2.ui
COPY_DLLs += $(SDRPLAY2_ROOT)/$(CPU)/sdrplay_api.dll \
$(SDRPLAY2_ROOT)/$(CPU)/mir_sdr_api.dll
endif
ifeq ($(USE_SDRPLAY_V3),1)
CFLAGS += -I./qt-devices/sdrplay-handler-v3 \
-I./qt-devices/sdrplay-handler-v2 \
-I$(SDRPLAY3_ROOT)/inc \
-DHAVE_SDRPLAY_V3
vpath %.cpp qt-devices/sdrplay-handler-v3
CPP_SOURCES += $(addprefix qt-devices/sdrplay-handler-v3/, \
Rsp-device.cpp \
Rsp1A-handler.cpp \
RspI-handler.cpp \
RspII-handler.cpp \
RspDuo-handler.cpp \
RspDx-handler.cpp \
sdrplay-handler-v3.cpp)
vpath %.h qt-devices/sdrplay-handler-v3
MOC_HEADERS += qt-devices/sdrplay-handler-v3/Rsp-device.h \
qt-devices/sdrplay-handler-v3/sdrplay-handler-v3.h
vpath %.ui qt-devices/sdrplay-handler-v3
UI_FILES += qt-devices/sdrplay-handler-v3/sdrplay-widget-v3.ui
COPY_DLLs += $(SDRPLAY3_ROOT)/$(CPU)/sdrplay_api.dll
endif
ifeq ($(USE_SPYSERVER_8),1)
CFLAGS += -I./qt-devices/spy-server-8 -DHAVE_SPYSERVER_8
vpath %.cpp qt-devices/spy-server-8
CPP_SOURCES += $(addprefix qt-devices/spy-server-8/, \
spy-handler-8.cpp \
spyserver-client-8.cpp \
tcp-client-8.cpp)
vpath %.h qt-devices/spy-server-8
MOC_HEADERS += $(addprefix qt-devices/spy-server-8/, \
spy-handler-8.h \
spyserver-client-8.h \
tcp-client-8.h)
vpath %.ui qt-devices/spy-server-8
UI_FILES += qt-devices/spy-server-8/spyserver-widget-8.ui
EX_LIBS += $(call qt_lib, Network.lib)
endif
ifeq ($(USE_SPYSERVER_16),1)
CFLAGS += -I./qt-devices/spy-server-16 -DHAVE_SPYSERVER_16
vpath %.cpp qt-devices/spy-server-16
CPP_SOURCES += $(addprefix qt-devices/spy-server-16/, \
spy-handler.cpp \
spyserver-client.cpp \
tcp-client.cpp)
vpath %.h qt-devices/spy-server-16
MOC_HEADERS += $(addprefix qt-devices/spy-server-16/, \
spy-handler.h \
spyserver-client.h \
tcp-client.h)
vpath %.ui qt-devices/spy-server-16
UI_FILES += qt-devices/spy-server-16/spyserver-widget.ui
EX_LIBS += $(call qt_lib, Network.lib)
endif
ifeq ($(USE_TCP_STREAMER),1)
CFLAGS += -DTCP_STREAMER
CPP_SOURCES += src/output/tcp-streamer.cpp
MOC_HEADERS += includes/output/tcp-streamer.h
endif
CFLAGS += -DQT_AUDIO
EX_LIBS += $(call qt_lib, Multimedia.lib)
UI_H_FILES = $(call ui_to_h, $(UI_FILES))
MOC_CPP_FILES = $(call h_to_moc, $(MOC_HEADERS))
GENERATED = $(UI_H_FILES) \
$(MOC_CPP_FILES)
GENERATED += $(addprefix $(OBJ_DIR)/, \
config.h \
unistd.h \
sys/time.h \
qrc_resources.cpp \
Adaptic_qss.h \
Darkeum_qss.h \
Diffnes_qss.h \
Easycode_qss.h)
C_OBJECTS = $(call c_to_obj, $(C_SOURCES))
CPP_OBJECTS = $(call cpp_to_obj, $(CPP_SOURCES))
DAB_OBJECTS = $(C_OBJECTS) \
$(CPP_OBJECTS) \
$(call cpp_to_obj, $(MOC_CPP_FILES))
all: $(GENERATED) $(TARGETS) copy_DLLs
bin/qt-DAB-6.exe: $(DAB_OBJECTS) $(OBJ_DIR)/Qt-DAB-6.res $(EX_LIBS) | bin $(OBJ_DIR)/check-for-unused-libs.py
$(call create_resp_file, link.args, $(LDFLAGS) -manifest:embed $^ $(OS_LIBS))
$(file >> link.args, "-manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' \
version='6.0.0.0' \
publicKeyToken='6595b64144ccf1df' \
language='*' \
processorArchitecture='*'")
$(call link_EXE, $@, @link.args)
#
# Since these cannot be in any 'vpath':
#
$(OBJ_DIR)/qwt6_spectrogramdata.obj: src/scopes-qwt6/spectrogramdata.cpp | $(CC)++.args $(OBJ_DIR)
$(call CPP_compile, $@, $<)
ifeq ($(CC)-$(USE_MP_COMPILE),cl-1)
CPP_CHUNK_1 = $(wordlist 1, 30, $(CPP_SOURCES))
CPP_CHUNK_2 = $(wordlist 31, 60, $(CPP_SOURCES))
CPP_CHUNK_3 = $(wordlist 61, 120, $(CPP_SOURCES))
OBJ_CHUNK_1 = $(call cpp_to_obj, $(CPP_CHUNK_1))
OBJ_CHUNK_2 = $(call cpp_to_obj, $(CPP_CHUNK_2))
OBJ_CHUNK_3 = $(call cpp_to_obj, $(CPP_CHUNK_3))
OBJ_CHUNK_4 = $(call cpp_to_obj, $(MOC_CPP_FILES))
$(OBJ_CHUNK_1): $(CPP_CHUNK_1) | $(CC)++.args
$(call CPP_compile_MP, $(CPP_CHUNK_1), CPP_CHUNK_1)
$(OBJ_CHUNK_2): $(CPP_CHUNK_2) | $(CC)++.args
$(call CPP_compile_MP, $(CPP_CHUNK_2), CPP_CHUNK_2)
$(OBJ_CHUNK_3): $(CPP_CHUNK_3) | $(CC)++.args
$(call CPP_compile_MP, $(CPP_CHUNK_3), CPP_CHUNK_3)
$(OBJ_CHUNK_4): $(MOC_CPP_FILES) | $(CC)++.args
$(call CPP_compile_MP, $(MOC_CPP_FILES), MOC_CPP_FILES)
$(C_OBJECTS): $(C_SOURCES) | $(CC).args
$(call C_compile_MP, $(C_SOURCES), C_SOURCES)
endif
$(OBJ_DIR)/Qt-DAB-6.rc: $(THIS_FILE)
$(call create_rc_file, $@, "A Qt-DAB receiver", "$(DAB_DIR)/qt-dab-6.9.ico")
$(CC).args: $(THIS_FILE)
$(call white_msg, All CFLAGS are in $@.)
$(call create_resp_file, $@, -c $(CFLAGS))
$(CC)++.args: $(THIS_FILE)
$(call white_msg, All CFLAGS for C++ are in $@.)
$(call create_resp_file, $@, -c $(CXXFLAGS) $(CFLAGS))
#
# Ref. 'define Qt_DAB_config_H' below.
#
$(OBJ_DIR)/config.h: $(THIS_FILE) | $(OBJ_DIR)
$(call generate, $@, //)
$(file >> $@,#ifndef Qt_DAB_config_H)
$(file >> $@,#define Qt_DAB_config_H)
$(file >> $@,)
$(file >> $@,$(Qt_DAB_config_H))
$(file >> $@,#endif /* Qt_DAB_config_H */)
$(OBJ_DIR)/radio.h: $(THIS_FILE) | $(OBJ_DIR)
$(call generate, $@, //)
$(file >> $@, #include <QMainWindow>)
$(file >> $@, class RadioInterface; // forward.)
$(OBJ_DIR)/device-handler.h: $(THIS_FILE) | $(OBJ_DIR)
$(call generate, $@, //)
$(file >> $@, class deviceHandler; // forward.)
$(OBJ_DIR)/unistd.h: $(THIS_FILE) | $(OBJ_DIR)
$(call generate, $@, //)
$(file >> $@, // A fake <$@> for MSVC and clang-cl.)
$(OBJ_DIR)/sys/time.h: $(THIS_FILE) | $(OBJ_DIR)/sys
$(call generate, $@, //)
$(file >> $@,$(sys_time_h))
$(OBJ_DIR)/cpp-filter.py:
$(call generate, $@, #)
$(file >> $@,if 1:)
$(file >> $@,$(cpp_filter_PY))
$(OBJ_DIR)/check-for-unused-libs.py:
$(call generate, $@, #)
$(file >> $@,if 1:)
$(file >> $@,$(check_for_unused_libs_PY))
$(OBJ_DIR) $(OBJ_DIR)/sys bin:
@mkdir --parents $@
copy_DLLs: bin
@$(foreach f, $(sort $(COPY_DLLs)), \
$(call copy_file, $(f), bin) ; )
$(OBJ_DIR)/%.obj: %.c | $(CC).args $(OBJ_DIR)
$(call C_compile, $@, $<)
$(OBJ_DIR)/%.obj: %.cpp | $(CC)++.args $(OBJ_DIR)
$(call CPP_compile, $@, $<)
$(OBJ_DIR)/%.obj: $(OBJ_DIR)/%.cpp | $(CC)++.args $(OBJ_DIR)
$(call CPP_compile, $@, $<)
#
# Could be defined in including Makefile.Windows:
#
PREPROCESS_DEPS = FORCE $(GENERATED) $(OBJ_DIR)/cpp-filter.py $(CC).args
#
# Preprocessing of .c/.cpp files:
#
%.i: %.c $(PREPROCESS_DEPS)
$(call CXX_preprocess, $@, $<,)
%.i: %.cpp $(PREPROCESS_DEPS)
$(call CXX_preprocess, $@, $<, $(CXXFLAGS))
FORCE:
$(OBJ_DIR)/ui_%.h: %.ui | $(OBJ_DIR)
$(call create_ui_h, $@, $<)
$(OBJ_DIR)/moc_%.cpp: %.h | $(OBJ_DIR)
$(call create_moc, $@, $<)
$(OBJ_DIR)/%.res: $(OBJ_DIR)/%.rc
$(call create_res_file, $@, $<)
$(OBJ_DIR)/qrc_resources.cpp: $(DAB_DIR)/resources.qrc | $(OBJ_DIR)
$(call create_qrc_file, $@, $<)
#
# Hacks for:
# ./res/Adaptic.qss(1199): error C2026: string too big, ...
#
# in '$(DAB_DIR)/main.cpp' files.
#
# Use $(CC) to preprocess and 'sed' to remove empty lines.
# And 'xxd' to convert this to an array.
#
$(OBJ_DIR)/%_qss.h: res/%.qss | $(OBJ_DIR)
$(call generate_qss_2, $@, $<)
clean:
rm -f vc1*.pdb link.args link.tmp cl.args cl++.args clang-cl.args clang-cl++.args \
moc.args depend.args
rm -fr $(OBJ_DIR)
vclean realclean: clean
rm -f .depend.Windows
rm -fr bin
#
# Generation of dependencies:
#
DEP_CFLAGS = -DGCC_MAKE_DEPEND -std=c++11 -msse3 -msse4 --include config.h \
$(filter -I% -D%, $(CFLAGS))
DEP_REPLACE = -e 's@\(.*\)\.o: @\n$$(OBJ_DIR)\/\1.obj: @'
#
# Remove ALL generated files from dependency output:
#
DEP_REPLACE += -e 's@$(OBJ_DIR)/config.h@@g' \
-e 's@$(OBJ_DIR)/unistd.h@@g' \
-e 's@$(OBJ_DIR)/radio.h@@g' \
-e 's@$(OBJ_DIR)/device-handler.h@@g' \
-e 's@$(OBJ_DIR)/sys/time.h@@g' \
-e 's@$(OBJ_DIR)@$$(OBJ_DIR)@g'
#
# Replace all '$(x_ROOT)' with '$$(x_ROOT)':
#
DEP_REPLACE += -e 's@$(FAAD2_ROOT)@$$(FAAD2_ROOT)@g' \
-e 's@$(FFTW_ROOT)@$$(FFTW_ROOT)@g' \
-e 's@$(PORTAUDIO_ROOT)@$$(PORTAUDIO_ROOT)@g' \
-e 's@$(QT_ROOT)@$$(QT_ROOT)@g' \
-e 's@$(QWT_ROOT)@$$(QWT_ROOT)@g' \
-e 's@$(ZLIB_ROOT)@$$(ZLIB_ROOT)@g'
ALL_SOURCES = $(C_SOURCES) $(CPP_SOURCES)
depend: $(GENERATED)
$(call green_msg, Generating dependencies for $(words $(ALL_SOURCES)) source-files. \
This will take a $(BRIGHT_RED)long time..)
$(call create_resp_file, depend.args, $(DEP_CFLAGS) $(ALL_SOURCES))
$(file > .depend.Windows, #)
$(file >> .depend.Windows, # DO NOT EDIT! This file was generated automatically)
$(file >> .depend.Windows, # from $(realpath $(THIS_FILE)).)
$(file >> .depend.Windows, #)
g++ -MM @depend.args | sed $(DEP_REPLACE) >> .depend.Windows
#
# GNU-make macros:
#
# This assumes you have a MSys/Cygwin's 'echo.exe' program with ANSI colour support.
#
BRIGHT_RED = \e[1;31m
BRIGHT_GREEN = \e[1;32m
BRIGHT_WHITE = \e[1;37m
green_msg = @echo -e "$(BRIGHT_GREEN)$(strip $(1))\e[0m"
white_msg = @echo -e "$(BRIGHT_WHITE)$(strip $(1))\e[0m"
#
# C/C++ compile macros:
#
define C_compile
$(strip $(CC) @$(CC).args $(2)) -Fo./$(strip $(1))
@echo
endef
define CPP_compile
$(strip $(CC) @$(CC)++.args $(2)) -Fo./$(strip $(1))
@echo
endef
#
# These '_MP' versions are for MSVC only.
# Compiles a lot faster.
#
define C_compile_MP
$(call green_msg, Compiling $(words $(filter %.c, $(1))) C files for $(BRIGHT_WHITE)$(strip $(2)) ...)
$(strip $(CC) -MP @$(CC).args $(1)) -Fo./$(OBJ_DIR)\\
@echo
endef
define CPP_compile_MP
$(call green_msg, Compiling $(words $(filter %.cpp, $(1))) C++ files for $(BRIGHT_WHITE)$(strip $(2)) ...)
$(strip $(CC) -MP @$(CC)++.args $(1)) -Fo./$(OBJ_DIR)\\
@echo
endef
define link_EXE
$(call green_msg, Linking $(1))
link -out:$(strip $(1)) $(2) > link.tmp
@cat link.tmp >> $(1:.exe=.map)
@rm -f $(1:.exe=.lib) $(1:.exe=.exp)
@$(PYTHON) $(OBJ_DIR)/check-for-unused-libs.py link.tmp
endef
define create_res_file
rc -nologo -Fo./$(strip $(1)) $(2)
@echo
endef
#
# Run Qt's moc (Meta Object Compiler) to produce the $(OBJ_DIR)/*.moc files
# from any "Mocable" .cpp/.h-file (a file with a 'Q_OBJECT').
#
MOC_FLAGS = -DQ_OS_WIN $(filter -D% -I%, $(CFLAGS)) --compiler-flavor=msvc
define create_ui_h
$(call gen_to_from, $(1), $(2))
$(QT_ROOT)/bin/uic.exe $(strip -o $(1) $(2))
@echo
endef
define create_moc
$(call gen_to_from, $(1), $(2))
$(call create_resp_file, moc.args, $(MOC_FLAGS))
$(QT_ROOT)/bin/moc.exe @moc.args $(strip -o $(1) $(2))
@echo
endef
define create_qrc_file
$(call gen_to_from, $(1), $(2))
$(QT_ROOT)/bin/rcc.exe -name resources -o $(1) $(2)
@echo
endef
#
# Make a response file instead of relying on various 'echo' programs.
# Depending on Cygwin or Msys version, the cmdline limit can be very
# low. Besides this macro avoids spawning 'sh'.
#
# arg1, $(1): The name of the response file
# arg2, $(2): The content for the response file. Each word is written
# on a separate line.
#
define create_resp_file
$(file > $(1))
$(foreach f, $(2), $(file >> $(1),$(strip $(f))) )
endef
define generate
$(call green_msg, Generating $(1).)
$(file > $(1),$(call Warning,$(2)))
endef
define gen_to_from
$(call green_msg, Generating $(BRIGHT_WHITE)$(strip $(1)) $(BRIGHT_GREEN)from $(BRIGHT_WHITE)$(strip $(2)))
endef
define generate_qss_1
$(call generate, $(1), //)
$(file >> $(1), const QChar stylesheets_$(basename $(2))_qss[] = {)
$(CC) -nologo -EP -E $(2) | sed -r "/^\s*$$/d" | xxd -i >> $(1)
@echo "};" >> $(1)
@echo
endef
#
# As above w/o 'xxd'; a large compact raw "R(...)" string.
#
define generate_qss_2
$(call generate, $(1), //)
$(CC) -nologo -EP -E $(2) | sed -r "/^\s*$$/d" >> $(1)
@echo
endef
define Warning
$(1)
$(1) DO NOT EDIT! This file was automatically generated
$(1) from $(realpath $(THIS_FILE)) at $(TODAY).
$(1) Edit that file instead.
$(1)
endef
define copy_file
echo -e "$(BRIGHT_GREEN)Copying $(strip $(1)) to $(BRIGHT_WHITE)$(strip $(2))\e[0m"
cp $(1) $(2)
endef
#
# Create an .rc-file for an .EXE.
# arg1: $(1) - name of .rc-file
# arg2: $(2) - RC_DESCRIPTION.
# arg3: $(3) - The name of the .ico-file.
#
define create_rc_file
$(call generate, $(1), //)
$(file >> $(1), #define RC_DESCRIPTION $(2))
$(file >> $(1), #define RC_BASENAME "$(notdir $(1:.rc=))")
$(file >> $(1), #include <winver.h>)
$(file >> $(1), APPICON ICON $(3))
$(file >> $(1), $(Qt_DAB_common_RC))
endef
define Qt_DAB_common_RC
#define RC_VERSION $(VER_MAJOR),$(VER_MINOR),$(VER_MICRO),0
VS_VERSION_INFO VERSIONINFO
FILEVERSION RC_VERSION
PRODUCTVERSION RC_VERSION
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", RC_DESCRIPTION
VALUE "FileVersion", "$(VERSION)"
VALUE "InternalName", RC_BASENAME ".exe"
VALUE "LegalCopyright", "GNU GENERAL PUBLIC LICENSE, Version 3"
VALUE "OriginalFilename", RC_BASENAME ".exe"
VALUE "ProductName", RC_BASENAME
VALUE "ProductVersion", "$(VERSION)"
VALUE "PrivateBuild", "The private build of <gvanem@yahoo.no>"
VALUE "Comments", "Built on $(TODAY) using $(CC_NAME) ($(CPU))"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
endef
ifeq ($(USE_ASTYLE),1)
pp_comment = The preprocessed and AStyled output of '$(filter %.c %.cpp, $(1))'
pp_filter = | astyle
else
pp_comment = The raw preprocessed output of '$(filter %.c %.cpp, $(1))'
pp_filter =
endif
define CXX_preprocess
$(file > $(1),/* $(call pp_comment, $(2)):)
$(file >> $(1), * $(CPP_CMD))
$(foreach f, $(CFLAGS) $(3), $(file >> $(1), * $(f)))
$(file >> $(1), *---------------------------------------------------------)
$(file >> $(1), */)
$(CPP_CMD) @$(CC).args $(2) $(3) | $(PYTHON) cpp-filter.py $(pp_filter) >> $(1)
@echo
endef
define Qt_DAB_config_H
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_NONSTDC_NO_WARNINGS
#define _USE_MATH_DEFINES
#define UNICODE
#define _UNICODE
#define _ENABLE_EXTENDED_ALIGNED_STORAGE
#define _WIN32_WINNT 0x0601
#define WIN32_LEAN_AND_MEAN
#define WIN32
#define NOMINMAX
#define GITHASH "------"
#define VERSION "$(VERSION)"
#define __WITH_FAAD__ 1 /* A dead define; never used AFAICS */
#ifndef __MSC_THREAD__
//#define __MSC_THREAD__ 1 /* Enabling this increases the CPU load */
#endif
#define QT_CORE_LIB
#define QT_GUI_LIB
#define QT_WIDGETS_LIB
#define QT_NO_OPENSSL
/*
* Warning control. A lot!
*/
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunused-value"
#pragma clang diagnostic ignored "-Wunused-function"
#pragma clang diagnostic ignored "-Wpointer-sign"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#pragma clang diagnostic ignored "-Wrange-loop-construct"
#pragma clang diagnostic ignored "-Wreorder-ctor"
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#pragma clang diagnostic ignored "-Wmisleading-indentation"
#pragma clang diagnostic ignored "-Wunused-private-field"
#pragma clang diagnostic ignored "-Wmacro-redefined"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#pragma clang diagnostic ignored "-Wignored-attributes"
#pragma clang diagnostic ignored "-Wmicrosoft-include"
#pragma clang diagnostic ignored "-Wvla-cxx-extension"
#pragma clang diagnostic ignored "-W#pragma-messages"
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
#elif defined(_MSC_VER)
#pragma warning (disable: 4005 4018 4101 4200 4244 4267 4305 4477 4996)
#endif
#if defined(GCC_MAKE_DEPEND)
/*
* This value should match the value in the generated
* $$(MOC_CPP_FILES) files.
*/
#define Q_MOC_OUTPUT_REVISION 67
#endif
#include <math.h>
#include <stdlib.h>
#include <windows.h>
#include <shellapi.h>
#if defined(__cplusplus)
#include <QtCore>
#include "dab-constants.h"
/* Pretend to be MinGW to avoid patching the sources too much.
*/
#define __MINGW32__
#endif
endef
define sys_time_h
#include <time.h>
#include <winsock2.h> /* For 'struct timeval' */
#ifdef __cplusplus
extern "C"
#endif
int gettimeofday (struct timeval *tv, void *timezone);
#define mingw_gettimeofday(tv, tz) gettimeofday (tv, tz)
endef
define cpp_filter_PY
import sys, os
empty_lines = 0
while True:
line = sys.stdin.readline()
if not line:
break
line = line.rstrip()
if line == "":
empty_lines += 1
continue
#
# MSVC or clang-cl 'line' directive
#
if line.lstrip().startswith("#line") or line.lstrip().startswith("# "):
line = line.replace (r"\\", "/")
print (line)
#
# Print a newline after a functions or structs
#
if line == "}" or line == "};":
print ("")
print ("Removed %d empty lines." % empty_lines, file=sys.stderr)
endef
define check_for_unused_libs_PY
#
# Check a MSVC .map-file for lines after a 'Unused libraries:'
#
import os, sys
map_file = sys.argv[1]
ignore_libs = [ ]
class State():
IDLE = 0
UNUSED = 1
class Colour():
RED = WHITE = RESET = ""
try:
from colorama import init, Fore, Style
init()
Colour.RED = Fore.RED + Style.BRIGHT
Colour.WHITE = Fore.WHITE + Style.BRIGHT
Colour.RESET = Style.RESET_ALL
except:
pass
#
# This seems to come from '<omp.h>': '#pragma comment(lib, "vcomp")'
# via some Qt header. Just ignore it.
#
ignore_libs += [ "vcomp.lib" ]
def report (unused):
num = len(unused)
plural = [ "library", "libraries" ]
if num > 0:
print ("%s%d unused %s in %s:%s" % (Colour.RED, num, plural[num > 1], map_file, Colour.RESET))
for u in sorted(unused):
print (" " + u)
print ("%sDone%s\n" % (Colour.WHITE, Colour.RESET))
def process_map (state):
unused_libs = []
with open (map_file, "rt") as f:
lines = f.readlines()
for l in lines:
l = l.strip()
if l == "Unused libraries:":
state = State.UNUSED
continue
if state == State.UNUSED:
if l == "":
break
if os.path.basename (l).lower() not in ignore_libs:
unused_libs.append (l)
return unused_libs
report (process_map(State.IDLE))
endef
-include .depend.Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment