drivers/comedi/drivers/ni_routing/tools/Makefile

Source file repositories/reference/linux-study-clean/drivers/comedi/drivers/ni_routing/tools/Makefile

File Facts

System
Linux kernel
Corpus path
drivers/comedi/drivers/ni_routing/tools/Makefile
Extension
[no extension]
Size
3251 bytes
Lines
88
Domain
Driver Families
Bucket
drivers/comedi
Inferred role
Driver Families: build/configuration rule
Status
atlas-only

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

# SPDX-License-Identifier: GPL-2.0
# this make file is simply to help autogenerate these files:
# 	ni_route_values.h
#	ni_device_routes.h
# in order to do this, we are also generating a python representation (using
# ctypesgen) of ../../../../../include/uapi/linux/comedi.h.
# This allows us to sort NI signal/terminal names numerically to use a binary
# search through the device_routes tables to find valid routes.

ALL:
	@echo Typical targets:
	@echo "\`make csv-files\`"
	@echo "  Creates new csv-files using content of c-files of existing"
	@echo "  ni_routing/* content.  New csv files are placed in csv"
	@echo "  sub-directory."
	@echo "\`make c-files\`"
	@echo "  Creates new c-files using content of csv sub-directory.  These"
	@echo "  new c-files can be compared to the active content in the"
	@echo "  ni_routing directory."
	@echo "\`make csv-blank\`"
	@echo "  Create a new blank csv file.  This is useful for establishing a"
	@echo "  new data table for either a device family \(less likely\) or a"
	@echo "  specific board of an existing device family \(more likely\)."
	@echo "\`make clean-partial\`"
	@echo "  Remove all generated files/directories EXCEPT for csv/c files."
	@echo "\`make clean\`"
	@echo "  Remove all generated files/directories."
	@echo "\`make everything\`"
	@echo "  Build all csv-files, then all new c-files."

everything : csv-files c-files csv-blank

CPPFLAGS = -D__user=
INC_UAPI = ../../../../../include/uapi

comedi_h.py: $(INC_UAPI)/linux/comedi.h
	ctypesgen $< --include "sys/ioctl.h" --cpp 'gcc -E $(CPPFLAGS)' -o $@

convert_c_to_py: all_cfiles.c linux/comedi.h
	gcc -g -I. convert_c_to_py.c -o convert_c_to_py -std=c99

# Create a local 'linux/comedi.h' for use when compiling 'convert_c_to_py.c'
# with the '-I.' option.  (Cannot specify '-I../../../../../include/uapi'
# because that interferes with inclusion of other system headers.)
linux/comedi.h: $(INC_UAPI)/linux/comedi.h
	mkdir -p linux
	ln -snf ../$< $@

ni_values.py: convert_c_to_py
	./convert_c_to_py

csv-files : ni_values.py comedi_h.py
	./convert_py_to_csv.py

csv-blank : comedi_h.py
	./make_blank_csv.py
	@echo New blank csv signal table in csv/blank_route_table.csv

c-files : comedi_h.py
	./convert_csv_to_c.py --route_values --device_routes

ROUTE_VALUES_SRC=$(wildcard ../ni_route_values/*.c)
DEVICE_ROUTES_SRC=$(wildcard ../ni_device_routes/*.c)
all_cfiles.c : $(DEVICE_ROUTES_SRC) $(ROUTE_VALUES_SRC)
	@for i in $(DEVICE_ROUTES_SRC) $(ROUTE_VALUES_SRC); do \
		echo "#include \"$$i\"" >> all_cfiles.c; \
	done

clean-partial :
	$(RM) -rf comedi_h.py ni_values.py convert_c_to_py all_cfiles.c *.pyc \

Annotation

Implementation Notes