Sign in to follow this  

DS Homebrew - Visual Studio & Makefiles

This topic is 4222 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm just starting out with DS homebrew and I'm having problems configuring my project/environment correctly. I've installed devkitPro, make etc.. and can get all the example programs built fine, as well as the tutorial projects from Chris (http://www.double.co.nz/nintendo_ds/index.html). I'm hitting a total brick wall when it comes to setting up my own however. I tried using Programmers Notepad as was suggested but I don't feel comfortable coding in that, being used to Visual Studio. I know Visual Studio has support for makefile projects but this is an area I've never had to explore - the dark magic of makefiles. Every time I try to read up on them it just depresses me.. the syntax, the complications! There must be an easier way. What do you guys recommend?

Share this post


Link to post
Share on other sites
yeah, create a new (makefile) project in VC++, then set up the "build command line" to call make. I assume the DS devkit uses some gcc variant (ie, it won't be using the VC++ compiler, just the IDE)? in which case you'll need to include the full path to make (VC++ uses nmake, probably pointless to use it tbh), and possibly use the -f flag to specify the makefile to build. Of course, having said that, someone might know an easier way....

/edit

yeah, it is using gcc. Makefiles are pretty easy, the following should get you started. Normally you get a load more stuff to link and specify via the command line, but they normally follow the same patern... (I believe nmake will work the same way, but it has some differences with the gnu make version). You should be able to get nmake to call gcc though...

(!! USE A SINGLE TAB INDENT, SPACES WILL NOT WORK !!)


#####################################################################
# a simple makefile
#####################################################################

# the highest dependency level - everything this makefile can build
all : myProg.exe

# myProg.exe depends on the compiled .o files...
#
myProg.exe : main.o someOtherFile.o
g++ -o myProg.exe main.o someOtherFile.o

# main.o will be rebuilt when main.cpp changes...
#
main.o : main.cpp
g++ -c main.cpp

# someOtherFile.o will be rebuilt when someOtherFile.cpp
# or someOtherFile.h changes...
#
someOtherFile.o : someOtherFile.cpp someOtherFile.h
g++ -c someOtherFile.cpp


##
## this is used simply to clean the project, ie you can do `make clean`
## and it will delete all temp files.
##
clean :
rm myProg.exe main.o someOtherFile.o




[Edited by - RobTheBloke on May 24, 2006 10:44:59 AM]

Share this post


Link to post
Share on other sites
Thanks for the reply and example. Would I need to add a rule for every file I add to my project, and keep the makefile updated as I add/remove them? Is there a way I can just tell the makefile to build all the cpp files in a directory? I know the idea is that you setup dependencies so that a change in one cpp doesn't require everything to be rebuilt - but to start with I really don't mind!

I guess what I'm really after is some sort of decent makefile generator that will scan my Visual Studio project and create a file with the dependencies properly setup etc. and will call my compiler of choice (gcc), ha but I'm probably just being lazy.

Share this post


Link to post
Share on other sites

This topic is 4222 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this