-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
181 lines (137 loc) · 4.71 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
172
173
174
175
176
177
178
179
180
181
# Copyright (c) 2018-2024 embed-dsp, All Rights Reserved.
# Author: Gudmundur Bogason <gb@embed-dsp.com>
# Runtime version.
RUNTIME_VERSION = 2.27.9
# Utilities version.
UTILITIES_VERSION = 2.7.1
# ==============================================================================
# Determine system.
SYSTEM = unknown
ifeq ($(findstring Linux, $(shell uname -s)), Linux)
SYSTEM = linux
endif
# ifeq ($(findstring MINGW32, $(shell uname -s)), MINGW32)
# SYSTEM = mingw32
# endif
# ifeq ($(findstring MINGW64, $(shell uname -s)), MINGW64)
# SYSTEM = mingw64
# endif
# Determine machine.
MACHINE = $(shell uname -m)
# Architecture.
ARCH = $(SYSTEM)_$(MACHINE)
# ==============================================================================
# Build for 64-bit.
RUNTIME_PACKAGE = digilent.adept.runtime_$(RUNTIME_VERSION)-x86_64
RUNTIME_BINDIR = $(RUNTIME_PACKAGE)/bin64
RUNTIME_LIBDIR = $(RUNTIME_PACKAGE)/lib64
UTILITIES_PACKAGE = digilent.adept.utilities_$(UTILITIES_VERSION)-x86_64
UTILITIES_BINDIR = $(UTILITIES_PACKAGE)/bin64
# Installation directories.
PREFIX = /opt/digilent
EXEC_PREFIX = $(PREFIX)/$(ARCH)
DATADIR = $(PREFIX)/share
MANDIR = $(DATADIR)/man
MAN1DIR = $(MANDIR)/man1
BINDIR = $(EXEC_PREFIX)/bin
SBINDIR = $(EXEC_PREFIX)/sbin
LIBDIR = $(EXEC_PREFIX)/lib
all:
@echo "ARCH = $(ARCH)"
@echo "PREFIX = $(PREFIX)"
@echo "EXEC_PREFIX = $(EXEC_PREFIX)"
@echo ""
@echo "## Build"
@echo "make prepare"
@echo ""
@echo "## Install"
@echo "sudo make install"
@echo ""
@echo "## Uninstall"
@echo "sudo make uninstall"
@echo ""
@echo "## Cleanup"
@echo "make clean"
@echo ""
.PHONY: prepare
prepare:
-mkdir build
cd build && tar zxf ../src/$(RUNTIME_PACKAGE).tar.gz
cd build && tar zxf ../src/$(UTILITIES_PACKAGE).tar.gz
.PHONY: install
install: install-runtime install-utilities
# Update links and cache to the most recent shared libraries.
/sbin/ldconfig
# Reload udev rules.
udevadm control --reload-rules
.PHONY: install-runtime
install-runtime:
# Install system binaries.
-mkdir -p $(SBINDIR)
cp build/$(RUNTIME_BINDIR)/* $(SBINDIR)
chmod 755 $(SBINDIR)/*
# Install shared libraries.
-mkdir -p $(LIBDIR)
cp -d build/$(RUNTIME_LIBDIR)/* $(LIBDIR)
chmod 755 $(LIBDIR)/*.so
# Update and install dynamic loader configuration file.
sed -e 's/\usr\/lib64.*/opt\/digilent\/linux_x86_64\/lib/' -e 's/\usr\/lib.*/opt\/digilent\/linux_x86\/lib/' build/$(RUNTIME_PACKAGE)/digilent-adept-libraries.conf > /etc/ld.so.conf.d/digilent-adept-libraries.conf
chmod 644 /etc/ld.so.conf.d/digilent-adept-libraries.conf
# Install firmware images and CoolRunner support files.
-mkdir -p $(DATADIR)
cp -r build/$(RUNTIME_PACKAGE)/data $(DATADIR)
chmod 755 $(DATADIR)/data/firmware/*.so
chmod 644 $(DATADIR)/data/firmware/*.HEX
chmod 644 $(DATADIR)/data/firmware/*.img
chmod 644 $(DATADIR)/data/xbr/*.map
chmod 644 $(DATADIR)/data/xpla3/*.map
chmod 644 $(DATADIR)/data/jtscdvclist.txt
# Update and install configuration file.
sed -e 's/DigilentPath=.*/DigilentPath=\/opt\/digilent\/share/' -e 's/DigilentDataPath=.*/DigilentDataPath=\/opt\/digilent\/share\/data/' build/$(RUNTIME_PACKAGE)/digilent-adept.conf > /etc/digilent-adept.conf
chmod 644 /etc/digilent-adept.conf
# Update and install udev rules.
sed -e 's/\/usr/\/opt\/digilent\/$(ARCH)/' build/$(RUNTIME_PACKAGE)/52-digilent-usb.rules > /etc/udev/rules.d/52-digilent-usb.rules
chmod 644 /etc/udev/rules.d/52-digilent-usb.rules
.PHONY: install-utilities
install-utilities:
# Install utilities binaries.
-mkdir -p $(BINDIR)
cp build/$(UTILITIES_BINDIR)/* $(BINDIR)
chmod 755 $(BINDIR)/*
# Install utilities man pages.
-mkdir -p $(MAN1DIR)
cp build/$(UTILITIES_PACKAGE)/man/* $(MAN1DIR)
chmod 644 $(MAN1DIR)/*
# Install bitstream files.
-mkdir -p $(DATADIR)/dsumecfg/bitstreams
cp -r build/$(UTILITIES_PACKAGE)/bitstreams/dsumecfg/* $(DATADIR)/dsumecfg/bitstreams
chmod 644 $(DATADIR)/dsumecfg/bitstreams/*
.PHONY: uninstall
uninstall: uninstall-runtime uninstall-utilities
# Update links and cache to the most recent shared libraries.
/sbin/ldconfig
# Reload udev rules.
udevadm control --reload-rules
.PHONY: uninstall-runtime
uninstall-runtime:
-rm -f $(SBINDIR)/*
-rm -f $(LIBDIR)/*
-rm -f $(DATADIR)/data/firmware/*
-rm -f $(DATADIR)/data/xbr/*
-rm -f $(DATADIR)/data/xpla3/*
-rm -f $(DATADIR)/data/jtscdvclist.txt
-rm -f /etc/ld.so.conf.d/digilent-adept-libraries.conf
-rm -f /etc/digilent-adept.conf
-rm -f /etc/udev/rules.d/52-digilent-usb.rules
.PHONY: uninstall-utilities
uninstall-utilities:
-rm -f $(BINDIR)/dadutil
-rm -f $(BINDIR)/djtgcfg
-rm -f $(BINDIR)/dsumecfg
-rm -f $(MAN1DIR)/dadutil.1
-rm -f $(MAN1DIR)/djtgcfg.1
-rm -f $(MAN1DIR)/dsumecfg.1
-rm -f $(DATADIR)/dsumecfg/bitstreams/*
.PHONY: clean
clean:
-rm -rf build