2017-03-15 2 views
0

나는 premake 잠시 동안 사용되었습니다. 내가 상을 구축 관련이없는 것 같다 작은 스크립트 또는 무언가 (예를 들어, 디버그, 포장 등 외부 라이브러리 구축을 ...) 실행해야 할 때, 난 그냥 premake로 가짜 타겟을 생성하는 방법은 무엇입니까?

-- [[ X. External Makefile libraries ]] 
project "external" 
    kind "Makefile" 
    location "build" 

    buildcommands { 
     "cd ..; make -f Makefile" 
    } 

    cleancommands { 
     "cd ..; make -f Makefile clean" 
    } 

-- [[ X+1. Integration ]] 
project "integration" 
    kind "Makefile" 
    location "build" 

    buildcommands { 
     -- PacketNgin Application Library 
     "ar x ../libc.a", 
     "ar x ../libm.a", 
     "ar x ../libtlsf.a", 
     "ar x ../libcore.a", 
     "ar x ../libexpat.a", 
     "ar rcs ../libpacketngin.a *.o", 

    "cp -rL ../core/include/* ../../include", 
    "cp -rL ../expat/include/* ../../include", 
    "cp -rL ../openssl/include/* ../../include", 
    "cp -rL ../zlib/*.h ../../include", 

     "rm ./*.o -rf", 

     -- Linux Application library 
     "ar x ../libtlsf.a ",  -- Blank is added at the end on purpose 
     "ar x ../libcore_linux.a", 
     "ar rcs ../libumpn.a *.o", 
     "rm ./*.o -rf ",   -- Blank is added at the end on purpose 
    } 

    cleancommands { 
     "rm *.o -rf", 
     "rm ../*.a -rf" 
    } 

아래 내가 좋아하는 위해 메이크 프로젝트를 사용 이 연습은 실제 빌드 메이크 파일을 가짜 타겟과 분리하지 않고 심지어 빌드에 필요한 불필요한 Makefile을 만들지 않으므로이 방법이 매우 혼란 스럽다는 것을 깨달으십시오. 그래서, 나는 premake에 의한 가짜 표적 생성을 알아 내고 싶습니다.

나는 newaction 구문을 고려했지만 Makefile 타겟보다는 오히려 premake 스크립트를위한 타겟을 만들었다.

premake를 사용하여 가짜 목표를 생성하는 모범 사례가 있습니까?

답변

0

임의의 가짜 타겟을 만드는 것은 현재로서는 (사용자가 submit a feature request 일 수도 있고 create a pull request 일 수도 있지만) 현재 Premake에서 지원하지 않습니다.

그러나 은 명령을 실행하기 위해 Premake 자체를 사용할 수 있습니다. 다음은 "통합"이라는 새로운 액션 생성하는 간단한 예제 : 일단 프로젝트 스크립트에 추가

function executeAll(commands) 
    for _, command in ipairs(commands) do 
     os.execute(command) 
    end 
end 

newaction 
{ 
    trigger = "integrate", 
    description = "Run integration steps", 
    execute = function() 
     executeAll { 
      "ar x ../libc.a", 
      "ar x ../libm.a", 
      "ar x ../libtlsf.a", 
      "ar x ../libcore.a", 
      "ar x ../libexpat.a", 
      "ar rcs ../libpacketngin.a *.o", 
      -- and so on... 
     } 
    end 
} 

는, 당신은 그것을 좋아 호출 할 수 있습니다 :

$ premake5 integrate