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 | |
| 27 | help: |
| 28 | echo "$$PROJECT_HELP_MSG" | less |
| 29 | |
| 30 | |
| 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 | d365451 | 2021-09-29 10:31:53 -0700 | [diff] [blame^] | 48 | run-native-test: $(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 | d365451 | 2021-09-29 10:31:53 -0700 | [diff] [blame^] | 51 | run-native: $(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 | d365451 | 2021-09-29 10:31:53 -0700 | [diff] [blame^] | 57 | run-native-test-no-show: $(VENV) |
Shad Ansari | d80531f | 2021-09-27 23:15:03 +0000 | [diff] [blame] | 58 | . ./bin/person_detection.sh -i ./resources/run.mp4 -ns |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 59 | |
Shad Ansari | d365451 | 2021-09-29 10:31:53 -0700 | [diff] [blame^] | 60 | run-native-no-show: $(VENV) |
Shad Ansari | d80531f | 2021-09-27 23:15:03 +0000 | [diff] [blame] | 61 | . ./bin/person_detection.sh -i gstreamer -ns |
Shad Ansari | 55ff185 | 2021-09-27 20:05:54 +0000 | [diff] [blame] | 62 | |
| 63 | test: |
Shad Ansari | 47432b6 | 2021-09-27 22:46:25 +0000 | [diff] [blame] | 64 | |
| 65 | |
| 66 | CLEANUP = *.pyc $(VENV) |
| 67 | clean: |
| 68 | rm -rf ${CLEANUP} |
| 69 | |
| 70 | .PHONY: run clean |
| 71 | |