forked from Blockstream/satellite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
172 lines (145 loc) · 5.48 KB
/
Makefile
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
SHELL:=/bin/bash
MACHINE := $(shell uname -m)
OS := $(shell cat /etc/os-release | grep "^NAME=" | cut -d"=" -f2)
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
sharedir = $(exec_prefix)/share
ifeq ($(MACHINE), x86_64)
ifneq ($(OS), "Ubuntu")
export PYTHONPATH := $(PYTHONPATH):/usr/local/lib64/python2.7/site-packages
endif
endif
XML_PATH = gr-blocksat/grc
LIB_PATH = gr-blocksat/lib
PY_PATH = gr-blocksat/python
H_PATH = gr-blocksat/include/blocksat
ifeq ($(GUI), 0)
GRC_FILES = $(shell find grc/ -maxdepth 1 -type f -name '*.grc' ! \
-path '*gui.grc')
else
GRC_FILES = $(shell find grc/ -maxdepth 1 -type f -name '*.grc')
endif
GRC_PY_FILES = $(patsubst grc/%.grc, build/%.py, $(GRC_FILES))
GRC_PYC_FILES = $(patsubst grc/%.grc, build/%.pyc, $(GRC_FILES))
GRC_WRAPPER_FILES = $(subst _,-, $(patsubst grc/%.grc, build/%, $(GRC_FILES)))
XML = $(shell find $(XML_PATH) -type f -name '*.xml')
I_H = $(shell find $(LIB_PATH) -type f -name '*.h')
CC = $(shell find $(LIB_PATH) -type f -name '*.cc')
PY = $(shell find $(PY_PATH) -type f -name '*.py')
H = $(shell find $(H_PATH) -type f -name '*.h')
AFF3CT = $(shell find $(LIB_PATH) -type f -name '*.cpp')
GR_FRAMERS_REPO = https://github.com/gr-vt/gr-framers.git
GR_FRAMERS_BUILD_DIR = gr-framers/build
GR_FRAMERS_BUILD_RC = build/gr-framers_build_record
GR_BLOCKSAT_BUILD_DIR = gr-blocksat/build
GR_BLOCKSAT_BUILD_RC = gr-blocksat/build_record
VERSION = $(shell git describe)
.PHONY: build install clean uninstall blocksat install-blocksat clean-blocksat \
uninstall-blocksat framers install-framers clean-framers uninstall-framers
# Build Rx Flowgraphs
build: $(GRC_PY_FILES)
build/%.py: grc/%.grc
@echo "Check gr-framers and gr-blocksat installations"
@python -c "import framers"
@python -c "import blocksat"
mkdir -p build
grcc $< -d $(@D)
@sed -i 's/'\
'dest=\"scan_mode\", type=\"intx\", default=0/'\
'dest=\"scan_mode\", action=\"store_true\", default=False/g' $@
@sed -i 's/'\
'dest=\"no_api\", type=\"intx\", default=0/'\
'dest=\"no_api\", action=\"store_true\", default=False/g' $@
@sed -i 's/'\
'dest=\"no_blocks\", type=\"intx\", default=0/'\
'dest=\"no_blocks\", action=\"store_true\", default=False/g' $@
@sed -i 's/'\
'dest=\"dapr_no_reset\", type=\"intx\", default=0/'\
'dest=\"dapr_no_reset\", action=\"store_true\", default=False/g' $@
@sed -i 's/'\
'dest=\"cfo_debug\", type=\"intx\", default=0/'\
'dest=\"cfo_debug\", action=\"store_true\", default=False/g' $@
@sed -i 's/'\
'dest=\"fs_no_phase_corr\", type=\"intx\", default=0/'\
'dest=\"fs_no_phase_corr\", action=\"store_true\", default=False/g' $@
@sed -i 's/'\
'dest=\"fs_no_freq_corr\", type=\"intx\", default=0/'\
'dest=\"fs_no_freq_corr\", action=\"store_true\", default=False/g' $@
@sed -i 's/'\
'dest=\"preamble_stats\", type=\"intx\", default=0/'\
'dest=\"preamble_stats\", action=\"store_true\", default=False/g' $@
@sed -i 's/'\
'option_class=eng_option, description=description/'\
'option_class=eng_option, description=description, version=\"'\
'Blockstream Satellite $(VERSION)\"/g' $@
@chmod u+x $@
python -m compileall $@
f=$@ && x=$${f%.py} && y="$${x//_/-}" &&\
echo "#!/bin/bash" > $$y &&\
echo "/usr/bin/env python $(libdir)/blocksat-rx/$(@F)c \"\$$@\"" >> $$y
# Build GR Framers
framers: $(GR_FRAMERS_BUILD_RC)
$(GR_FRAMERS_BUILD_RC):
git submodule update --init gr-framers
mkdir -p $(GR_FRAMERS_BUILD_DIR)
cd $(GR_FRAMERS_BUILD_DIR) && cmake .. && make
mkdir -p build
touch $(GR_FRAMERS_BUILD_RC)
# Install gr-framers
install-framers: $(GR_FRAMERS_BUILD_RC)
cd $(GR_FRAMERS_BUILD_DIR) && make DESTDIR=$(DESTDIR) install
-ldconfig
# Build GR Blocksat
blocksat: $(GR_BLOCKSAT_BUILD_RC)
$(GR_BLOCKSAT_BUILD_RC): $(CC) $(I_H) $(AFF3CT) $(H) $(XML) $(PY)
git submodule update --init gr-blocksat
mkdir -p $(GR_BLOCKSAT_BUILD_DIR)
cd $(GR_BLOCKSAT_BUILD_DIR) && cmake .. && make
touch $(GR_BLOCKSAT_BUILD_RC)
# Install GR Blocksat
install-blocksat: $(GR_BLOCKSAT_BUILD_RC)
cd $(GR_BLOCKSAT_BUILD_DIR) && make DESTDIR=$(DESTDIR) install
-ldconfig
install:
mkdir -p $(DESTDIR)$(bindir)
mkdir -p $(DESTDIR)$(libdir)/blocksat-rx
install -m 0755 build/blocksat_*.py* $(DESTDIR)$(libdir)/blocksat-rx/
cd build && ls | grep -v '\.py*' | \
xargs -L 1 -I '{}' install -m 0755 '{}' $(DESTDIR)$(bindir)
install-docs:
mkdir -p $(DESTDIR)$(sharedir)/doc/satellite/
mkdir -p $(DESTDIR)$(sharedir)/doc/satellite/api/
mkdir -p $(DESTDIR)$(sharedir)/doc/satellite/api/examples/
install -m 0644 README.md $(DESTDIR)$(sharedir)/doc/satellite/
install -m 0644 api/README.md $(DESTDIR)$(sharedir)/doc/satellite/api/
install -m 0644 api/examples/*.{md,txt} \
$(DESTDIR)$(sharedir)/doc/satellite/api/examples/
install -m 0755 api/examples/*.py \
$(DESTDIR)$(sharedir)/doc/satellite/api/examples/
# Clean builds
clean-framers:
rm -f $(GR_FRAMERS_BUILD_RC)
$(MAKE) -C $(GR_FRAMERS_BUILD_DIR) clean
rm -rf $(GR_FRAMERS_BUILD_DIR)
clean-blocksat:
rm -f $(GR_BLOCKSAT_BUILD_RC)
$(MAKE) -C $(GR_BLOCKSAT_BUILD_DIR) clean
rm -rf $(GR_BLOCKSAT_BUILD_DIR)
clean:
rm -f $(GRC_PY_FILES)
rm -f $(GRC_PYC_FILES)
rm -f $(GRC_WRAPPER_FILES)
# Uninstall
uninstall-framers:
rm -f $(GR_FRAMERS_BUILD_RC)
$(MAKE) -C $(GR_FRAMERS_BUILD_DIR) uninstall
uninstall-blocksat:
rm -f $(GR_BLOCKSAT_BUILD_RC)
$(MAKE) -C $(GR_BLOCKSAT_BUILD_DIR) uninstall
uninstall:
rm $(DESTDIR)$(libdir)/blocksat-rx/blocksat_rx*
rm $(DESTDIR)$(bindir)/blocksat-rx*
uninstall-docs:
rm -r $(DESTDIR)$(sharedir)/doc/satellite/