Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 1 | # SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org> |
| 2 | # SPDX-License-Identifier: LicenseRef-ONF-Member-1.01 |
| 3 | # |
| 4 | define PROJECT_HELP_MSG |
| 5 | Usage: |
| 6 | make help show this message |
| 7 | make clean remove intermediate files |
Shad Ansari | 55ff185 | 2021-09-27 20:05:54 +0000 | [diff] [blame] | 8 | |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 9 | make ${VENV} make a virtualenv in the base directory |
| 10 | make python-reqs install python packages in requirements.pip |
| 11 | make git-config set local git configuration |
| 12 | make setup make python-reqs |
| 13 | |
| 14 | make run launch network-video-recorder |
| 15 | make run-native run native application (no docker) |
| 16 | make run-native-no-show run native applicaiton (no docker) w/o video output |
| 17 | endef |
| 18 | export PROJECT_HELP_MSG |
| 19 | |
| 20 | SHELL = /bin/bash |
| 21 | VENV = .venv |
| 22 | PYTHON = $(VENV)/bin/python3 |
| 23 | PIP = $(VENV)/bin/pip |
| 24 | IMAGE = person-detection-app |
| 25 | |
| 26 | help: |
| 27 | echo "$$PROJECT_HELP_MSG" | less |
| 28 | |
| 29 | |
| 30 | $(VENV): $(VENV)/touchfile |
| 31 | |
| 32 | $(VENV)/touchfile: requirements.txt |
| 33 | test -d $(VENV) || python3 -m venv $(VENV) |
| 34 | . $(VENV)/bin/activate; pip install -Ur requirements.txt |
| 35 | touch $(VENV)/touchfile |
| 36 | |
| 37 | $(VENV)/bin/activate: requirements.txt |
| 38 | python3 -m venv $(VENV) |
| 39 | $(PIP) install -r requirements.txt |
| 40 | |
| 41 | build: $(VENV) |
| 42 | docker build -f docker/Dockerfile -t $(IMAGE) . |
| 43 | |
| 44 | run: |
| 45 | docker run -itu root:root --privileged --network host --name $(IMAGE) --rm $(IMAGE) |
| 46 | |
| 47 | run-native-test: |
Shad Ansari | d80531f | 2021-09-27 23:15:03 +0000 | [diff] [blame] | 48 | . ./bin/person_detection.sh -i ./resources/run.mp4 |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 49 | |
| 50 | run-native: |
Shad Ansari | d80531f | 2021-09-27 23:15:03 +0000 | [diff] [blame] | 51 | . ./bin/person_detection.sh -i gstreamer |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 52 | |
Shad Ansari | 0119b42 | 2021-09-27 23:51:49 +0000 | [diff] [blame] | 53 | run-native-cam: |
| 54 | . ./bin/person_detection.sh -i cam |
| 55 | |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 56 | run-native-test-no-show: |
Shad Ansari | d80531f | 2021-09-27 23:15:03 +0000 | [diff] [blame] | 57 | . ./bin/person_detection.sh -i ./resources/run.mp4 -ns |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 58 | |
| 59 | run-native-no-show: |
Shad Ansari | d80531f | 2021-09-27 23:15:03 +0000 | [diff] [blame] | 60 | . ./bin/person_detection.sh -i gstreamer -ns |
Shad Ansari | 55ff185 | 2021-09-27 20:05:54 +0000 | [diff] [blame] | 61 | |
| 62 | test: |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 63 | |
| 64 | |
| 65 | CLEANUP = *.pyc $(VENV) |
| 66 | clean: |
| 67 | rm -rf ${CLEANUP} |
| 68 | |
| 69 | .PHONY: run clean |
| 70 | |