186878f14SJakub Kicinski# SPDX-License-Identifier: GPL-2.0 286878f14SJakub Kicinski 386878f14SJakub KicinskiCC=gcc 486878f14SJakub KicinskiCFLAGS=-std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \ 5*f0ec58d5SJakub Kicinski -I../lib/ -idirafter $(UAPI_PATH) 686878f14SJakub Kicinskiifeq ("$(DEBUG)","1") 786878f14SJakub Kicinski CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan 886878f14SJakub Kicinskiendif 986878f14SJakub Kicinski 10*f0ec58d5SJakub Kicinskiinclude ../Makefile.deps 11*f0ec58d5SJakub Kicinski 122d7be507SJakub KicinskiYNL_GEN_ARG_ethtool:=--user-header linux/ethtool_netlink.h \ 132d7be507SJakub Kicinski --exclude-op stats-get 142d7be507SJakub Kicinski 1586878f14SJakub KicinskiTOOL:=../ynl-gen-c.py 1686878f14SJakub Kicinski 172d7be507SJakub KicinskiGENS:=ethtool devlink handshake fou netdev 1886878f14SJakub KicinskiSRCS=$(patsubst %,%-user.c,${GENS}) 1986878f14SJakub KicinskiHDRS=$(patsubst %,%-user.h,${GENS}) 2086878f14SJakub KicinskiOBJS=$(patsubst %,%-user.o,${GENS}) 2186878f14SJakub Kicinski 2286878f14SJakub Kicinskiall: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) regen 2386878f14SJakub Kicinski 2486878f14SJakub Kicinskiprotos.a: $(OBJS) 2586878f14SJakub Kicinski @echo -e "\tAR $@" 2686878f14SJakub Kicinski @ar rcs $@ $(OBJS) 2786878f14SJakub Kicinski 2886878f14SJakub Kicinski%-user.h: ../../../../Documentation/netlink/specs/%.yaml $(TOOL) 2986878f14SJakub Kicinski @echo -e "\tGEN $@" 302d7be507SJakub Kicinski @$(TOOL) --mode user --header --spec $< $(YNL_GEN_ARG_$*) > $@ 3186878f14SJakub Kicinski 3286878f14SJakub Kicinski%-user.c: ../../../../Documentation/netlink/specs/%.yaml $(TOOL) 3386878f14SJakub Kicinski @echo -e "\tGEN $@" 342d7be507SJakub Kicinski @$(TOOL) --mode user --source --spec $< $(YNL_GEN_ARG_$*) > $@ 3586878f14SJakub Kicinski 3686878f14SJakub Kicinski%-user.o: %-user.c %-user.h 3786878f14SJakub Kicinski @echo -e "\tCC $@" 38*f0ec58d5SJakub Kicinski @$(COMPILE.c) $(CFLAGS_$*) -o $@ $< 3986878f14SJakub Kicinski 4086878f14SJakub Kicinskiclean: 4186878f14SJakub Kicinski rm -f *.o 4286878f14SJakub Kicinski 4386878f14SJakub Kicinskihardclean: clean 4486878f14SJakub Kicinski rm -f *.c *.h *.a 4586878f14SJakub Kicinski 4686878f14SJakub Kicinskiregen: 4786878f14SJakub Kicinski @../ynl-regen.sh 4886878f14SJakub Kicinski 4986878f14SJakub Kicinski.PHONY: all clean hardclean regen 5086878f14SJakub Kicinski.DEFAULT_GOAL: all 51