开发者

How to to execute a Makefile from a server

开发者 https://www.devze.com 2023-03-28 23:00 出处:网络
Hi I\'m completly knew to Ant files and makefiles. I have a file structure that was setup by someone else. They basically have an ant file that is executed from a Makefile. The ant file builds all the

Hi I'm completly knew to Ant files and makefiles. I have a file structure that was setup by someone else. They basically have an ant file that is executed from a Makefile. The ant file builds all the js scripts into one file and all other files related to the project.

I have a 开发者_如何学编程few questions I want to ask here before I run the script.

  1. Can I execute a Makefile from a server. I have SSH access to the server and its folders via terminal. Can I add a command to terminal that will execute the Makefile on the server.
  2. The makefile has 3 setup modes, the ones I'm interested in are the first 2. Mostly the debug build.

release : $(ANT_EXE) -f $(ANT_FILE) "build release"

debug : $(ANT_EXE) -f $(ANT_FILE) "build debug"

The file name is just Makefile

  1. How would I execute the file using just the debug

Thanks


Just access your machine using SSH and execute your Makefile as if you were physically using the machine. ie:

Chapsterj@home $> ssh ssh.machine.net
  Welcome to machine.net
Chapsterj@machine.net $> make debug
  Blablabla I am a Makefile
  I am making your binary.
  (Compilation nightmare)

Reminder on Makefile rules:

  • A "make" with no arguments will execute the first rule.
  • Use "make rule" to execute a certain rule (in you case "make debug" to run the "debug" rule


Since you have SSH access to the server, and you know where the makefile and ant script file are, I recommend to use the ant task to execute your remote ant files.

For example, put the following target into your local ant build script file (build.xml in this example)

<target name="run-remote-ant-script">
    <sshexec host="chapsterj-bla.com" 
         username="chapsterj" password="your password here"
         trust="true"
         command="ant -f [path-to-your-ant-script-file/your-ant-file-name] build debug"
         failonerror="false"/>
</target>

cd to the directory that contains your local build.xml in your local machine, and run

ant run-remote-ant-script

ant will do other job for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号