将 Makefile 内容转换为 Apache Ant [英] Convert Makefile content to Apache Ant

查看:42
本文介绍了将 Makefile 内容转换为 Apache Ant的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

推荐答案

示例

$ 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>

这篇关于将 Makefile 内容转换为 Apache Ant的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆