-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
67 lines (55 loc) · 2.02 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
SRC_DIR = src
DASH_DIR = dash
DASH_OUT = arcs-dash
DASH_CFLAGS = -Wall --std=c11 -O3
REMOTE_DIR = remote
REMOTE_OUT = arcs
REMOTE_CFLAGS = -Wall --std=c11 -O3
REMOTE_USER = pi
REMOTE_IP = 192.168.1.44
REMOTE_ARCS_DIR = /var/arcs
VIEWER_DIR = viewer
VIEWER_OUT = arcs-view
VIEWER_CFLAGS = -O3 -std=gnu++0x
all: dash viewer remote
clean: dash-clean viewer-clean remote-clean
dash:
@echo "[MAKE] dash"
@$(MAKE) --no-print-directory -C $(SRC_DIR)/$(DASH_DIR) "CFLAGS=$(DASH_CFLAGS)" "OUT=$(DASH_OUT)"
@echo "[DASH] [LN] $(DASH_OUT)"
@ln -s $(SRC_DIR)/$(DASH_DIR)/$(DASH_OUT) $(DASH_OUT)
viewer:
@echo "[MAKE] viewer"
@$(MAKE) --no-print-directory -C $(SRC_DIR)/$(VIEWER_DIR) "CFLAGS=$(VIEWER_CFLAGS)" "OUT=$(VIEWER_OUT)"
@echo "[DASH] [LN] $(VIEWER_OUT)"
@ln -s $(SRC_DIR)/$(VIEWER_DIR)/$(VIEWER_OUT) $(VIEWER_OUT)
remote:
@echo "[MAKE] remote"
@echo "[REMOTE] [SCP] $(SRC_DIR)/$(REMOTE_DIR)/*"
@scp -r $(SRC_DIR)/$(REMOTE_DIR)/* $(REMOTE_USER)@$(REMOTE_IP):$(REMOTE_ARCS_DIR)/
@echo "[REMOTE] [MAKE] remote"
@ssh $(REMOTE_USER)@$(REMOTE_IP) "$(MAKE) --no-print-directory -C $(REMOTE_ARCS_DIR) \"CFLAGS=$(REMOTE_CFLAGS)\" \"OUT=$(REMOTE_OUT)\""
@echo "[REMOTE] Restart Daemon"
@ssh root@$(REMOTE_IP) "systemctl restart arcs"
dash-clean:
@echo "[MAKE] dash-clean"
@$(MAKE) --no-print-directory -C $(SRC_DIR)/$(DASH_DIR) clean "OUT=$(DASH_OUT)"
@echo "[DASH] [RM] $(DASH_OUT)"
@rm -f $(DASH_OUT)
viewer-clean:
@echo "[MAKE] viewer-clean"
@$(MAKE) --no-print-directory -C $(SRC_DIR)/$(VIEWER_DIR) clean "OUT=$(VIEWER_OUT)"
@echo "[VIEWER] [RM] $(VIEWER_OUT)"
@rm -f $(VIEWER_OUT)
remote-clean:
@echo "[SSH] $(REMOTE_USER)@$(REMOTE_IP)"
@ssh $(REMOTE_USER)@$(REMOTE_IP) "rm -rf $(REMOTE_ARCS_DIR)/*; exit"
format:
@echo "[FORMAT] *.h"
@find . -type f -name '*.h' -exec clang-format -i {} \;
@echo "[FORMAT] *.c"
@find . -type f -name '*.c' -exec clang-format -i {} \;
@echo "[FORMAT] *.cpp"
@find . -type f -name '*.cpp' -exec clang-format -i {} \;
@echo "[FORMAT] *.hpp"
@find . -type f -name '*.hpp' -exec clang-format -i {} \;