나는 다음과 같은 디렉토리 구조의 프로젝트를 가지고있다. 소스 파일이 $tests/*/*.e
이고 대상 파일이 $doc/tests/*.rst
인 것을 지정하는 makefile에 문제점이 있습니다.메이크
몇 가지 비슷한 질문을했지만 올바른 makefile 구문을 연습 할 수 없었습니다.
이 메이크
all: $(OBJECTS)
$(OBJECTS): $(SOURCES)
$(scripts)/wr_rst.py --infile $<
test1.rst
3 번 생성되고 test2,3.rst
는 무시됩니다 즉 개체의 전체 목록을 사용할 때이 문제가있어 하나의 파일 예
SOURCES = $(wildcard $(tests)/*/*.e)
OBJECTS = $(addprefix $(doc)/tests/,$(notdir $(SOURCES:.e=.rst)))
# single file trial
SRC = $(tests)/test1/test1.e
OBJ = $(doc)/tests/test1.rst
$(OBJ): $(SRC)
debugvars:
@echo SOURCES=$(SOURCES)
@echo OBJECTS=$(OBJECTS)
# define how to create any RST file from a testcase
%.rst:
$(scripts)/wr_rst.py --infile $<
# define how to create an RST file from a testcase
%.rst: %.e
$(scripts)/wr_rst.py --infile $<
.e.rst:
$(scripts)/wr_rst.py --infile $<
.SUFFIXES: .e .rst
작동합니다. $(SOURCES)
및 $(OBJECTS)
은 정확합니다. 내가 $<
이 (SOURCES)
를 반복하지 않는 것으로 의심 여기
No implicit rule found for `$tests/test3/test3.e'.
Finished prerequisites of target file `$tests/test3/test3.e'.
No need to remake target `$tests/test3/test3.e'.
Considering target file `tests/test3.rst'.
File `tests/test3.rst' does not exist.
Pruning file `$tests/test1/test1.e'.
Pruning file `$tests/test2/test2.e'.
Pruning file `$tests/test3/test3.e'.
Finished prerequisites of target file `tests/test3.rst'.
Must remake target `tests/test3.rst'.
$scripts/wr_rst.py --inile $tests/test1/test1.e
Putting child 0x00ee6420 (tests/test3.rst) PID 11720 on the chain.
Live child 0x00ee6420 (tests/test3.rst) PID 11720
Writing RST file $doc/tests/test1.rst
Reaping winning child 0x00ee6420 PID 11720
Removing child 0x00ee6420 PID 11720 from chain.
Successfully remade target file `tests/test3.rst'.
실제로''$ < '는 첫 번째 필수 조건으로 확장됩니다. (https://www.gnu.org/software/make/manual/make.html#Automatic-Variables).이 경우는'$ (테스트) .test1.test1.e'. – Beta