Author Topic: Autogenerated makefile, can I control the LINK output path?  (Read 2066 times)

emerth

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Autogenerated makefile, can I control the LINK output path?
« on: October 10, 2018, 11:24:39 PM »
Hello all, thanks for looking at this question. I've run into a quirk when running Windows Slickedit to do a project targeting Linux.

My Question:
How can I make Windows Slickedit Pro 2015 use $OUTDIR and $OUTFILE in the output file name in the LINK line in an auto-generated & auto-maintained makefile instead of an absolute MS style path?

My Situation:
- project is C++ code, Linux executable, GCC toolchain.
- project is using an auto-generated, auto-maintained makefile.
- I am running Slickedit Pro 2015 on Windows 10, saving files on a mapped drive served out by a Linux host via SAMBA.
- I am running GNU make (thus g++, gnu linker, etc) in a Putty session logged into the Linux host.

The problem:
- on the Linux host, when make invokes the linker it errors on invalid path to the link target because Slickedit Pro 2015 is using an absolute MS style path for the output file in the LINK line in the makefile.

Example, from the makefile, Debug target:

Quote
OUTFILE=daemon2.exe
OUTDIR=Debug
...
LINK=g++  -g -o "H:/programming/my-nifty-project/Debug/daemon2.exe" $(ALL_OBJ)

This fails because the GNU linker on Linux does not understand "H:/programming/my-nifty-project/Debug/daemon2.exe":

Quote
my-nifty-project $  make -f my-nifty-project.mak
g++  -g -o "H:/programming/my-nifty-project/Debug/daemon2.exe" Debug/config.o Debug/daemon2.o Debug/pgsql_backend.o Debug/pugixml.o
/usr/bin/ld: cannot open output file H:/programming/my-nifty-project/Debug/daemon2.exe: No such file or directory
collect2: error: ld returned 1 exit status
my-nifty-project.mak:81: recipe for target 'daemon2.exe' failed
make: *** [daemon2.exe] Error 1
 my-nifty-project $

If I manually change the LINK line to use OUTFILE and OUTDIR then everything is fine:

Quote
OUTFILE=daemon2.exe
OUTDIR=Debug
...
LINK=g++  -g -o "$(OUTDIR)/$(OUTFILE)" $(ALL_OBJ)

It is fine because when g++ is invoked as linker it now sees

Quote
g++  -g -o Debug/daemon2.exe Debug/config.o Debug/daemon2.o

Problem is that when Slickedit Pro 2015 updates the makefile it changes LINK back to containing an absolute MS filename for the output file.

Being an excellent and highly ramified editor, Slickedit Pro 2015 doubtless has a setting somewhere in a config dialog box that says to use makefile variables $OUTDIR and $OUTFILE in the LINK target, but I just can't find it.

I am not concerned that the executable has suffix ".exe".

And finally, if you've read this far, have a bunch of smiley faces  :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) because you are fantastic!
« Last Edit: October 10, 2018, 11:49:32 PM by emerth »

Dennis

  • Senior Community Member
  • Posts: 3960
  • Hero Points: 517
Re: Autogenerated makefile, can I control the LINK output path?
« Reply #1 on: October 11, 2018, 12:23:12 AM »
Go to Build > Project Properties for Debug...

Then change the "Executable name:" to Debug/daemon2 or %bd/daemon2

You may need to do the same for other configurations.  I'm am guessing that what you have there now is an absolute path.

emerth

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: Autogenerated makefile, can I control the LINK output path?
« Reply #2 on: October 11, 2018, 01:25:45 AM »
Go to Build > Project Properties for Debug...

Then change the "Executable name:" to Debug/daemon2 or %bd/daemon2

You may need to do the same for other configurations.  I'm am guessing that what you have there now is an absolute path.

Thanks Dennis!