Libnds and VC++ Express #2

Following on from my earlier post about setting up Visual C++ 2005 Express for Libnds, here’s a few things I missed.

First of all, in order to get the release binaries built in a “Release” folder as they are in PALib, we need to modify the makefile. Find this line in your makefile:

SOURCES := source

It should be somewhere around line 19. Beneath it, add this line:

RELEASE := Release

This defines a constant that we can refer to later.

Next, locate this line (around line 61):

export OUTPUT := $(CURDIR)/$(TARGET)

Change it to this:


This tells the compiler that we want out binaries built in the “Release” directory.

After that, locate this line (roughly line 101):

@[ -d $(CURDIR) ] || mkdir -p $(CURDIR)

Change it to this:

@[ -d $(CURDIR)/$(RELEASE) ] || mkdir -p $(CURDIR)/$(RELEASE)

This tells the compiler to create the “Release” directory if it doesn’t already exist.

Finally, find this line (around 108):

@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).arm9 $(TARGET).ds.gba

Change it to this:

@rm -fr $(BUILD) $(RELEASE)/$(TARGET).elf $(RELEASE)/$(TARGET).nds $(RELEASE)/$(TARGET).arm9 $(RELEASE)/$(TARGET).ds.gba

That’s all of the “Release” directory changes done. Next, we need to tell the compiler how to rebuild the project - we can build it without problems already, but the compiler will give up if it notices we’re trying to rebuild rather than build for the first time. To do this, locate this line (around 97):

.PHONY: $(BUILD) clean

Change it to this:

.PHONY: $(BUILD) clean rebuild

Next, find this block:

@echo clean ...
@rm -fr $(BUILD) $(RELEASE)/$(TARGET).elf $(RELEASE)/$(TARGET).nds $(RELEASE)/$(TARGET).arm9 $(RELEASE)/$(TARGET).ds.gba

The last line is one of the lines you changed earlier. Add this line after the above block:

rebuild: clean $(BUILD)

All done! To make things easier, I’m attaching a zip archive of the finished makefile to this post.

Libnds VC++ makefile