Author Topic: Build a project with a user-maintained makefile  (Read 12765 times)

spowers

  • Community Member
  • Posts: 46
  • Hero Points: 0
Build a project with a user-maintained makefile
« on: November 13, 2007, 02:40:48 pm »
I see the option to build a project with a user-maintained makefile but I cannot find where to specify which makefile to use and how to specify a command to build using a makefile.

Can someone help me out with step-by-step instructions for adding and building a project using a makefile??

spowers

  • Community Member
  • Posts: 46
  • Hero Points: 0
Re: Build a project with a user-maintained makefile
« Reply #1 on: November 13, 2007, 03:55:28 pm »
I've tried using "make makefile" in the command line of the Build command but it responds with:


'make' is not recognized as an internal or external command,
operable program or batch file.

I have both MinGW and Cygwin installed but I am directing to the MinGW GCC compiler

MartyL

  • Senior Community Member
  • Posts: 161
  • Hero Points: 27
  • Synergex Software Engineer
Re: Build a project with a user-maintained makefile
« Reply #2 on: November 13, 2007, 04:24:22 pm »
If you have your own makefile, the easiest thing to do would be to change your build command to use it.

Make sure you change the "Run from dir" in Project Properties > Tools to point to the directory with your makefile. Change the "Command line" to be "make" (add parameters as needed) and make sure to uncheck "Command is Slick-C macro".

Hope this helps!

spowers

  • Community Member
  • Posts: 46
  • Hero Points: 0
Re: Build a project with a user-maintained makefile
« Reply #3 on: November 13, 2007, 04:47:28 pm »
I think I fixed it... I had to set the windows path variable to my minGW installation directory.

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: Build a project with a user-maintained makefile
« Reply #4 on: November 13, 2007, 09:48:41 pm »
For your reference, the way I do this is to click the Advanced button (on the build/rebuild setup dialog) and enter a new environment variable along these lines:

Code: [Select]
Set PATH=/opt/ppctools/tools/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin
SE sets that when it starts up the shell, so make can be found. The reason I do this instead of using the Windows path is because... well, have you seen the Windows path? About 6 trillion lines long and full of dupes and pointing to tons of stuff that isn't relevant to Cygwin. Compiling something like a kernel would just fail because there was no environment space left.


jbhurst

  • Senior Community Member
  • Posts: 405
  • Hero Points: 33
Re: Build a project with a user-maintained makefile
« Reply #5 on: November 13, 2007, 09:57:20 pm »
@Dunkers:

Do any "Windows" (i.e. Windows GUI) programs actually use the PATH variable?

I tend to delete most of the entries in PATH on Windows, and leave it set up just for command-line stuff. The GUI programs seem to work, I guess by virtue of their shortcuts starting them in their own directories.

Then in my Cygwin .bash_profile I append (or prepend) any necessary Cygwin/bash-specific stuff.

Regards

John Hurst
Wellington, New Zealand

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: Build a project with a user-maintained makefile
« Reply #6 on: November 14, 2007, 12:17:25 am »
Hard to tell. Any that GUI app that load up DLLs or similar probably do, but since we're talking the application director or /windows and /windows/system32 a very short path normally covers an awful lot. Periodically I prune the path to something decent and next time I look there's a new lot rubbish. I think it breeds! Either way, there's not much of a need for having a Windows path in Cygwin at all for compiling.

I also set the .bash_profile but there's an added complication in that I use a cross compiler for this project. Technically I could leave that on the bash path but if I've gone to the hassle of trimming all the Windows stuff out I don't see the point of not doing the same for Cygwin :)

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Build a project with a user-maintained makefile
« Reply #7 on: November 14, 2007, 01:18:47 am »
cygwin itself needs a few system DLLs in system32 to run. Hence I (re-)set the win path to 'windir;windir/system32' and let bash do the rest using .bashrc/.bash_profile incl. setting up the cross toolchain env. HS2

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: Build a project with a user-maintained makefile
« Reply #8 on: November 14, 2007, 10:37:59 am »
The path Cygwin needs to run itself is different, and separate, to the path a Cygwin app needs for Cygwin to run it.

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Build a project with a user-maintained makefile
« Reply #9 on: November 14, 2007, 10:55:35 am »
Right. This is what I'm simply using:
Quote
@set PATH=<percent>windir<percent>\system32;<percent>windir<percent>&&<cygwin prefix>\bin\bash.exe -i -c <percent>*
to launch cygwin commands.
(There was a requirement to be able to start other (win) tools as well. Hence the cygwin paths are appended to the PATH given.)
HS2

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: Build a project with a user-maintained makefile
« Reply #10 on: November 14, 2007, 11:50:04 am »
That's interesting, hs2. What does the && do? I can feel a useful learning experience coming on :)


hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Build a project with a user-maintained makefile
« Reply #11 on: November 14, 2007, 12:07:25 pm »
In fact im using a 'bashcmd.cmd' batch script containing this single line e.g. as build tool command in SE.
In the example 'A && B' the '&&' operator means 'do B if A didn't set ERRORLEVEL to != 0'.
In this case it's just a method to do mult. things in one script line b/c SET doesn't set ERRORLEVEL.
HS2

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: Build a project with a user-maintained makefile
« Reply #12 on: November 14, 2007, 02:05:19 pm »
Ah, OK.

spowers

  • Community Member
  • Posts: 46
  • Hero Points: 0
Re: Build a project with a user-maintained makefile
« Reply #13 on: November 26, 2007, 03:58:33 pm »
I got this to the point where it will run a bash command from SE.

The problem I'm having now is directing it towards the ./configure command.

the configure file is not located under the msys directory so I'm not sure how to navigate to it through the bash shell


Any ideas?

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Build a project with a user-maintained makefile
« Reply #14 on: November 26, 2007, 04:27:27 pm »
Seems that msys is quite similar to a cygwin shell (I think).
Try the 'mount'/'pwd' commands to check your location and the mapping of the Windows paths (maybe adjust '/etc/fstab') to retrieve and 'cd' to the right (bash) path to your project directory. After that you should be able to run './configure' etc.
Good luck,
HS2