1 - Start Code::Blocks and click "creat a new project".
2 - Select "Empty project".
3 - Set "Project title:" - for example, "BasiliskII".
4 - Set "Folder to creat project in:" - use the browse button to navigate to where the PSP project makefile is. For example, "/home/jlfenton/projects/psp/BasiliskII-1.0/src/PSP".
5 - Edit "Resulting filename:" - Code::Blocks wants to put the project file into a subdirectory with the same name as the project title. Delete the subdirectory for the filename so that the project file is created in the same directory as the makefile. For example, change "/home/jlfenton/projects/psp/BasiliskII-1.0/src/PSP/BasiliskII/BasiliskII.cbp" to "/home/jlfenton/projects/psp/BasiliskII-1.0/src/PSP/BasiliskII.cbp".
That step is important! When using a custom makefile, Code::Blocks sets the working directory to the path to the project file, not the makefile! It won't be able to find the makefile if you don't make the project file in the same directory as the makefile.
6 - Click "Next", then click "Finish". The options on the dialog with the finish button don't matter because we're using a custom makefile.
You should now see the Project under workspace on the left in the Management panel.
7 - Right click the project and select "Properties...".
8 - Click "This is a custom Makefile" and set the "Makefile:" field to the name of the PSP makefile.
9 - Click "OK". Nothing else matters, including the EnvVars options - Code::Blocks doesn't seem to set the environment variables with custom makefiles, so don't even bother trying to set them in Code::Blocks' settings.
10 - Right click the project and select "Build options...".
11 - Go to the ""Make" commands" tab. If the fields are disabled, you forgot to click the check box in step 8 for a custom makefile. Go do that.
12 - Delete "$target" from all the fields... there is no target here. We're keeping it as simple as possible.
13 - Now we add in the environment variables that we couldn't add in the Code::Blocks settings. Do this by pasting the following in front of "$make" in each of the fields.
Code: Select all
export PSPDEV="/usr/local/pspdev" && export PSPSDK="$PSPDEV/psp/sdk" && export PSPPATH="$PSPDEV/bin:$PSPDEV/psp/bin:$PSPSDK/bin" && export PATH="$PATH:$PSPPATH" && export PKG_CONFIG_PATH="$PSPDEV/psp/lib/pkgconfig" &&
15 - Right click the project and select "Add files..." or "Add files recursively" to add the various code files to the project. You could actually build the project without this step, but it's hard to edit the files if they aren't added to the project. :)
You're done! Just click build. Note that while EVERYTHING is handled by the makefile (set paths for includes and libs and such in the makefile), Code::Blocks does pick up the error messages allowing you to easily go to the bad line to edit it (as long as the file is part of the project). Just use a standard PSPSDK makefile for your project.
Note that while it looks like a lot of steps, that's because I separated out every single action into its own step. You're really only doing TWO THINGS - setting the project to use a custom makefile, and setting the make command lines.