Author Topic: Help Using Makefiles  (Read 5247 times)

Offline laserbeak43

  • Multiple posting newcomer
  • *
  • Posts: 61
Help Using Makefiles
« on: May 12, 2009, 02:32:33 am »
Hello,
     Just installed the April 09 Nightly-Build and the latest release of MinGW and installed the GCC compiler and MinGW Make. I have a Linux project I'm participating in that uses a lot of makefiles. My job is to port this project to Windows, and a developer suggests that i use the makefiles to get everything to compile.

My question is, how do i go about doing such a thing in C::B?
I'm pretty lost on this one.
looked on the MinGW site and searched here, but didn't see much info about using makefiles. only stuff to help generate your own.
« Last Edit: May 12, 2009, 02:34:49 am by laserbeak43 »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7786
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline laserbeak43

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: Help Using Makefiles
« Reply #2 on: May 12, 2009, 03:32:15 am »
i've selected it and pointed to the makefile, but it didn't do anything. are you sure that's all i need to do?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7786
    • My Best Post
Re: Help Using Makefiles
« Reply #3 on: May 12, 2009, 03:36:56 am »
No you also need a Makefile and it needs the tasks to be named as Code::Blocks wants them to be named.
Or you can make Code::Blocks match the makefile.

What are the tasks in your makefile?
all, clean are common tasks names.

Is the makefile in the same folder as the project file?

Turn on Compiler logging to get info to help debug.

Tim S
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline laserbeak43

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: Help Using Makefiles
« Reply #4 on: May 12, 2009, 03:43:33 am »
Ok, went to Settings>Compiler and Debugger>Debugger Options>Display Debugger's Log.
Also, do i run a makefile simply by doing a build and run? or do i  have to do something else.
Oh yeah,
[source directory]
    +[my project directory]
    +[source code i'm working with]
         +[folder with my Makefile]
Quote
-------------- Build: Debug in JMax-Phoenix-windows ---------------

Using makefile: Makefile
mingw32-make.exe: *** No rule to make target `Debug'.  Stop.
Process terminated with status 2 (0 minutes, 1 seconds)
0 errors, 0 warnings
 

the debugger tab shows nothing

« Last Edit: May 12, 2009, 03:45:12 am by laserbeak43 »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7786
    • My Best Post
Re: Help Using Makefiles
« Reply #5 on: May 12, 2009, 04:05:29 am »
Fix the targets; so they match.

What are the target/tasks in your makefile?


Tim S
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline laserbeak43

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: Help Using Makefiles
« Reply #6 on: May 12, 2009, 04:50:58 am »
this is open source, so i guess i can just leave the license intact and show you the makefile. The file structure is the same as SVN so everything should match.(sorry I really don't know much about makefiles even though i have used them in the past, i find them confusing.)
Code
# 
# jMax
# Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# See file LICENSE for further informations on licensing terms.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# Based on Max/ISPW by Miller Puckette.
#
# Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
#

include ./core/Makefiles/Makefile.config

default:
+make MODE=debug BUILDDIR="~/tmp/jmax/build" DISTDIR="~/distrib/jmax/" clean clobber tar

all: core packages docs

core:
(cd core; $(MAKE) all)

packages:
(cd packages; $(MAKE) all)

docs:
(cd docs; $(MAKE) distrib)

REV = $(shell "svnversion" | sed "s/:/./")

tar: all
(cd $(DISTDIR)/.. ; tar cvzf jmax.$(shell uname -s).$(shell uname -m).r$(REV).tgz --exclude=".svn" jmax)

clean:
/bin/rm -rf $(BUILDDIR)

clobber: clean
/bin/rm -rf $(DISTDIR)

test:
echo No test implemented yet

tags:
(find . \! \( -name '*~' \) \( -name "*.c" -o -name "*.h" -o -name "*.java" -o -name "Makefile.*" -o -name "Makefile" -o -name "*.tcl" \) -print | etags - )


tags-test:
find . \! \( -name '*~' \) \( -name "*.c" -o -name "*.h" -o -name "*.java" -o -name "Makefile.*" -o -name "Makefile" -o -name "*.tcl" \) -print

.PHONY: tags
.PHONY: tar
.PHONY: all
.PHONY: core
.PHONY: docs
.PHONY: packages
.PHONY: clean
.PHONY: clobber


Offline stahta01

  • Lives here!
  • ****
  • Posts: 7786
    • My Best Post
Re: Help Using Makefiles
« Reply #7 on: May 12, 2009, 05:05:07 am »
The target "all" exists in makefile will use that

"Project" -> "Properties"
Tab "Build Targets"

Select the best target for building; I normally use "release"
Click on "rename" change the name to makefile target name of "all".

Note: I usually delete all the targets but the one I renamed to "all".
But, I have never used this for a medium or larger project.

Then try to build it again.

Tim S
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org