Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1# SPDX-License-Identifier: GPL-2.0-only
2
3include ../Makefile.deps
4
5INSTALL ?= install
6prefix ?= /usr
7
8CC := gcc
9CFLAGS := -Wall -Wextra -Werror -O2
10ifeq ("$(DEBUG)","1")
11 CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
12endif
13CFLAGS += -I../lib -I../generated -I../../../include/uapi/
14
15SRC_VERSION := \
16 $(shell make --no-print-directory -sC ../../../.. kernelversion || \
17 echo "unknown")
18
19CFLAGS += -DSRC_VERSION='"$(SRC_VERSION)"'
20
21SRCS := $(wildcard *.c)
22OBJS := $(patsubst %.c,$(OUTPUT)%.o,$(SRCS))
23
24YNLTOOL := $(OUTPUT)ynltool
25
26include $(wildcard *.d)
27
28all: $(YNLTOOL)
29
30Q = @
31
32$(YNLTOOL): ../libynl.a $(OBJS)
33 $(Q)echo -e "\tLINK $@"
34 $(Q)$(CC) $(CFLAGS) -o $@ $(OBJS) ../libynl.a -lm
35
36%.o: %.c ../libynl.a
37 $(Q)echo -e "\tCC $@"
38 $(Q)$(COMPILE.c) -MMD -c -o $@ $<
39
40../libynl.a:
41 $(Q)$(MAKE) -C ../
42
43clean:
44 rm -f *.o *.d *~
45
46distclean: clean
47 rm -f $(YNLTOOL)
48
49bindir ?= /usr/bin
50
51install: $(YNLTOOL)
52 $(INSTALL) -m 0755 $(YNLTOOL) $(DESTDIR)$(bindir)/$(YNLTOOL)
53
54.PHONY: all clean distclean
55.DEFAULT_GOAL=all