forked from navarrothiago/openair-cn-cups
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (56 loc) · 2.51 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
# imagem para rodar os binários
IMAGE_NAME=openair-cn-cups
# container name
CONTAINER_NAME=openair-cn-cups
# tag da imagem
IMAGE_TAG=latest
# diretório do projeto específico que contém o CMakeLists.txt
PROJECT_DIR=$(CURDIR)
# diretório de trabalho no container
WORK_CONTAINER_DIR=$(PROJECT_DIR)
# diretório de testes
TEST_DIR=$(PROJECT_DIR)/build/Debug
NUM_THREADS=8
.PHONY: help
help:
@echo "Usage: make [comando]"
@echo "Gerencia o container de build."
@echo
@echo "Comandos:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "- \033[36m%-30s\033[0m %s\n", $$1, $$2}'
# Função para realizar diversos tipos de build locais
# O primeiro parâmetro é o tipo do build
define build
docker run -it --workdir $(WORK_CONTAINER_DIR) -v $(PROJECT_DIR):$(PROJECT_DIR) \
$(IMAGE_NAME):$(IMAGE_TAG) /bin/bash -c \
'cd $(PROJECT_DIR)/build/scripts && \
./build_spgwu -c -V -b Debug -j'
endef
docker-debug: ## Build in Debug mode
docker-build
$(call build)
docker-clean: ## Clean generated artifects
docker run -it -v $(PROJECT_DIR):$(PROJECT_DIR) \
$(IMAGE_CROSS) /bin/bash -c \
'cd $(PROJECT_DIR)/build/Debug && make clean && \
cd $(PROJECT_DIR)/build/Release && make clean'
docker-bash: ## Run container in bash mode
docker run -it --workdir $(WORK_CONTAINER_DIR) -v $(PROJECT_DIR):$(PROJECT_DIR) \
$(IMAGE_NAME) --name=$(CONTAINER_NAME) /bin/bash
docker-login: ## Login in openair-cn-cups container
docker exec -it openair-cn-cups /bin/bash -c 'cd /workspaces/openair-cn-cups && /bin/bash'
docker-create-network: ## Create macvlan with subnet 192.168.15.0 using enp0s20f0u1 interface
docker network create -d macvlan --subnet=192.168.15.0/24 --gateway=192.168.15.1 -o parent=enp0s20f0u1 macvlan-enp0s20f0u1
docker-setup-network: ## Connect maclan on container openair-cn-cup and create spgwu interfaces
docker network connect macvlan-enp0s20f0u1 openair-cn-cups
docker-config-spgwu-iface: ## Create and configure spgwu interefaces
$(PROJECT_DIR)/configs/config-spgwu-interface.sh
docker-run-spwgu: ## Run container and run spgwu
docker run -it --workdir $(WORK_CONTAINER_DIR) -v $(PROJECT_DIR):$(PROJECT_DIR) \
$(IMAGE_NAME) /bin/bash -c '$(PROJECT_DIR)/build/spgw_u/build/spgwu -c ./etc/spgw_u-dev.conf'
docker-build: ## Build docker image
docker build --build-arg UID=$$(id -u) --build-arg GID=$$(id -g) -t $(IMAGE_NAME) docker/.
run-spgwu: ## Run spgwu
$(PROJECT_DIR)/build/spgw_u/build/spgwu -c ./etc/spgw_u-dev.conf -o
kill-spgwu: ## Kill spgwu
echo "TODO"