![basic c makefile example basic c makefile example](https://mcuoneclipse.files.wordpress.com/2017/07/new-project.png)
Wait for the compiler to finish, and a EBOOT.PBP file should appear ! Now turn on and connect your PSP, and transfer it ! The path should look like that: psp_root/PSP/GAME/MY_MAGICAL_HB/EBOOT.PBPĭeconnect USB and your HB should appear in your game list ! You can now save those two files and call make !
![basic c makefile example basic c makefile example](https://cognitivewaves.files.wordpress.com/2014/09/test-solution.png)
Basically they define the name of you Eboot file, and retrieve build infos from another file called build.mak These lines are mandatory, but you don't need to understand what they do for now. It's empty because we don't need them for this project, but you will later ! This line defines what libraries will be used by our program.
Basic c makefile example zip#
The modified Kamikaze SDK Makefile referred to in part III is also included in this zip file. Note : $(CFLAGS) is replaced by the contents of CFLAGS, $(.) can be a very useful syntax ! The example from the first part of the tutorial is in the openwrt-programming-examples/c directory and the example for the White Russian portion of the second part is in the openwrt-programming-examples/c++ directory.
![basic c makefile example basic c makefile example](https://i.ytimg.com/vi/_r7i5X0rXJk/maxresdefault.jpg)
Basic c makefile example code#
You can code without them, but I strongly advise their use, because they can be of a great help ! There are many useful flags, feel free to look into existing code and inspect Makefiles !ĬXXFLAGS are also flags, except they are used in C++ only ! Warnings are sent by the compiler when your C code may contain errors. Wall (for "all warnings") for example, is a very common flag, that enables standard warnings. They modify the behavior of your compiler. Now let's give our compiler more information: Note : don't forget to replace *.c (or *.cpp) by *.o ! I know it's weird, but not relevant for now.Įxample: if your project is composed of, say main.c, gfx.c and sound.c, your OBJS line will look like that:.This line tells psp-gcc (our compiler) which file needs to be compiled, in our case main.c. Now let's explain a little more about this strange file ! PSPSDK = $(shell psp-config -pspsdk-path) Thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0) Int CallbackThread(SceSize args, void *argp)Ĭbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL) The simplest makefile you could create would look something like: Makefile 1 hellomake: hellomake.c hellofunc.c gcc -o hellomake hellomake.c hellofunc.c -I. Int exit_callback(int arg1, int arg2, void *common) For all the compile options we can use cl and for all the linker options we can use link. While it may look like cl.exe is doing all the work, cl.exe does the compiling and link.exe does the linking. When we run nmake, it looks for makefile in the current directory. Let's start with a small project example (I assume you are already familiar with the code in main.c): This nmake section assumes that we have Visual C++ 2008. Assuming the Makefile does his job, what we want to be able to do is to call make (not makefile), that will compile our program according to the rules contained in the file Makefile. Basically, imagine two file in the same folder main.c, containing the source code of our homebrew and a file called Makefile.What it does, is reading a file called Makefile, that contains all necessary instructions and rules to compile your project, and execute them. Make is a powerful Unix tool allowing devs to automate the compiling/building process.