mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-12 05:24:12 +08:00
7f33105cdd
Commit97d5f2e9ee
("tools api fs: More thread safety for global filesystem variables") introduces pthread_once, so the libpthread should be added at link time, or we'll meet the following compile error when 'make -C tools/mm': gcc -Wall -Wextra -I../lib/ -o page-types page-types.c ../lib/api/libapi.a ~/linux/tools/lib/api/fs/fs.c:146: undefined reference to `pthread_once' ~/linux/tools/lib/api/fs/fs.c:147: undefined reference to `pthread_once' ~/linux/tools/lib/api/fs/fs.c:148: undefined reference to `pthread_once' ~/linux/tools/lib/api/fs/fs.c:149: undefined reference to `pthread_once' ~/linux/tools/lib/api/fs/fs.c:150: undefined reference to `pthread_once' /usr/bin/ld: ../lib/api/libapi.a(libapi-in.o):~/linux/tools/lib/api/fs/fs.c:151: more undefined references to `pthread_once' follow collect2: error: ld returned 1 exit status make: *** [Makefile:22: page-types] Error 1 Link: https://lkml.kernel.org/r/20230831034205.2376653-1-xiexiuqi@huaweicloud.com Fixes:97d5f2e9ee
("tools api fs: More thread safety for global filesystem variables") Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com> Acked-by: Ian Rogers <irogers@google.com> Cc: Matthew Wilcox <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
33 lines
573 B
Makefile
33 lines
573 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
# Makefile for vm tools
|
|
#
|
|
include ../scripts/Makefile.include
|
|
|
|
TARGETS=page-types slabinfo page_owner_sort
|
|
|
|
LIB_DIR = ../lib/api
|
|
LIBS = $(LIB_DIR)/libapi.a
|
|
|
|
CFLAGS += -Wall -Wextra -I../lib/ -pthread
|
|
LDFLAGS += $(LIBS) -pthread
|
|
|
|
all: $(TARGETS)
|
|
|
|
$(TARGETS): $(LIBS)
|
|
|
|
$(LIBS):
|
|
make -C $(LIB_DIR)
|
|
|
|
%: %.c
|
|
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
|
|
|
clean:
|
|
$(RM) page-types slabinfo page_owner_sort
|
|
make -C $(LIB_DIR) clean
|
|
|
|
sbindir ?= /usr/sbin
|
|
|
|
install: all
|
|
install -d $(DESTDIR)$(sbindir)
|
|
install -m 755 -p $(TARGETS) $(DESTDIR)$(sbindir)
|