Shad Ansari | d365451 | 2021-09-29 10:31:53 -0700 | [diff] [blame] | 1 | # |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 2 | # SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org> |
| 3 | # SPDX-License-Identifier: LicenseRef-ONF-Member-1.01 |
| 4 | # |
| 5 | define PROJECT_HELP_MSG |
| 6 | Usage: |
| 7 | make help show this message |
| 8 | make clean remove intermediate files |
Shad Ansari | 55ff185 | 2021-09-27 20:05:54 +0000 | [diff] [blame] | 9 | |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 10 | 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 |
| 18 | endef |
| 19 | export PROJECT_HELP_MSG |
| 20 | |
| 21 | SHELL = /bin/bash |
| 22 | VENV = .venv |
| 23 | PYTHON = $(VENV)/bin/python3 |
| 24 | PIP = $(VENV)/bin/pip |
| 25 | IMAGE = person-detection-app |
| 26 | |
Shad Ansari | b5808d7 | 2021-10-04 12:43:27 -0700 | [diff] [blame^] | 27 | |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 28 | help: |
| 29 | echo "$$PROJECT_HELP_MSG" | less |
| 30 | |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 31 | $(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 | |
| 42 | build: $(VENV) |
| 43 | docker build -f docker/Dockerfile -t $(IMAGE) . |
| 44 | |
| 45 | run: |
| 46 | docker run -itu root:root --privileged --network host --name $(IMAGE) --rm $(IMAGE) |
| 47 | |
Shad Ansari | 341ca3a | 2021-09-30 12:10:00 -0700 | [diff] [blame] | 48 | run-native-file: $(VENV) |
Shad Ansari | d80531f | 2021-09-27 23:15:03 +0000 | [diff] [blame] | 49 | . ./bin/person_detection.sh -i ./resources/run.mp4 |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 50 | |
Shad Ansari | 341ca3a | 2021-09-30 12:10:00 -0700 | [diff] [blame] | 51 | run-native-gstream: $(VENV) |
Shad Ansari | d80531f | 2021-09-27 23:15:03 +0000 | [diff] [blame] | 52 | . ./bin/person_detection.sh -i gstreamer |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 53 | |
Shad Ansari | d365451 | 2021-09-29 10:31:53 -0700 | [diff] [blame] | 54 | run-native-cam: $(VENV) |
Shad Ansari | 0119b42 | 2021-09-27 23:51:49 +0000 | [diff] [blame] | 55 | . ./bin/person_detection.sh -i cam |
| 56 | |
Shad Ansari | b5808d7 | 2021-10-04 12:43:27 -0700 | [diff] [blame^] | 57 | lint: |
| 58 | flake8 --exclude=.tox person_detection |
| 59 | |
Shad Ansari | 55ff185 | 2021-09-27 20:05:54 +0000 | [diff] [blame] | 60 | test: |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 61 | |
| 62 | |
| 63 | CLEANUP = *.pyc $(VENV) |
| 64 | clean: |
| 65 | rm -rf ${CLEANUP} |
| 66 | |
| 67 | .PHONY: run clean |
| 68 | |