gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Makefile Help

#138443 - Kiz - Fri Aug 24, 2007 5:28 am

Hi guys,

I've been reading some example code, and now I'm looking to try and port some of my OpenGL work to my DS (just for the sake of it). However, instead of editing my existing makefile and butchering the hell out of it with all the various devkitPro stuff that I've got no clue about, I figured I'd just build a new one around one of the example makefiles.

The thing is, I'm not that great with the advanced side of makefiles, so I got a bit lost trying to follow the logic in one of the example makefiles (eg: the one found at http://devkitpro.cvs.sourceforge.net/devkitpro/examples/nds/Graphics/3D/nehe/lesson05/ ). From what I can gather reading through it, it ignores .h files that are in the source directory. What exactly would I need to change so that it would recompile a respective .o file if the .h file has changed?

I *think* that I'd just have to add something like
HFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.h))) at line 71, then change the export OFILES (line 86) to also include $(HFILES:.h=.o)

Am I on the right track?

Also, the export VPATH (line 62) line makes it compile all source in subdirectories (and their subdirectories etc.) of the source directory, right?

Thanks in advance for the help, just trying to understand everything as well as I can before I start coding.

#138446 - wintermute - Fri Aug 24, 2007 6:29 am

Kiz wrote:
Hi guys,

The thing is, I'm not that great with the advanced side of makefiles, so I got a bit lost trying to follow the logic in one of the example makefiles (eg: the one found at http://devkitpro.cvs.sourceforge.net/devkitpro/examples/nds/Graphics/3D/nehe/lesson05/ ). From what I can gather reading through it, it ignores .h files that are in the source directory. What exactly would I need to change so that it would recompile a respective .o file if the .h file has changed?


Absolutely nothing.

The devkitPro build system is designed to find all C/C++ files in the specified directories and link them into your project. The build rules use gcc's auto dependency generation features which parse the source files for headers and add makefile rules.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#138447 - Kiz - Fri Aug 24, 2007 7:22 am

Ah, thanks for clearing that up for me.