-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
87 lines (64 loc) · 2.37 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
OS := $(if $(findstring Windows_NT,$(OS)),Windows,$(OS))
BUILD_LOC = bin
BUILD_HELPER_LOC := .build_helper
OUTPUT_FILE := $(if $(findstring Windows,$(OS)),build_helper.exe,build_helper)
define build_build_helper
go build -o $(OUTPUT_FILE) $(BUILD_HELPER_LOC)/main.go
endef
define delete_folder
$(call build_build_helper)
./build_helper delete $(1)
endef
define copy_folder_or_file
$(call build_build_helper)
./build_helper copy $(1) $(2)
endef
preconfig_frontend:
echo "\n----- Preconfig: Setting up svelte frontend nodejs dependencies -----\n"
cd ./frontend && npm i
preconfig_conformance_server:
echo "\n----- Preconfig: Updating go dependencies -----\n"
go get
setup: preconfig_frontend preconfig_conformance_server
# Compiling GO code
compile_win:
echo "\n----- Building for Windows... -----\n"
set GOOS=windows
set GOARCH=amd64
go build -o $(BUILD_LOC)/iot-fdo-conformance-tools-windows.exe
$(call copy_folder_or_file,./$(BUILD_HELPER_LOC)/start_server.bat,./$(BUILD_LOC)/start_server.bat)
compile_linux:
echo "\n----- Building for Linux... -----\n"
set GOOS=linux
set GOARCH=amd64
go env
go build -o $(BUILD_LOC)/iot-fdo-conformance-tools-linux
compile_osx:
echo "\n----- Building for MacOS... -----\n"
set GOOS=darwin
set GOARCH=amd64
go build -o $(BUILD_LOC)/iot-fdo-conformance-tools-osx
compile_all: compile_win compile_linux compile_osx
cleanup_frontend:
$(call delete_folder,./$(BUILD_LOC)/frontend)
# Build frontend
build_frontend:
echo "\n----- Building frontend... -----\n"
cd ./frontend && npm run build
$(call copy_folder_or_file,./frontend/dist,./$(BUILD_LOC)/frontend)
build: cleanup_frontend build_frontend compile_all
FDOTOOLS_BIN_LOC = ~/conformance-test-infrastructure-new/iot-fdo-conformance/
FDOTOOLS_INFRA_LOC = ~/conformance-test-infrastructure-new/
# Build frontend
fdotools__push_new_bin:
echo "\n----- Updating FDO tools binary... -----\n"
scp -P ${FDO_BUILD_PUSH_PORT} ./bin/iot-fdo-conformance-tools-linux ${FDO_BUILD_PUSH_HOST}:$(FDOTOOLS_BIN_LOC)
# Build frontend
fdotools__push_new_ui:
echo "\n----- Updating FDO tools ui... -----\n"
scp -R ./bin/frontend ${FDO_BUILD_PUSH_HOST}:$(FDOTOOLS_BIN_LOC)
# Build frontend
fdotools__restart_docker_compose:
echo "\n----- Restarting docker compose... -----\n"
ssh ${FDO_BUILD_PUSH_HOST} "cd $(FDOTOOLS_INFRA_LOC) && docker-compose up --build --force -d"
# fdotools__restart_docker_update: