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