ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reeves, Paul C" <>
Subject directory problems with exec
Date Thu, 24 Jun 2004 19:18:56 GMT

SYNOPSIS:  I call make via exec, but it thinks it is running from the
basedir, rather than from the dir specification.

My project involves compiling a core library written in C++.  Rather than
try to rework everything with ant-contrib's CC command, I am trying to
execute the library's makefile using exec.  I am running on unix (sun
solaris).  I have a stubborn problem involving where the makefile believes
it is being executed from.

Here are some code snippets:

[ANT CALLING CODE]vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

<exec executable = "make" 
      dir            = "${}" 
      newenvironment = "false"
      errorproperty  = ""
      resultproperty = "">
  <arg value="${proj.custom_target}"/>
  <arg value="${proj.custom_mode}"/>

It is pretty straight forward and in my case ${} =
SNL_Tool_Root/PGL.  This is where the makefile is located.  

The critical piece of make code is

[MAKEFILE CODE]vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
PROG_DIR	=`basename ${PWD}`

This is a simple unix command that strips the leading directory leaving only
the final directory name.


I run ant from from the directory SNL_Tool_Root (=basedir), and I am
executing a makefile one directory down in SNL_Tool_Root/PGL, which is what
dir is set to in the ant exec task call.

Everything seems fine:  the makefile executes, compiles, links.  However
when PROG_DIR is finally used within the makefile it is wrong.  Rather than
indicating the directory indicated by dir (SNL_Tool_Root/PGL - where the
makefile is located and apparently running from), it is actually the
directory where ant is running (SNL_Tool_Root - basedir, one directory up).

It seems really odd that the makefile is being found via the dir parameter,
but that the makefile believes it is executing one directory up.

Any ideas?  (I would prefer not to execute "cd" commands prior to

Paul C. Reeves, PhD

Sandia National Laboratories
Department 5533:  
  Next Generation Monitoring Systems

Mailing Address:
Paul C. Reeves
Sandia National Laboratories
P.O. Box 5800
Albuquerque, NM 87185-0451
(505) 844-4918
(505) 284-6231 FAX

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message