-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
102 lines (82 loc) · 3.14 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
export ROOT_DIR = $(shell pwd)
export BIN_DIR = $(ROOT_DIR)/bin
export INHERIT_INCLUDES = -I$(ROOT_DIR)/lib-pheripherals/include -I$(ROOT_DIR)/lib-gui/include
export LIB_DIR = -L$(ROOT_DIR)/bin
#TARGET_IP ?= 192.168.202.127
ifeq ($(TARGET_IP),)
ifneq ($(filter debug run,$(MAKECMDGOALS)),)
$(warning The target IP address is not set)
$(warning Run as "TARGET_IP=192.168.202.xxx make run" or modify Makefile)
TARGET_IP ?= 192.168.202.xxx
endif
endif
TARGET_DIR ?= /tmp/$(shell whoami)
TARGET_USER ?= root
# for use from Eduroam network use TARGET_IP=localhost and enable next line
SSH_OPTIONS=-o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -o "Port=2222"
SSH_GDB_TUNNEL_REQUIRED=y
SSH_OPTIONS+=-i ~/.ssh/mzapo-root-key
#SSH_OPTIONS=-i /opt/zynq/ssh-connect/mzapo-root-key
#SSH_OPTIONS=-o '[email protected]'
IMAGE_VIEWER=$(BIN_DIR)/image-viewer
LIB_PHERIPHERALS=$(BIN_DIR)/libmzapo-pheripherals.so
LIB_GUI=$(BIN_DIR)/libmzapo-gui.so
TEXT_VIEWER=$(BIN_DIR)/text-viewer
FILE_BROWSER=$(BIN_DIR)/file-browser
MZAPO_SDL=$(BIN_DIR)/libmzapo_sdl.so
ifdef COMPUTER
DEPENDENCIES=./.computer
COMPUTER_SDL=mzapo-sdl
INHERIT_INCLUDES += -I$(ROOT_DIR)/mzapo-sdl/include
else
DEPENDENCIES=./.arm
COMPUTER_SDL=
endif
all: $(DEPENDENCIES) image-viewer text-viewer file-browser
image-viewer: $(IMAGE_VIEWER)
lib-pheripherals: $(LIB_PHERIPHERALS)
lib-gui: $(LIB_GUI)
text-viewer: $(TEXT_VIEWER)
file-browser: $(FILE_BROWSER)
mzapo-sdl: $(MZAPO_SDL)
$(IMAGE_VIEWER): $(DEPENDENCIES) lib-pheripherals $(COMPUTER_SDL) FORCE
@make -C image-viewer
$(TEXT_VIEWER): $(DEPENDENCIES) lib-pheripherals lib-gui $(COMPUTER_SDL) FORCE
@make -C text-viewer
$(FILE_BROWSER): $(DEPENDENCIES) lib-pheripherals lib-gui $(COMPUTER_SDL) FORCE
@make -C file-browser
$(DEPENDENCIES):
@make clean
touch $(DEPENDENCIES)
$(LIB_PHERIPHERALS): $(DEPENDENCIES) FORCE
@make -C lib-pheripherals
$(LIB_GUI): $(DEPENDENCIES) FORCE
@make -C lib-gui
$(MZAPO_SDL): FORCE
@make -C mzapo-sdl
copy-executable: all
ssh $(SSH_OPTIONS) -t $(TARGET_USER)@$(TARGET_IP) killall gdbserver 1>/dev/null 2>/dev/null || true
ssh $(SSH_OPTIONS) $(TARGET_USER)@$(TARGET_IP) mkdir -p $(TARGET_DIR)
scp -r $(SSH_OPTIONS) $(BIN_DIR) $(TARGET_USER)@$(TARGET_IP):$(TARGET_DIR)/$(NAME)
scp -r $(SSH_OPTIONS) $(ROOT_DIR)/copy $(TARGET_USER)@$(TARGET_IP):$(TARGET_DIR)/$(NAME)
ssh $(SSH_OPTIONS) $(TARGET_USER)@$(TARGET_IP) mv $(TARGET_DIR)/bin/* $(TARGET_DIR)
ssh $(SSH_OPTIONS) $(TARGET_USER)@$(TARGET_IP) mv $(TARGET_DIR)/copy/* $(TARGET_DIR)
run: copy-executable
ssh $(SSH_OPTIONS) -t $(TARGET_USER)@$(TARGET_IP) $(TARGET_DIR)/file-browser $(ARG)
run-image-viewer: copy-executable
ssh $(SSH_OPTIONS) -t $(TARGET_USER)@$(TARGET_IP) $(TARGET_DIR)/image-viewer $(ARG)
run-text-viewer: copy-executable
ssh $(SSH_OPTIONS) -t $(TARGET_USER)@$(TARGET_IP) $(TARGET_DIR)/text-viewer $(ARG)
docs: FORCE
doxygen DOXYGEN
clean:
@make -C image-viewer clean
@make -C text-viewer clean
@make -C file-browser clean
@make -C lib-pheripherals clean
@make -C lib-gui clean
@make -C mzapo-sdl clean
$(RM) -rf $(BIN_DIR)
$(RM) -rf ./.computer ./.arm
FORCE:
.PHONY: all clean run-image-viewer run-text-viewer copy-executable FORCE