1# SPDX-License-Identifier: GPL-2.0 2 3CC=gcc 4CFLAGS=-std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \ 5 -I../lib/ -idirafter $(UAPI_PATH) 6ifeq ("$(DEBUG)","1") 7 CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan 8endif 9 10include ../Makefile.deps 11 12YNL_GEN_ARG_ethtool:=--user-header linux/ethtool_netlink.h \ 13 --exclude-op stats-get 14 15TOOL:=../ynl-gen-c.py 16 17GENS:=ethtool devlink handshake fou netdev 18SRCS=$(patsubst %,%-user.c,${GENS}) 19HDRS=$(patsubst %,%-user.h,${GENS}) 20OBJS=$(patsubst %,%-user.o,${GENS}) 21 22all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) regen 23 24protos.a: $(OBJS) 25 @echo -e "\tAR $@" 26 @ar rcs $@ $(OBJS) 27 28%-user.h: ../../../../Documentation/netlink/specs/%.yaml $(TOOL) 29 @echo -e "\tGEN $@" 30 @$(TOOL) --mode user --header --spec $< $(YNL_GEN_ARG_$*) > $@ 31 32%-user.c: ../../../../Documentation/netlink/specs/%.yaml $(TOOL) 33 @echo -e "\tGEN $@" 34 @$(TOOL) --mode user --source --spec $< $(YNL_GEN_ARG_$*) > $@ 35 36%-user.o: %-user.c %-user.h 37 @echo -e "\tCC $@" 38 @$(COMPILE.c) $(CFLAGS_$*) -o $@ $< 39 40clean: 41 rm -f *.o 42 43hardclean: clean 44 rm -f *.c *.h *.a 45 46regen: 47 @../ynl-regen.sh 48 49.PHONY: all clean hardclean regen 50.DEFAULT_GOAL: all 51