-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
33 lines (27 loc) · 890 Bytes
/
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
NIMC=nim c -d:quick --opt:size
STRIP=mipsel-openwrt-linux-strip -s
NFLAGS=--os:linux
XFLAGS=--cpu:mipsel --os:linux
TARGET=radioApi
PACK=upx
PFLAGS=--ultra-brute
# regular local compile
$(TARGET):
$(NIMC) $(NFLAGS) $(TARGET).nim
# portable (when there's no nim installed locally)
docker:
docker run --rm -v ${PWD}:/src nimlang/nim /bin/sh -c "cd /src;$(NIMC) $(NFLAGS) $(TARGET).nim"
# cross-compile for the HooToo HT-TM02 with docker
ht02:
docker run --rm -v ${PWD}:/src davidsblog/lede-17-01-02-ht-tm02-nim /bin/sh -c "cd /src;$(NIMC) $(XFLAGS) $(TARGET).nim;$(STRIP) $(TARGET)"
$(PACK) $(TARGET) $(PFLAGS)
# deploy to HooToo - provide the ip address on the command line, eg: make ip=192.168.1.10 deploy
deploy: ht02
rm -rf radio
mkdir radio radio/public
cp -rf public radio/
cp -rf $(TARGET) radio/
scp -r radio root@$(ip):/usr/bin/
.PHONY: clean
clean:
rm -f $(TARGET)