This repository has been archived by the owner on Nov 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile.mingw64
58 lines (49 loc) · 1.56 KB
/
Makefile.mingw64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Mingw-w64 64-bit build
#
# Clone the main rtl-sdr repo to get the needed headers:
# $ cd ..
# $ git clone git://git.osmocom.org/rtl-sdr.git librtlsdr
#
# The directory tree should look like this:
# .
# ├── librtlsdr
# └── ExtIO_RTL
# └── Makefile.mingw64 (This file)
#
# Compile ExtIO_RTL.dll:
# $ cd ExtIO_RTL
# $ make -f Makefile.mingw64
#
# The resulting ExtIO_RTL.dll depends on rtlsdr.dll in the search path.
PREFIX = x86_64-w64-mingw32-
DLL = ExtIO_RTL.dll
EXPDEF = src/ExtIO_RTL.def
IMPDEF = src/rtlsdr.def
IMPLIB = src/rtlsdr.a
WINDRES = $(PREFIX)windres
RES = res/resource.res
OBJS = src/dllmain.o src/ExtIO_RTL.o $(IMPLIB) $(RES)
INCS = -I"./src" -I"./res" -I"../librtlsdr/include"
CXX = $(PREFIX)g++
CXXFLAGS = $(INCS) -O2 -Wall -Wextra -m64 -shared -s
CPPFLAGS = -D_UNICODE -DUNICODE
LDFLAGS = -mwindows -static-libgcc -static-libstdc++ \
-Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic \
-Wl,--enable-stdcall-fixup
RM = rm -f
all: $(DLL)
$(DLL): $(OBJS)
$(CXX) $(CXXFLAGS) -o $(DLL) $(OBJS) $(LDFLAGS) $(EXPDEF)
src/ExtIO_RTL.o: src/ExtIO_RTL.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c src/ExtIO_RTL.cpp -o src/ExtIO_RTL.o
src/dllmain.o: src/dllmain.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c src/dllmain.cpp -o src/dllmain.o
$(IMPLIB):
$(PREFIX)dlltool -d $(IMPDEF) -l $(IMPLIB)
$(RES): res/resource.rc
$(WINDRES) $(CPPFLAGS) -i res/resource.rc -F pe-x86-64 \
--input-format=rc -o $(RES) -O coff --include-dir ./res
clean:
${RM} $(DLL) $(OBJS)