. :사용 SCons는 내가 그런 일을 할 것입니다 손에서을 noweb 입력 파일에서 문서 파일 (또는 소스 파일)을 생성 ** NW</p> <p>을, 나도 싶습니다를 noweb를 사용
notangle my_program.nw > my_program.cpp
g++ -c my_program.o my_program.cpp
ln -o myapp ... my_program.o ...
이제 나는 이것을 자동화하기 위해 scons를 사용할 수 있는지 여부를 묻습니다.
내 프로젝트 디렉토리가 $ MYPROJECT에 있다고 상상해보십시오. 우리는 "$ MYPROJECT/SConstruct"를 가지고 있습니다. 는 지금은
import SCons.Builder
def cpp_emit (target,source, env):
# I dont know what to do here ... please help
return (target,source)
# Tangle to .cpp
__noweb_tangle_builder = SCons.Builder.Builder(
action='/usr/bin/notangle $SOURCES >$TARGET',
suffix='.cpp',
src_suffix='.nw',
emitter=cpp_emit)
# -----------------------
def generate(env):
env['BUILDERS']['tangle']= __noweb_tangle_builder
def exists(env):
return 1
이 도구는 cpp-를 생성 $ MYPROJECT/site_scons/site_tools/tangle.py ""우리가 여기 (noweb.py. 에서 간체) "는 SCons는 도구"tangle.py "를 정의 . NW-파일에서
을 제기하지만
def cpp_emit (target,source, env):
new_source=target[0].name
new_target=new_source.rstrip(".cpp")+".o"
target.append(new_target)
source.append(new_source)
return (target, source)
처럼 뭔가를 할 경우 나는 종속성 원에 취득. SCons는 발견 및 오류 메시지와 함께 중단됩니다.
def cpp_emit (target,source, env):
new_source=target[0].name
# someprogram.cpp -> someprogram.o
new_target=new_source.rstrip(".cpp")+".o"
# lets avoid dependency cycle
t = []
t.append(new_target)
source.append(new_source)
# oops, we dropped target test.cpp. It wont be generated.
return (t, source)
이렇게 ... ... NW 파일에서 CPP 파일을 생성 중지 할 도구. (Cpp target dropped)
글을 읽고 프로그래밍하는 데 scons 사용법을 알고 있습니까?
읽어 주셔서 감사합니다.
레너드
안녕 브래디는 답변 주셔서 감사합니다. 에미 터를 사용하는 것은 잘못된 접근이었습니다. env.tangle ("myfile.nw")의 출력을 프로그램 (..)의 입력으로 사용하는 방법은 제가 찾던 아이디어입니다. Simple doing Program (env.tangle ("myfile.nw"))이 작업을 수행합니다. SCons를 사용하여 noweb 프로젝트를 컴파일 할 수 있습니다. 이제는 어떻게 문서를 생성하는지 알아 내려고합니다. 우리는 단 하나의 \ begin {document} ... \ end {document} 쌍을 가진 계층 적 LaTex "only"를 가지고있다. __ 안부, Leonard – Leonard7E
@ Leonard7E, 그게 듣기 좋네. 문서와 관련해서는 아마도 다른 질문 일 것입니다. – Brady