Convert Makefile content to Apache Ant

2019-09-16 05:36发布

What would be the syntax in 'build.xml' of an Ant build system that corresponds to the following content of a Makefile (GNU Make):

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

标签: makefile ant
1条回答
劫难
2楼-- · 2019-09-16 05:48

Example

$ 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>
查看更多
登录 后发表回答