-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (38 loc) · 1.33 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
ROOT=$(shell pwd)
OUTPUT_DIR=build
BINARY_NAME=server
NATIVE_DEP_DIR=natives-cache
NATIVE_CONTROLLER_VERSION_SHA=ba3b5bdad55dc7754567a68c4364b1e772735f47
all: build
clean:
rm -rf build/
cleanNative:
rm -rf $(NATIVE_DEP_DIR)
sudo rm -rf /usr/local/lib/arm-linux-gnueabihf/
$(NATIVE_DEP_DIR):
@echo "Missing natives cache, creating..."
git clone https://github.com/jgarff/rpi_ws281x.git $(NATIVE_DEP_DIR)
cd $(NATIVE_DEP_DIR) &&\
git reset --hard $(NATIVE_CONTROLLER_VERSION_SHA) &&\
scons V=true TOOLCHAIN=arm-linux-gnueabihf &&\
sudo mkdir -p /usr/local/lib/arm-linux-gnueabihf/ &&\
sudo cp libws2811.a /usr/local/lib/arm-linux-gnueabihf/
# Setting the library path within the build, whether via `LIBRARY_PATH`
# or directly through LD flags, fails for some reason. We're just going
# to throw the library into a default LD path to "solve" that issue.
uname -a > $(NATIVE_DEP_DIR)/built-with.txt
build: clean | $(NATIVE_DEP_DIR)
mkdir build/
env GOOS=linux \
GOARCH=arm \
GOARM=7 \
CGO_ENABLED=1 \
CC=arm-linux-gnueabihf-gcc \
CC_FOR_TARGET=arm-linux-gnueabihf-gcc \
CXX_FOR_TARGET=arm-linux-gnueabihf-g++ \
CPATH=$(ROOT)/$(NATIVE_DEP_DIR) \
LIBRARY_PATH=$(ROOT)/$(NATIVE_DEP_DIR) \
go build -o $(OUTPUT_DIR)/$(BINARY_NAME)
addDeps:
go get -v -u github.com/rpi-ws281x/rpi-ws281x-go
.PHONY: all