Hi,
my project gets bigger and bigger and I'd like to oragnize my source files in directories, like
src/chars/player/ containing c and h files related to player
src/chars/ennemy1/ containing c and h files related to one kind of ennemy
src/stages/stage11/
src/stages/stage12/
src/main.c
Will SGDK be able to find averything or have I to change something in the makefile ?
Source dir organization
Moderator: Stef
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
Re: Source dir organization
Hello!
You'll have to modify the makefile.
You'll need to add those extra foldres to the SRC_C variable.
For example, here's what I have in the PingouinRose makefile.
And then you need to create those folders for the compiler when bulding .o files from the .c files.
I think that's all you need to do. I'm not a makefile guru so there might be a better solution.
You'll have to modify the makefile.
You'll need to add those extra foldres to the SRC_C variable.
For example, here's what I have in the PingouinRose makefile.
Code: Select all
SRC_C= $(wildcard source/*.c)
SRC_C+= $(wildcard source/exported/GGAnimations/*.c)
SRC_C+= $(wildcard source/exported/maps/*.c)
SRC_C+= $(wildcard source/exported/spawns/*.c)
SRC_C+= $(wildcard source/exported/tileattributes/*.c)
SRC_C+= $(wildcard source/exported/*.c)
SRC_C+= $(wildcard source/generated/*.c)
SRC_C+= $(wildcard source/Objects/*.c)
SRC_C+= $(wildcard source/Levels/*.c)
Code: Select all
out/%.o: %.c
@$(MKDIR) -p out
@$(MKDIR) -p out/src
@$(MKDIR) -p out/res
@$(MKDIR) -p out/source/exported/
@$(MKDIR) -p out/source/exported/GGAnimations
@$(MKDIR) -p out/source/exported/maps
@$(MKDIR) -p out/source/exported/spawns
@$(MKDIR) -p out/source/exported/tileattributes
@$(MKDIR) -p out/source/generated
@$(MKDIR) -p out/source/Objects
@$(MKDIR) -p out/source/Levels
@$(CC) $(FLAGS) -c $< -o $@
Re: Source dir organization
Thanks. That doesn't seem to work. Lots of 'function' undeclared. I wonder if h files are found.
Or must I give the path in the include ?
#include "chars/player.h" ?
Or must I give the path in the include ?
#include "chars/player.h" ?
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Source dir organization
yeah you should also add your subfolder as part of include folder as well !
Re: Source dir organization
Thanks, it's okay now