mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
Use $(AR) to allow build system to override the archiver tool (e.g., when cross-compiling for a different architecture) by setting the AR environment variable. GNU Make defaults AR to ar, so this change will not break existing build environments that do not explicitly set AR. Fixes:07c3cc51a0("tools: net: package libynl for use in selftests") Fixes:86878f14d7("tools: ynl: user space helpers") Signed-off-by: Greg Thelen <gthelen@google.com> Link: https://patch.msgid.link/20260622161659.145047-1-gthelen@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
31 lines
504 B
Makefile
31 lines
504 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
CC=gcc
|
|
CFLAGS += -std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow
|
|
ifeq ("$(DEBUG)","1")
|
|
CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
|
|
endif
|
|
|
|
SRCS=$(wildcard *.c)
|
|
OBJS=$(patsubst %.c,%.o,${SRCS})
|
|
|
|
include $(wildcard *.d)
|
|
|
|
all: ynl.a
|
|
|
|
ynl.a: $(OBJS)
|
|
@echo -e "\tAR $@"
|
|
@$(AR) rcs $@ $(OBJS)
|
|
|
|
clean:
|
|
rm -f *.o *.d *~
|
|
|
|
distclean: clean
|
|
rm -f *.a
|
|
|
|
%.o: %.c
|
|
$(COMPILE.c) -MMD -c -o $@ $<
|
|
|
|
.PHONY: all clean distclean
|
|
.DEFAULT_GOAL=all
|