-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathdefines.mak
More file actions
97 lines (82 loc) · 2.54 KB
/
defines.mak
File metadata and controls
97 lines (82 loc) · 2.54 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
OUTPUT_DIR := $(GENERATED_DIR)/$(DRIVER)
LOG_DIR := $(OUTPUT_DIR)/log
MODULE_DIR := $(OUTPUT_DIR)/$(DRIVER)
UNIT_TEST_DIR := $(MODULE_DIR)/unit_tests
TEMPLATE_DIR := $(BUILD_HELPER_DIR)/templates
TOX_INI := $(OUTPUT_DIR)/tox.ini
DRIVER_DIR := $(ROOT_DIR)/src/$(DRIVER)
METADATA_DIR := $(DRIVER_DIR)/metadata
METADATA_FILES := $(wildcard $(METADATA_DIR)/*.py)
SHARED_PROTOS_DIR := $(ROOT_DIR)/src/shared_protos
NI_APIS_PROTOS_DIR := $(ROOT_DIR)/third_party/ni-apis/ni/grpcdevice/v1
PROTO_DIRS := $(METADATA_DIR) $(SHARED_PROTOS_DIR) $(NI_APIS_PROTOS_DIR)
PROTO_FILE ?= $(METADATA_DIR)/$(DRIVER).proto
BUILD_HELPER_SCRIPTS := $(wildcard $(BUILD_HELPER_DIR)/*.py $(BUILD_HELPER_DIR)/helper/*.py)
DRIVER_DOCS_DIR := $(DOCS_DIR)/$(DRIVER)
MKDIRECTORIES += \
$(DRIVER_DOCS_DIR) \
$(OUTPUT_DIR) \
$(MODULE_DIR) \
$(UNIT_TEST_DIR) \
$(LOG_DIR) \
VPATH = $(TEMPLATE_DIR)
true := T
false :=
GRPC_SUPPORTED := $(if $(wildcard $(PROTO_FILE)),$(true))
PYTHON_CMD ?= python
GRPC_SUPPORT_PARAM := $(if $(GRPC_SUPPORTED),--include-grpc-support)
define GENERATE_SCRIPT
$(PYTHON_CMD) -m build --template $1 --dest-dir $2 --metadata $3 $(if $4,--dest-file $4) $(if $(PRINT),-v,) $(GRPC_SUPPORT_PARAM)
endef
ifeq (,$(PRINT))
_hide_cmds := @
LOG_OUTPUT := >
else
LOG_OUTPUT := | tee
endif
TARGETS := $(filter-out run_unit_tests,$(DEFAULT_TARGETS))
.PHONY:
all: $(TARGETS)
DEFAULT_PY_FILES_TO_GENERATE := \
_attributes.py \
enums.py \
_library.py \
_library_interpreter.py \
_library_singleton.py \
session.py \
errors.py \
unit_tests/_mock_helper.py \
unit_tests/_matchers.py \
__init__.py \
_converters.py \
VERSION \
$(if $(GRPC_SUPPORTED), \
_grpc_stub_interpreter.py \
grpc_session_options.py \
$(basename $(notdir $(PROTO_FILE)))_pb2.py \
$(basename $(notdir $(PROTO_FILE)))_pb2_grpc.py \
nidevice_pb2.py \
nidevice_pb2_grpc.py \
) \
DEFAULT_PY_FILES_TO_COPY := \
_visatype.py \
DEFAULT_RST_FILES_TO_GENERATE := \
about_$(DRIVER).inc \
index.rst \
$(DRIVER).rst \
enums.rst \
examples.rst \
installation.inc \
status.inc \
class.rst \
toc.inc \
errors.rst \
rep_caps.rst \
$(if $(GRPC_SUPPORTED), \
grpc_session_options.rst \
) \
DEFAULT_SPHINX_CONF_PY := $(DRIVER_DOCS_DIR)/conf.py
DEFAULT_READTHEDOCS_CONFIG := $(DRIVER_DOCS_DIR)/.readthedocs.yaml
# Files for tracking parts of the build
SDIST_WHEEL_BUILD_DONE := $(LOG_DIR)/sdist_wheel_build_done
GENERATED_FILES_COPY_DONE := $(LOG_DIR)/generated_files_copy_done