| # SPDX-License-Identifier: GPL-2.0 |
| CFLAGS=-std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \ |
| -I../lib/ -idirafter $(UAPI_PATH) |
| CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan |
| YNL_GEN_ARG_ethtool:=--user-header linux/ethtool_netlink.h \ |
| GENS_PATHS=$(shell grep -nrI --files-without-match \ |
| ../../../../Documentation/netlink/specs/) |
| GENS=$(patsubst ../../../../Documentation/netlink/specs/%.yaml,%,${GENS_PATHS}) |
| SRCS=$(patsubst %,%-user.c,${GENS}) |
| HDRS=$(patsubst %,%-user.h,${GENS}) |
| OBJS=$(patsubst %,%-user.o,${GENS}) |
| all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) |
| %-user.h: ../../../../Documentation/netlink/specs/%.yaml $(TOOL) |
| @$(TOOL) --mode user --header --spec $< -o $@ $(YNL_GEN_ARG_$*) |
| %-user.c: ../../../../Documentation/netlink/specs/%.yaml $(TOOL) |
| @$(TOOL) --mode user --source --spec $< -o $@ $(YNL_GEN_ARG_$*) |
| %-user.o: %-user.c %-user.h |
| @$(COMPILE.c) $(CFLAGS_$*) -o $@ $< |
| .PHONY: all clean distclean regen |