xref: /linux/tools/net/ynl/samples/Makefile (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
1ee0202e2SJakub Kicinski# SPDX-License-Identifier: GPL-2.0
2ee0202e2SJakub Kicinski
3f0ec58d5SJakub Kicinskiinclude ../Makefile.deps
4f0ec58d5SJakub Kicinski
5ee0202e2SJakub KicinskiCC=gcc
6ee0202e2SJakub KicinskiCFLAGS=-std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \
7e2ca31ceSJakub Kicinski	-I../lib/ -I../generated/ -idirafter $(UAPI_PATH)
8ee0202e2SJakub Kicinskiifeq ("$(DEBUG)","1")
9ee0202e2SJakub Kicinski  CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
10ee0202e2SJakub Kicinskiendif
11ee0202e2SJakub Kicinski
1273395b43SJakub KicinskiLDLIBS=../lib/ynl.a ../generated/protos.a
13ee0202e2SJakub Kicinski
14ee0202e2SJakub KicinskiSRCS=$(wildcard *.c)
15ee0202e2SJakub KicinskiBINS=$(patsubst %.c,%,${SRCS})
16ee0202e2SJakub Kicinski
17ee0202e2SJakub Kicinskiinclude $(wildcard *.d)
18ee0202e2SJakub Kicinski
19ee0202e2SJakub Kicinskiall: $(BINS)
20ee0202e2SJakub Kicinski
2192900372SJakub KicinskiCFLAGS_page-pool=$(CFLAGS_netdev)
2292900372SJakub Kicinski
23637567e4SJakub Kicinski$(BINS): ../lib/ynl.a ../generated/protos.a $(SRCS)
24e2ca31ceSJakub Kicinski	@echo -e '\tCC sample $@'
25e2ca31ceSJakub Kicinski	@$(COMPILE.c) $(CFLAGS_$@) $@.c -o $@.o
26e2ca31ceSJakub Kicinski	@$(LINK.c) $@.o -o $@  $(LDLIBS)
27ee0202e2SJakub Kicinski
28ee0202e2SJakub Kicinskiclean:
29ee0202e2SJakub Kicinski	rm -f *.o *.d *~
30ee0202e2SJakub Kicinski
314e887471SJakub Kicinskidistclean: clean
32ee0202e2SJakub Kicinski	rm -f $(BINS)
33ee0202e2SJakub Kicinski
34*1d8617b2SJakub Kicinski.PHONY: all clean distclean
35ee0202e2SJakub Kicinski.DEFAULT_GOAL=all
36