xref: /linux/tools/net/ynl/samples/Makefile (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
1# SPDX-License-Identifier: GPL-2.0
2
3include ../Makefile.deps
4
5CC=gcc
6CFLAGS=-std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \
7	-I../lib/ -I../generated/ -idirafter $(UAPI_PATH)
8ifeq ("$(DEBUG)","1")
9  CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
10endif
11
12LDLIBS=../lib/ynl.a ../generated/protos.a
13
14SRCS=$(wildcard *.c)
15BINS=$(patsubst %.c,%,${SRCS})
16
17include $(wildcard *.d)
18
19all: $(BINS)
20
21CFLAGS_page-pool=$(CFLAGS_netdev)
22
23$(BINS): ../lib/ynl.a ../generated/protos.a $(SRCS)
24	@echo -e '\tCC sample $@'
25	@$(COMPILE.c) $(CFLAGS_$@) $@.c -o $@.o
26	@$(LINK.c) $@.o -o $@  $(LDLIBS)
27
28clean:
29	rm -f *.o *.d *~
30
31distclean: clean
32	rm -f $(BINS)
33
34.PHONY: all clean distclean
35.DEFAULT_GOAL=all
36