xref: /linux/tools/net/ynl/samples/Makefile (revision c48a7c44a1d02516309015b6134c9bb982e17008)
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=-lmnl ../lib/ynl.a ../generated/protos.a
13
14SRCS=$(wildcard *.c)
15BINS=$(patsubst %.c,%,${SRCS})
16
17include $(wildcard *.d)
18
19all: $(BINS)
20
21$(BINS): ../lib/ynl.a ../generated/protos.a
22	@echo -e '\tCC sample $@'
23	@$(COMPILE.c) $(CFLAGS_$@) $@.c -o $@.o
24	@$(LINK.c) $@.o -o $@  $(LDLIBS)
25
26clean:
27	rm -f *.o *.d *~
28
29hardclean: clean
30	rm -f $(BINS)
31
32.PHONY: all clean
33.DEFAULT_GOAL=all
34