blob: 3ce37b2c55c8e179e9669d3635c142a07280b2d5 [file] [log] [blame]
Shad Ansarid3654512021-09-29 10:31:53 -07001#
Shad Ansari47432b62021-09-27 22:46:25 +00002# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
3# SPDX-License-Identifier: LicenseRef-ONF-Member-1.01
4#
5define PROJECT_HELP_MSG
6Usage:
7 make help show this message
8 make clean remove intermediate files
Shad Ansari55ff1852021-09-27 20:05:54 +00009
Shad Ansari47432b62021-09-27 22:46:25 +000010 make ${VENV} make a virtualenv in the base directory
11 make python-reqs install python packages in requirements.pip
12 make git-config set local git configuration
13 make setup make python-reqs
14
15 make run launch network-video-recorder
16 make run-native run native application (no docker)
17 make run-native-no-show run native applicaiton (no docker) w/o video output
18endef
19export PROJECT_HELP_MSG
20
21SHELL = /bin/bash
22VENV = .venv
23PYTHON = $(VENV)/bin/python3
24PIP = $(VENV)/bin/pip
25IMAGE = person-detection-app
26
Shad Ansarib5808d72021-10-04 12:43:27 -070027
Shad Ansari47432b62021-09-27 22:46:25 +000028help:
29 echo "$$PROJECT_HELP_MSG" | less
30
Shad Ansari47432b62021-09-27 22:46:25 +000031$(VENV): $(VENV)/touchfile
32
33$(VENV)/touchfile: requirements.txt
34 test -d $(VENV) || python3 -m venv $(VENV)
35 . $(VENV)/bin/activate; pip install -Ur requirements.txt
36 touch $(VENV)/touchfile
37
38$(VENV)/bin/activate: requirements.txt
39 python3 -m venv $(VENV)
40 $(PIP) install -r requirements.txt
41
42build: $(VENV)
43 docker build -f docker/Dockerfile -t $(IMAGE) .
44
45run:
46 docker run -itu root:root --privileged --network host --name $(IMAGE) --rm $(IMAGE)
47
Shad Ansari341ca3a2021-09-30 12:10:00 -070048run-native-file: $(VENV)
Shad Ansarid80531f2021-09-27 23:15:03 +000049 . ./bin/person_detection.sh -i ./resources/run.mp4
Shad Ansari47432b62021-09-27 22:46:25 +000050
Shad Ansari341ca3a2021-09-30 12:10:00 -070051run-native-gstream: $(VENV)
Shad Ansarid80531f2021-09-27 23:15:03 +000052 . ./bin/person_detection.sh -i gstreamer
Shad Ansari47432b62021-09-27 22:46:25 +000053
Shad Ansarid3654512021-09-29 10:31:53 -070054run-native-cam: $(VENV)
Shad Ansari0119b422021-09-27 23:51:49 +000055 . ./bin/person_detection.sh -i cam
56
Shad Ansarib5808d72021-10-04 12:43:27 -070057lint:
58 flake8 --exclude=.tox person_detection
59
Shad Ansari55ff1852021-09-27 20:05:54 +000060test:
Shad Ansari47432b62021-09-27 22:46:25 +000061
62
63CLEANUP = *.pyc $(VENV)
64clean:
65 rm -rf ${CLEANUP}
66
67.PHONY: run clean
68