요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
# SPDX-License-Identifier: GPL-2.0-only
# Based on bpftool's Documentation Makefile
INSTALL ?= install
RM ?= rm -f
RMDIR ?= rmdir --ignore-fail-on-non-empty
PREFIX ?= /usr/share
MANDIR ?= $(PREFIX)/man
MAN1DIR = $(MANDIR)/man1
MAN1_RST = $(wildcard rtla*.rst)
_DOC_MAN1 = $(patsubst %.rst,%.1,$(MAN1_RST))
DOC_MAN1 = $(addprefix $(OUTPUT),$(_DOC_MAN1))
RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
RST2MAN_OPTS += --verbose
TEST_RST2MAN = $(shell sh -c "rst2man --version > /dev/null 2>&1 || echo n")
$(OUTPUT)%.1: %.rst
ifndef RST2MAN_DEP
$(info ********************************************)
$(info ** NOTICE: rst2man not found)
$(info **)
$(info ** Consider installing the latest rst2man from your)
$(info ** distribution, e.g., 'dnf install python3-docutils' on Fedora,)
$(info ** or from source:)
$(info **)
$(info ** https://docutils.sourceforge.io/docs/dev/repository.html )
$(info **)
$(info ********************************************)
$(error NOTICE: rst2man required to generate man pages)
endif
rst2man $(RST2MAN_OPTS) $< > $@
man1: $(DOC_MAN1)
man: man1
clean:
$(RM) $(DOC_MAN1)
install: man
$(INSTALL) -d -m 755 $(DESTDIR)$(MAN1DIR)
$(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(MAN1DIR)
uninstall:
$(RM) $(addprefix $(DESTDIR)$(MAN1DIR)/,$(_DOC_MAN1))
$(RMDIR) $(DESTDIR)$(MAN1DIR)
.PHONY: man man1 clean install uninstall
.DEFAULT_GOAL := man
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Install 경로와 man-page 목록
1-20이 GPL-2.0-only Makefile은 bpftool Documentation Makefile을 바탕으로 한다. `INSTALL`, `RM`, `RMDIR`은 각각 install, file 제거, 비어 있지 않으면 실패하지 않는 directory 제거 command를 기본값으로 둔다.
기본 prefix는 `/usr/share`, man directory는 `$(PREFIX)/man`, section 1 directory는 `$(MANDIR)/man1`이다. `MAN1_RST`는 `rtla*.rst`를 찾고 `_DOC_MAN1`은 `.rst` suffix를 `.1`로 바꾸며 `DOC_MAN1`은 각 결과에 `$(OUTPUT)` prefix를 붙인다.
`RST2MAN_DEP`는 `rst2man` command path를 찾고 `RST2MAN_OPTS`에는 `--verbose`를 더한다. `TEST_RST2MAN`은 version command가 실패하면 `n`을 반환하도록 정의되어 있다.
source RST에서 output man1 file을 계산한다.
# SPDX-License-Identifier: GPL-2.0-only
# Based on bpftool's Documentation Makefile
INSTALL ?= install
RM ?= rm -f
RMDIR ?= rmdir --ignore-fail-on-non-empty
PREFIX ?= /usr/share
MANDIR ?= $(PREFIX)/man
MAN1DIR = $(MANDIR)/man1
MAN1_RST = $(wildcard rtla*.rst)
_DOC_MAN1 = $(patsubst %.rst,%.1,$(MAN1_RST))
DOC_MAN1 = $(addprefix $(OUTPUT),$(_DOC_MAN1))
RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
RST2MAN_OPTS += --verbose
TEST_RST2MAN = $(shell sh -c "rst2man --version > /dev/null 2>&1 || echo n")
rst2man 확인과 변환 rule
21-37pattern rule `$(OUTPUT)%.1: %.rst`는 RST file을 section 1 man page로 변환한다. `rst2man`을 찾지 못하면 distribution package나 docutils source에서 최신 version을 설치하라는 notice를 출력하고 build를 error로 중단한다.
dependency가 있으면 `rst2man $(RST2MAN_OPTS) $< > $@`를 실행해 첫 prerequisite인 RST를 target man page로 변환한다. redirection과 Make automatic variable 표기는 원문 그대로 보존된다.
dependency 확인 뒤 RST를 output .1 file로 변환한다.
$(OUTPUT)%.1: %.rst
ifndef RST2MAN_DEP
$(info ********************************************)
$(info ** NOTICE: rst2man not found)
$(info **)
$(info ** Consider installing the latest rst2man from your)
$(info ** distribution, e.g., 'dnf install python3-docutils' on Fedora,)
$(info ** or from source:)
$(info **)
$(info ** https://docutils.sourceforge.io/docs/dev/repository.html )
$(info **)
$(info ********************************************)
$(error NOTICE: rst2man required to generate man pages)
endif
rst2man $(RST2MAN_OPTS) $< > $@
Build, install, uninstall target
38-53`man1`은 모든 `DOC_MAN1`을 build하고 `man`은 `man1`에 의존한다. `clean`은 생성된 man page를 제거한다.
`install`은 먼저 `man`을 build하고 `$(DESTDIR)$(MAN1DIR)`을 mode 755로 만든 뒤 man page를 mode 644로 설치한다. `uninstall`은 설치된 file을 제거하고 비어 있으면 man1 directory도 제거한다.
`man`, `man1`, `clean`, `install`, `uninstall`은 `.PHONY` target이며 기본 goal은 `man`이다.
manual page lifecycle을 구성한다.
man1: $(DOC_MAN1)
man: man1
clean:
$(RM) $(DOC_MAN1)
install: man
$(INSTALL) -d -m 755 $(DESTDIR)$(MAN1DIR)
$(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(MAN1DIR)
uninstall:
$(RM) $(addprefix $(DESTDIR)$(MAN1DIR)/,$(_DOC_MAN1))
$(RMDIR) $(DESTDIR)$(MAN1DIR)
.PHONY: man man1 clean install uninstall
.DEFAULT_GOAL := man
요약·해설
Makefile:1-53RTLA RST 문서를 rst2man으로 section 1 man page로 만들고 설치·제거하는 Makefile의 변수와 target을 설명합니다.