将Makefile内容转换为Apache Ant

时间:2017-04-26 11:52:39

标签: makefile ant

Ant构建系统的'build.xml'中的语法是什么 对应于Makefile(GNU Make)的以下内容:

target: dependency0 dependency1
     shell command 1  # Not java, cc or the like
     shell command 2
     shell command 3

1 个答案:

答案 0 :(得分:1)

实施例

$ ant

dependency0:
     [echo] Hello world one

dependency1:
     [echo] Hello world two

build:
     [exec] command 1
     [exec] command 2
     [exec] command 3

的build.xml

<project name="demo" default="build">

  <target name="dependency0">
    <echo>Hello world one</echo>
  </target>

  <target name="dependency1">
    <echo>Hello world two</echo>
  </target>

  <target name="build" depends="dependency0,dependency1">
    <exec executable="echo">
      <arg line="command 1"/>
    </exec>
    <exec executable="echo">
      <arg line="command 2"/>
    </exec>
    <exec executable="echo">
      <arg line="command 3"/>
    </exec>
  </target>

</project>