├── templates
├── makefile
│ ├── library
│ │ ├── .gitignore
│ │ ├── source
│ │ │ └── templatelib.c
│ │ ├── README.md
│ │ ├── include
│ │ │ └── templatelib.h
│ │ └── Makefile
│ └── application
│ │ ├── source
│ │ └── template.c
│ │ └── Makefile
└── cmake
│ └── application
│ ├── CMakeLists.txt
│ └── source
│ └── main.c
├── .gitignore
├── devices
├── usbgecko
│ ├── gdbstub
│ │ ├── gdb.txt
│ │ ├── source
│ │ │ └── gdbstub.c
│ │ └── Makefile
│ └── Makefile
├── network
│ ├── Makefile
│ ├── sockettest
│ │ ├── source
│ │ │ └── sockettest.c
│ │ └── Makefile
│ └── udptest
│ │ ├── source
│ │ └── udptest.c
│ │ └── Makefile
├── usbkeyboard
│ ├── Makefile
│ └── basic_stdin
│ │ ├── source
│ │ └── basic_stdin.c
│ │ └── Makefile
└── wiimote
│ ├── source
│ └── wiimote.c
│ └── Makefile
├── graphics
└── gx
│ ├── neheGX
│ ├── lesson06
│ │ ├── textures
│ │ │ ├── NeHe.scf
│ │ │ └── NeHe.bmp
│ │ └── Makefile
│ ├── lesson10
│ │ ├── textures
│ │ │ ├── mud.scf
│ │ │ └── Mud.bmp
│ │ ├── data
│ │ │ └── world.txt
│ │ └── Makefile
│ ├── lesson11
│ │ └── textures
│ │ │ ├── Tim.scf
│ │ │ └── Tim.bmp
│ ├── lesson12
│ │ └── textures
│ │ │ ├── Cube.scf
│ │ │ └── Cube.bmp
│ ├── lesson07
│ │ ├── textures
│ │ │ ├── crate.scf
│ │ │ └── crate.bmp
│ │ └── Makefile
│ ├── lesson08
│ │ ├── textures
│ │ │ ├── glass.scf
│ │ │ └── Glass.bmp
│ │ └── Makefile
│ ├── lesson09
│ │ ├── textures
│ │ │ ├── startex.scf
│ │ │ └── Star.bmp
│ │ └── Makefile
│ ├── lesson19
│ │ └── textures
│ │ │ ├── Particle.scf
│ │ │ └── Particle.bmp
│ ├── lesson01
│ │ ├── source
│ │ │ └── lesson1.c
│ │ └── Makefile
│ ├── lesson02
│ │ ├── source
│ │ │ └── lesson2.c
│ │ └── Makefile
│ ├── lesson03
│ │ ├── source
│ │ │ └── lesson3.c
│ │ └── Makefile
│ ├── lesson04
│ │ ├── source
│ │ │ └── lesson4.c
│ │ └── Makefile
│ └── lesson05
│ │ └── Makefile
│ ├── gxSprites
│ └── textures
│ │ ├── textures.scf
│ │ └── ballsprites.png
│ ├── triangle
│ └── source
│ │ └── triangle.c
│ └── romfont
│ └── Makefile
├── audio
├── modplay
│ ├── data
│ │ └── technique.mod
│ ├── source
│ │ └── template.c
│ └── Makefile
├── mp3player
│ ├── data
│ │ └── sample.mp3
│ ├── source
│ │ └── template.c
│ └── Makefile
└── oggplayer
│ ├── data
│ └── sample.ogg
│ └── source
│ ├── oggplayer.c
│ ├── oggplayer.h
│ └── template.c
├── Makefile
├── filesystem
└── directory
│ ├── sd
│ ├── source
│ │ └── directory.c
│ └── Makefile
│ └── isfs
│ └── Makefile
├── crypto
└── Makefile
└── threading
└── Makefile
/templates/makefile/library/.gitignore:
--------------------------------------------------------------------------------
1 | lib
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode/
2 | build/
3 | bin/
4 | *.dol
5 | *.elf
--------------------------------------------------------------------------------
/devices/usbgecko/gdbstub/gdb.txt:
--------------------------------------------------------------------------------
1 | target remote /dev/cu.usbserial-GECKUSB0
2 |
3 |
4 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson06/textures/NeHe.scf:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson10/textures/mud.scf:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson11/textures/Tim.scf:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson12/textures/Cube.scf:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson07/textures/crate.scf:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson08/textures/glass.scf:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson09/textures/startex.scf:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson19/textures/Particle.scf:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/graphics/gx/gxSprites/textures/textures.scf:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/templates/makefile/library/source/templatelib.c:
--------------------------------------------------------------------------------
1 | int myLibFunction() {
2 |
3 | return 42;
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/templates/makefile/library/README.md:
--------------------------------------------------------------------------------
1 | # template
2 |
3 | This is a template for starting new Wii library projects.
4 |
--------------------------------------------------------------------------------
/audio/modplay/data/technique.mod:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/audio/modplay/data/technique.mod
--------------------------------------------------------------------------------
/audio/mp3player/data/sample.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/audio/mp3player/data/sample.mp3
--------------------------------------------------------------------------------
/audio/oggplayer/data/sample.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/audio/oggplayer/data/sample.ogg
--------------------------------------------------------------------------------
/audio/oggplayer/source/oggplayer.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/audio/oggplayer/source/oggplayer.c
--------------------------------------------------------------------------------
/audio/oggplayer/source/oggplayer.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/audio/oggplayer/source/oggplayer.h
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson06/textures/NeHe.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/graphics/gx/neheGX/lesson06/textures/NeHe.bmp
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson09/textures/Star.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/graphics/gx/neheGX/lesson09/textures/Star.bmp
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson10/textures/Mud.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/graphics/gx/neheGX/lesson10/textures/Mud.bmp
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson11/textures/Tim.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/graphics/gx/neheGX/lesson11/textures/Tim.bmp
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson12/textures/Cube.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/graphics/gx/neheGX/lesson12/textures/Cube.bmp
--------------------------------------------------------------------------------
/graphics/gx/gxSprites/textures/ballsprites.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/graphics/gx/gxSprites/textures/ballsprites.png
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson07/textures/crate.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/graphics/gx/neheGX/lesson07/textures/crate.bmp
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson08/textures/Glass.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/graphics/gx/neheGX/lesson08/textures/Glass.bmp
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson19/textures/Particle.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devkitPro/wii-examples/HEAD/graphics/gx/neheGX/lesson19/textures/Particle.bmp
--------------------------------------------------------------------------------
/templates/makefile/library/include/templatelib.h:
--------------------------------------------------------------------------------
1 | #ifndef _templatelib_h_
2 | #define _templatelib_h_
3 |
4 | int myLibFunction();
5 |
6 | #endif // _templatelib_h_
7 |
--------------------------------------------------------------------------------
/devices/network/Makefile:
--------------------------------------------------------------------------------
1 | SUBDIRS:= `ls | egrep -v '^(CVS)$$'`
2 |
3 | all:
4 | @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
5 |
6 | clean:
7 | @rm -f *.bz2
8 | @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
9 |
10 |
--------------------------------------------------------------------------------
/templates/cmake/application/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.13)
2 |
3 | project(application LANGUAGES C VERSION 1.0.0)
4 |
5 | add_executable(${PROJECT_NAME})
6 |
7 | target_sources(${PROJECT_NAME} PRIVATE
8 | source/main.c
9 | )
10 |
11 | target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
12 |
13 | target_include_directories(${PROJECT_NAME} PRIVATE
14 | include
15 | )
16 |
17 | ogc_create_dol(${PROJECT_NAME})
18 |
19 |
--------------------------------------------------------------------------------
/devices/usbgecko/Makefile:
--------------------------------------------------------------------------------
1 | SUBDIRS:= `ls | egrep -v '^(CVS)$$'`
2 |
3 | DATESTRING := $(shell date +%Y)$(shell date +%m)$(shell date +%d)
4 |
5 | all:
6 | @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
7 |
8 | clean:
9 | @rm -f *.bz2
10 | @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
11 |
12 | dist: clean
13 | @tar --exclude=*CVS* -cvjf wii-examples-$(DATESTRING).tar.bz2 *
14 |
--------------------------------------------------------------------------------
/devices/usbkeyboard/Makefile:
--------------------------------------------------------------------------------
1 | SUBDIRS:= `ls | egrep -v '^(CVS)$$'`
2 |
3 | DATESTRING := $(shell date +%Y)$(shell date +%m)$(shell date +%d)
4 |
5 | all:
6 | @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
7 |
8 | clean:
9 | @rm -f *.bz2
10 | @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
11 |
12 | dist: clean
13 | @tar --exclude=*CVS* -cvjf wii-examples-$(DATESTRING).tar.bz2 *
14 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | DATESTRING := $(shell date +%Y)$(shell date +%m)$(shell date +%d)
2 |
3 | MAKEFILES := $(shell find . -mindepth 2 -name Makefile)
4 |
5 | #---------------------------------------------------------------------------------
6 | all: examples
7 | #---------------------------------------------------------------------------------
8 | @rm -fr bin
9 | @mkdir -p bin
10 | @find . -name "*.dol" ! -path "./bin/*" -exec cp -fv {} bin \;
11 |
12 | #---------------------------------------------------------------------------------
13 | examples:
14 | #---------------------------------------------------------------------------------
15 | @for i in $(MAKEFILES); do $(MAKE) -C `dirname $$i` || exit 1; done;
16 |
17 | #---------------------------------------------------------------------------------
18 | clean:
19 | #---------------------------------------------------------------------------------
20 | @rm -fr bin
21 | @rm -f *.bz2
22 | @for i in $(MAKEFILES); do $(MAKE) -C `dirname $$i` clean || exit 1; done;
23 |
24 | #---------------------------------------------------------------------------------
25 | dist: clean
26 | #---------------------------------------------------------------------------------
27 | @tar -cvjf wii-examples-$(DATESTRING).tar.bz2 *
28 |
--------------------------------------------------------------------------------
/devices/usbgecko/gdbstub/source/gdbstub.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | static void *xfb = NULL;
11 | static GXRModeObj *rmode = NULL;
12 |
13 | int main() {
14 |
15 | VIDEO_Init();
16 | WPAD_Init();
17 |
18 | rmode = VIDEO_GetPreferredMode(NULL);
19 |
20 | xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
21 | console_init(xfb,20,20,rmode->fbWidth-20,rmode->xfbHeight-20,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
22 |
23 | VIDEO_Configure(rmode);
24 | VIDEO_SetNextFramebuffer(xfb);
25 | VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);
26 | VIDEO_SetBlack(false);
27 | VIDEO_Flush();
28 | VIDEO_WaitVSync();
29 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
30 |
31 | /* Configure for use with USB on EXI channel 1 (memcard slot B) */
32 | /* Other option: GDBSTUB_DEVICE_TCP. Note: second parameter acts as port for this type of device */
33 | DEBUG_Init(GDBSTUB_DEVICE_USB,1);
34 |
35 |
36 | printf("Waiting for debugger ...\n");
37 | /* This function call enters the debug stub for the first time */
38 | /* It's needed to call this if one wants to start debugging. */
39 | _break();
40 |
41 | printf("debugger connected ...\n");
42 |
43 | while(1) {
44 |
45 | VIDEO_WaitVSync();
46 | WPAD_ScanPads();
47 |
48 | int buttons = WPAD_ButtonsDown(0);
49 |
50 | if(buttons & WPAD_BUTTON_A) {
51 | printf("Button A pressed.\n");
52 | }
53 |
54 | if (buttons & WPAD_BUTTON_HOME) break;
55 | }
56 |
57 | return 0;
58 | }
59 |
--------------------------------------------------------------------------------
/templates/cmake/application/source/main.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | static void *xfb = NULL;
7 | static GXRModeObj *rmode = NULL;
8 |
9 | //---------------------------------------------------------------------------------
10 | int main(int argc, char **argv) {
11 | //---------------------------------------------------------------------------------
12 |
13 | // Initialise the video system
14 | VIDEO_Init();
15 |
16 | // This function initialises the attached controllers
17 | WPAD_Init();
18 |
19 | // Obtain the preferred video mode from the system
20 | // This will correspond to the settings in the Wii menu
21 | rmode = VIDEO_GetPreferredMode(NULL);
22 |
23 | // Allocate memory for the display in the uncached region
24 | xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
25 |
26 | // Initialise the console, required for printf
27 | console_init(xfb,20,20,rmode->fbWidth-20,rmode->xfbHeight-20,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
28 |
29 | // Set up the video registers with the chosen mode
30 | VIDEO_Configure(rmode);
31 |
32 | // Tell the video hardware where our display memory is
33 | VIDEO_SetNextFramebuffer(xfb);
34 |
35 | // Clear the framebuffer
36 | VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);
37 |
38 | // Make the display visible
39 | VIDEO_SetBlack(false);
40 |
41 | // Flush the video register changes to the hardware
42 | VIDEO_Flush();
43 |
44 | // Wait for Video setup to complete
45 | VIDEO_WaitVSync();
46 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
47 |
48 |
49 | // The console understands VT terminal escape codes
50 | // This positions the cursor on row 2, column 0
51 | // we can use variables for this with format codes too
52 | // e.g. printf ("\x1b[%d;%dH", row, column );
53 | printf("\x1b[2;0H");
54 |
55 |
56 | printf("Hello World!");
57 |
58 | while(1) {
59 |
60 | // Call WPAD_ScanPads each loop, this reads the latest controller states
61 | WPAD_ScanPads();
62 |
63 | // WPAD_ButtonsDown tells us which buttons were pressed in this loop
64 | // this is a "one shot" state which will not fire again until the button has been released
65 | u32 pressed = WPAD_ButtonsDown(0);
66 |
67 | // We return to the launcher application via exit
68 | if ( pressed & WPAD_BUTTON_HOME ) exit(0);
69 |
70 | // Wait for the next frame
71 | VIDEO_WaitVSync();
72 | }
73 |
74 | return 0;
75 | }
76 |
--------------------------------------------------------------------------------
/templates/makefile/application/source/template.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | static void *xfb = NULL;
7 | static GXRModeObj *rmode = NULL;
8 |
9 | //---------------------------------------------------------------------------------
10 | int main(int argc, char **argv) {
11 | //---------------------------------------------------------------------------------
12 |
13 | // Initialise the video system
14 | VIDEO_Init();
15 |
16 | // This function initialises the attached controllers
17 | WPAD_Init();
18 |
19 | // Obtain the preferred video mode from the system
20 | // This will correspond to the settings in the Wii menu
21 | rmode = VIDEO_GetPreferredMode(NULL);
22 |
23 | // Allocate memory for the display in the uncached region
24 | xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
25 |
26 | // Initialise the console, required for printf
27 | console_init(xfb,20,20,rmode->fbWidth-20,rmode->xfbHeight-20,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
28 | //SYS_STDIO_Report(true);
29 |
30 | // Set up the video registers with the chosen mode
31 | VIDEO_Configure(rmode);
32 |
33 | // Tell the video hardware where our display memory is
34 | VIDEO_SetNextFramebuffer(xfb);
35 |
36 | // Clear the framebuffer
37 | VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);
38 |
39 | // Make the display visible
40 | VIDEO_SetBlack(false);
41 |
42 | // Flush the video register changes to the hardware
43 | VIDEO_Flush();
44 |
45 | // Wait for Video setup to complete
46 | VIDEO_WaitVSync();
47 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
48 |
49 |
50 | // The console understands VT terminal escape codes
51 | // This positions the cursor on row 2, column 0
52 | // we can use variables for this with format codes too
53 | // e.g. printf ("\x1b[%d;%dH", row, column );
54 | printf("\x1b[2;0H");
55 |
56 |
57 | printf("Hello World!\n");
58 |
59 | while(1) {
60 |
61 | // Call WPAD_ScanPads each loop, this reads the latest controller states
62 | WPAD_ScanPads();
63 |
64 | // WPAD_ButtonsDown tells us which buttons were pressed in this loop
65 | // this is a "one shot" state which will not fire again until the button has been released
66 | u32 pressed = WPAD_ButtonsDown(0);
67 |
68 | // We return to the launcher application via exit
69 | if ( pressed & WPAD_BUTTON_HOME ) exit(0);
70 |
71 | // Wait for the next frame
72 | VIDEO_WaitVSync();
73 | }
74 |
75 | return 0;
76 | }
77 |
--------------------------------------------------------------------------------
/audio/mp3player/source/template.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | // include generated header
9 | #include "sample_mp3.h"
10 |
11 | static void *xfb = NULL;
12 | static GXRModeObj *rmode = NULL;
13 |
14 | //---------------------------------------------------------------------------------
15 | int main(int argc, char **argv) {
16 | //---------------------------------------------------------------------------------
17 |
18 | // Initialise the video system
19 | VIDEO_Init();
20 |
21 | // Initialise the attached controllers
22 | WPAD_Init();
23 |
24 | // Initialise the audio subsystem
25 | ASND_Init();
26 | MP3Player_Init();
27 |
28 | // Obtain the preferred video mode from the system
29 | // This will correspond to the settings in the Wii menu
30 | rmode = VIDEO_GetPreferredMode(NULL);
31 |
32 | // Allocate memory for the display in the uncached region
33 | xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
34 |
35 | // Initialise the console, required for printf
36 | console_init(xfb,20,20,rmode->fbWidth-20,rmode->xfbHeight-20,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
37 |
38 | // Set up the video registers with the chosen mode
39 | VIDEO_Configure(rmode);
40 |
41 | // Tell the video hardware where our display memory is
42 | VIDEO_SetNextFramebuffer(xfb);
43 |
44 | // Clear the framebuffer
45 | VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);
46 |
47 | // Make the display visible
48 | VIDEO_SetBlack(false);
49 |
50 | // Flush the video register changes to the hardware
51 | VIDEO_Flush();
52 |
53 | // Wait for Video setup to complete
54 | VIDEO_WaitVSync();
55 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
56 |
57 |
58 | // The console understands VT terminal escape codes
59 | // This positions the cursor on row 2, column 0
60 | // we can use variables for this with format codes too
61 | // e.g. printf ("\x1b[%d;%dH", row, column );
62 | printf("\x1b[2;0H");
63 |
64 | printf("Playing sample MP3 file...Press HOME to exit.\n");
65 |
66 | MP3Player_PlayBuffer(sample_mp3, sample_mp3_size, NULL);
67 |
68 | while(1) {
69 |
70 | // Call WPAD_ScanPads each loop, this reads the latest controller states
71 | WPAD_ScanPads();
72 |
73 | // WPAD_ButtonsDown tells us which buttons were pressed in this loop
74 | // this is a "one shot" state which will not fire again until the button has been released
75 | u32 pressed = WPAD_ButtonsDown(0);
76 |
77 | // We return to the launcher application via exit
78 | if ( pressed & WPAD_BUTTON_HOME ) exit(0);
79 |
80 | // Wait for the next frame
81 | VIDEO_WaitVSync();
82 | }
83 |
84 | return 0;
85 | }
86 |
--------------------------------------------------------------------------------
/audio/modplay/source/template.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | // include generated header
9 | #include "technique_mod.h"
10 |
11 | static void *xfb = NULL;
12 | static GXRModeObj *rmode = NULL;
13 | static MODPlay play;
14 |
15 | //---------------------------------------------------------------------------------
16 | int main(int argc, char **argv) {
17 | //---------------------------------------------------------------------------------
18 |
19 | // Initialise the video system
20 | VIDEO_Init();
21 |
22 | // Initialise the attached controllers
23 | WPAD_Init();
24 |
25 | // Initialise the audio subsystem
26 | AESND_Init();
27 |
28 | // Obtain the preferred video mode from the system
29 | // This will correspond to the settings in the Wii menu
30 | rmode = VIDEO_GetPreferredMode(NULL);
31 |
32 | // Allocate memory for the display in the uncached region
33 | xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
34 |
35 | // Initialise the console, required for printf
36 | console_init(xfb,20,20,rmode->fbWidth-20,rmode->xfbHeight-20,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
37 |
38 | // Set up the video registers with the chosen mode
39 | VIDEO_Configure(rmode);
40 |
41 | // Tell the video hardware where our display memory is
42 | VIDEO_SetNextFramebuffer(xfb);
43 |
44 | // Clear the framebuffer
45 | VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);
46 |
47 | // Make the display visible
48 | VIDEO_SetBlack(false);
49 |
50 | // Flush the video register changes to the hardware
51 | VIDEO_Flush();
52 |
53 | // Wait for Video setup to complete
54 | VIDEO_WaitVSync();
55 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
56 |
57 |
58 | // The console understands VT terminal escape codes
59 | // This positions the cursor on row 2, column 0
60 | // we can use variables for this with format codes too
61 | // e.g. printf ("\x1b[%d;%dH", row, column );
62 | printf("\x1b[2;0H");
63 |
64 |
65 | printf("Hello World!");
66 |
67 | MODPlay_Init(&play);
68 | MODPlay_SetMOD(&play,technique_mod);
69 | MODPlay_SetVolume(&play,63,63);
70 | MODPlay_Start(&play);
71 |
72 | while(1) {
73 |
74 | // Call WPAD_ScanPads each loop, this reads the latest controller states
75 | WPAD_ScanPads();
76 |
77 | // WPAD_ButtonsDown tells us which buttons were pressed in this loop
78 | // this is a "one shot" state which will not fire again until the button has been released
79 | u32 pressed = WPAD_ButtonsDown(0);
80 |
81 | // We return to the launcher application via exit
82 | if ( pressed & WPAD_BUTTON_HOME ) exit(0);
83 |
84 | // Wait for the next frame
85 | VIDEO_WaitVSync();
86 | }
87 |
88 | return 0;
89 | }
90 |
--------------------------------------------------------------------------------
/audio/oggplayer/source/template.c:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * OGG Playback example
3 | * Tantric 2009
4 | ***************************************************************************/
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | #include "oggplayer.h"
13 |
14 | // include generated header
15 | #include "sample_ogg.h"
16 |
17 | static void *xfb = NULL;
18 | static GXRModeObj *rmode = NULL;
19 |
20 | //---------------------------------------------------------------------------------
21 | int main(int argc, char **argv) {
22 | //---------------------------------------------------------------------------------
23 |
24 | // Initialise the video system
25 | VIDEO_Init();
26 |
27 | // Initialise the attached controllers
28 | WPAD_Init();
29 |
30 | // Initialise the audio subsystem
31 | ASND_Init();
32 |
33 | // Obtain the preferred video mode from the system
34 | // This will correspond to the settings in the Wii menu
35 | rmode = VIDEO_GetPreferredMode(NULL);
36 |
37 | // Allocate memory for the display in the uncached region
38 | xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
39 |
40 | // Initialise the console, required for printf
41 | console_init(xfb,20,20,rmode->fbWidth-20,rmode->xfbHeight-20,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
42 |
43 | // Set up the video registers with the chosen mode
44 | VIDEO_Configure(rmode);
45 |
46 | // Tell the video hardware where our display memory is
47 | VIDEO_SetNextFramebuffer(xfb);
48 |
49 | // Clear the framebuffer
50 | VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);
51 |
52 | // Make the display visible
53 | VIDEO_SetBlack(false);
54 |
55 | // Flush the video register changes to the hardware
56 | VIDEO_Flush();
57 |
58 | // Wait for Video setup to complete
59 | VIDEO_WaitVSync();
60 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
61 |
62 |
63 | // The console understands VT terminal escape codes
64 | // This positions the cursor on row 2, column 0
65 | // we can use variables for this with format codes too
66 | // e.g. printf ("\x1b[%d;%dH", row, column );
67 | printf("\x1b[2;0H");
68 |
69 | printf("Playing sample OGG file...Press HOME to exit.\n");
70 |
71 | PlayOgg(sample_ogg, sample_ogg_size, 0, OGG_ONE_TIME);
72 |
73 | while(1) {
74 |
75 | // Call WPAD_ScanPads each loop, this reads the latest controller states
76 | WPAD_ScanPads();
77 |
78 | // WPAD_ButtonsDown tells us which buttons were pressed in this loop
79 | // this is a "one shot" state which will not fire again until the button has been released
80 | u32 pressed = WPAD_ButtonsDown(0);
81 |
82 | // We return to the launcher application via exit
83 | if ( pressed & WPAD_BUTTON_HOME ) break;
84 |
85 | // Wait for the next frame
86 | VIDEO_WaitVSync();
87 | }
88 | StopOgg();
89 | return 0;
90 | }
91 |
--------------------------------------------------------------------------------
/devices/usbkeyboard/basic_stdin/source/basic_stdin.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | static void *xfb = NULL;
11 | static GXRModeObj *rmode = NULL;
12 |
13 | bool quitapp = false;
14 |
15 | void keyPress_cb(char sym)
16 | {
17 | // Check for escape key to exit
18 | if (sym == 0x1b)
19 | quitapp = true;
20 | }
21 |
22 | int main(int argc, char **argv)
23 | {
24 | // Initialise the video system
25 | VIDEO_Init();
26 |
27 | // This function initialises the attached controllers
28 | WPAD_Init();
29 |
30 | // Obtain the preferred video mode from the system
31 | // This will correspond to the settings in the Wii menu
32 | rmode = VIDEO_GetPreferredMode(NULL);
33 |
34 | // Allocate memory for the display in the uncached region
35 | xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
36 |
37 | // Initialise the console, required for printf
38 | console_init(xfb, 20, 20, rmode->fbWidth-20, rmode->xfbHeight-20,
39 | rmode->fbWidth * VI_DISPLAY_PIX_SZ);
40 |
41 | // Set up the video registers with the chosen mode
42 | VIDEO_Configure(rmode);
43 |
44 | // Tell the video hardware where our display memory is
45 | VIDEO_SetNextFramebuffer(xfb);
46 |
47 | // Clear the framebuffer
48 | VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);
49 |
50 | // Make the display visible
51 | VIDEO_SetBlack(false);
52 |
53 | // Flush the video register changes to the hardware
54 | VIDEO_Flush();
55 |
56 | // Wait for Video setup to complete
57 | VIDEO_WaitVSync();
58 | if (rmode->viTVMode & VI_NON_INTERLACE)
59 | VIDEO_WaitVSync();
60 |
61 | // The console understands VT terminal escape codes
62 | // This positions the cursor on row 2, column 0
63 | // we can use variables for this with format codes too
64 | // e.g. printf ("\x1b[%d;%dH", row, column );
65 | printf("\x1b[2;0HHello World!\n");
66 | if (KEYBOARD_Init(keyPress_cb) == 0)
67 | printf("keyboard initialised\n");
68 |
69 | do
70 | {
71 | // Call WPAD_ScanPads each loop, this reads the latest controller states
72 | WPAD_ScanPads();
73 |
74 | // WPAD_ButtonsDown tells us which buttons were pressed in this loop
75 | // this is a "one shot" state which will not fire again until the button
76 | // has been released
77 | u32 pressed = WPAD_ButtonsDown(0);
78 |
79 | // Check for keyboard input
80 | int key;
81 |
82 | if ((key = getchar()) != EOF)
83 | {
84 | // Display the pressed character
85 | // Print readable characters (ASCII > 31)
86 | if (key > 31)
87 | putchar(key);
88 | // Convert Enter key (ASCII 13) to a newline
89 | else if(key == 13)
90 | putchar('\n');
91 | }
92 |
93 | // We return to the launcher application via exit
94 | if (pressed & WPAD_BUTTON_HOME)
95 | quitapp = true;
96 |
97 | // Wait for the next frame
98 | VIDEO_WaitVSync();
99 | } while (!quitapp);
100 |
101 | return 0;
102 | }
103 |
--------------------------------------------------------------------------------
/filesystem/directory/sd/source/directory.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | static void *xfb = NULL;
15 | static GXRModeObj *rmode = NULL;
16 |
17 | //---------------------------------------------------------------------------------
18 | int main(int argc, char **argv) {
19 | //---------------------------------------------------------------------------------
20 |
21 | // Initialise the video system
22 | VIDEO_Init();
23 |
24 | // This function initialises the attached controllers
25 | WPAD_Init();
26 |
27 | // Obtain the preferred video mode from the system
28 | // This will correspond to the settings in the Wii menu
29 | rmode = VIDEO_GetPreferredMode(NULL);
30 |
31 | // Allocate memory for the display in the uncached region
32 | xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
33 |
34 | // Initialise the console, required for printf
35 | console_init(xfb,20,20,rmode->fbWidth-20,rmode->xfbHeight-20,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
36 |
37 | // Set up the video registers with the chosen mode
38 | VIDEO_Configure(rmode);
39 |
40 | // Tell the video hardware where our display memory is
41 | VIDEO_SetNextFramebuffer(xfb);
42 |
43 | // Clear the framebuffer
44 | VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);
45 |
46 | // Make the display visible
47 | VIDEO_SetBlack(false);
48 |
49 | // Flush the video register changes to the hardware
50 | VIDEO_Flush();
51 |
52 | // Wait for Video setup to complete
53 | VIDEO_WaitVSync();
54 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
55 |
56 |
57 | // The console understands VT terminal escape codes
58 | // This positions the cursor on row 2, column 0
59 | // we can use variables for this with format codes too
60 | // e.g. printf ("\x1b[%d;%dH", row, column );
61 | printf("\x1b[2;0H");
62 |
63 | if (!fatInitDefault()) {
64 | printf("fatInitDefault failure: terminating\n");
65 | goto error;
66 | }
67 |
68 | DIR *pdir;
69 | struct dirent *pent;
70 | struct stat statbuf;
71 |
72 | pdir=opendir(".");
73 |
74 | if (!pdir){
75 | printf ("opendir() failure; terminating\n");
76 | goto error;
77 | }
78 |
79 | while ((pent=readdir(pdir))!=NULL) {
80 | stat(pent->d_name,&statbuf);
81 | if(strcmp(".", pent->d_name) == 0 || strcmp("..", pent->d_name) == 0)
82 | continue;
83 | if(S_ISDIR(statbuf.st_mode))
84 | printf("%s \n", pent->d_name);
85 | if(!(S_ISDIR(statbuf.st_mode)))
86 | printf("%s %lld\n", pent->d_name, statbuf.st_size);
87 | }
88 | closedir(pdir);
89 |
90 | error:
91 | while(1) {
92 |
93 | // Call WPAD_ScanPads each loop, this reads the latest controller states
94 | WPAD_ScanPads();
95 |
96 | // WPAD_ButtonsDown tells us which buttons were pressed in this loop
97 | // this is a "one shot" state which will not fire again until the button has been released
98 | u32 pressed = WPAD_ButtonsDown(0);
99 |
100 | // We return to the launcher application via exit
101 | if ( pressed & WPAD_BUTTON_HOME ) exit(0);
102 |
103 | // Wait for the next frame
104 | VIDEO_WaitVSync();
105 | }
106 |
107 | return 0;
108 | }
109 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson01/source/lesson1.c:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------
2 |
3 | nehe lesson 1 port to GX by WinterMute
4 |
5 | ---------------------------------------------------------------------------------*/
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #define DEFAULT_FIFO_SIZE (256*1024)
16 |
17 | static void *frameBuffer[2] = { NULL, NULL};
18 | GXRModeObj *rmode;
19 |
20 | //---------------------------------------------------------------------------------
21 | int main( int argc, char **argv ){
22 | //---------------------------------------------------------------------------------
23 | f32 yscale;
24 |
25 | u32 xfbHeight;
26 |
27 | Mtx view;
28 | Mtx44 perspective;
29 |
30 | u32 fb = 0; // initial framebuffer index
31 | GXColor background = {0, 0, 0, 0xff};
32 |
33 |
34 | // init the vi.
35 | VIDEO_Init();
36 | WPAD_Init();
37 |
38 | rmode = VIDEO_GetPreferredMode(NULL);
39 |
40 | // allocate 2 framebuffers for double buffering
41 | frameBuffer[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
42 | frameBuffer[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
43 |
44 | VIDEO_Configure(rmode);
45 | VIDEO_SetNextFramebuffer(frameBuffer[fb]);
46 | VIDEO_SetBlack(false);
47 | VIDEO_Flush();
48 | VIDEO_WaitVSync();
49 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
50 |
51 | // setup the fifo and then init the flipper
52 | void *gp_fifo = NULL;
53 | gp_fifo = memalign(32,DEFAULT_FIFO_SIZE);
54 | memset(gp_fifo,0,DEFAULT_FIFO_SIZE);
55 |
56 | GX_Init(gp_fifo,DEFAULT_FIFO_SIZE);
57 |
58 | // clears the bg to color and clears the z buffer
59 | GX_SetCopyClear(background, 0x00ffffff);
60 |
61 | // other gx setup
62 | GX_SetViewport(0,0,rmode->fbWidth,rmode->efbHeight,0,1);
63 | yscale = GX_GetYScaleFactor(rmode->efbHeight,rmode->xfbHeight);
64 | xfbHeight = GX_SetDispCopyYScale(yscale);
65 | GX_SetScissor(0,0,rmode->fbWidth,rmode->efbHeight);
66 | GX_SetDispCopySrc(0,0,rmode->fbWidth,rmode->efbHeight);
67 | GX_SetDispCopyDst(rmode->fbWidth,xfbHeight);
68 | GX_SetCopyFilter(rmode->aa,rmode->sample_pattern,GX_TRUE,rmode->vfilter);
69 | GX_SetFieldMode(rmode->field_rendering,((rmode->viHeight==2*rmode->xfbHeight)?GX_ENABLE:GX_DISABLE));
70 |
71 | GX_SetCullMode(GX_CULL_NONE);
72 | GX_CopyDisp(frameBuffer[fb],GX_TRUE);
73 | GX_SetDispCopyGamma(GX_GM_1_0);
74 |
75 | // setup our camera at the origin
76 | // looking down the -z axis with y up
77 | guVector cam = {0.0F, 0.0F, 0.0F},
78 | up = {0.0F, 1.0F, 0.0F},
79 | look = {0.0F, 0.0F, -1.0F};
80 | guLookAt(view, &cam, &up, &look);
81 |
82 |
83 | // setup our projection matrix
84 | // this creates a perspective matrix with a view angle of 90,
85 | // and aspect ratio based on the display resolution
86 | f32 w = rmode->viWidth;
87 | f32 h = rmode->viHeight;
88 | guPerspective(perspective, 45, (f32)w/h, 0.1F, 300.0F);
89 | GX_LoadProjectionMtx(perspective, GX_PERSPECTIVE);
90 |
91 | while(1) {
92 |
93 | WPAD_ScanPads();
94 |
95 | if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
96 |
97 | // do this before drawing
98 | GX_SetViewport(0,0,rmode->fbWidth,rmode->efbHeight,0,1);
99 |
100 |
101 | // do this stuff after drawing
102 | GX_DrawDone();
103 |
104 | fb ^= 1; // flip framebuffer
105 | GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
106 | GX_SetColorUpdate(GX_TRUE);
107 | GX_CopyDisp(frameBuffer[fb],GX_TRUE);
108 |
109 | VIDEO_SetNextFramebuffer(frameBuffer[fb]);
110 |
111 | VIDEO_Flush();
112 |
113 | VIDEO_WaitVSync();
114 |
115 |
116 | }
117 | return 0;
118 | }
119 |
120 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson10/data/world.txt:
--------------------------------------------------------------------------------
1 | NUMPOLYS 36
2 |
3 | // Floor 1
4 | -3.0 0.0 -3.0 0.0 6.0
5 | -3.0 0.0 3.0 0.0 0.0
6 | 3.0 0.0 3.0 6.0 0.0
7 |
8 | -3.0 0.0 -3.0 0.0 6.0
9 | 3.0 0.0 -3.0 6.0 6.0
10 | 3.0 0.0 3.0 6.0 0.0
11 |
12 | // Ceiling 1
13 | -3.0 1.0 -3.0 0.0 6.0
14 | -3.0 1.0 3.0 0.0 0.0
15 | 3.0 1.0 3.0 6.0 0.0
16 | -3.0 1.0 -3.0 0.0 6.0
17 | 3.0 1.0 -3.0 6.0 6.0
18 | 3.0 1.0 3.0 6.0 0.0
19 |
20 | // A1
21 |
22 | -2.0 1.0 -2.0 0.0 1.0
23 | -2.0 0.0 -2.0 0.0 0.0
24 | -0.5 0.0 -2.0 1.5 0.0
25 | -2.0 1.0 -2.0 0.0 1.0
26 | -0.5 1.0 -2.0 1.5 1.0
27 | -0.5 0.0 -2.0 1.5 0.0
28 |
29 | // A2
30 |
31 | 2.0 1.0 -2.0 2.0 1.0
32 | 2.0 0.0 -2.0 2.0 0.0
33 | 0.5 0.0 -2.0 0.5 0.0
34 | 2.0 1.0 -2.0 2.0 1.0
35 | 0.5 1.0 -2.0 0.5 1.0
36 | 0.5 0.0 -2.0 0.5 0.0
37 |
38 | // B1
39 |
40 | -2.0 1.0 2.0 2.0 1.0
41 | -2.0 0.0 2.0 2.0 0.0
42 | -0.5 0.0 2.0 0.5 0.0
43 | -2.0 1.0 2.0 2.0 1.0
44 | -0.5 1.0 2.0 0.5 1.0
45 | -0.5 0.0 2.0 0.5 0.0
46 |
47 | // B2
48 |
49 | 2.0 1.0 2.0 2.0 1.0
50 | 2.0 0.0 2.0 2.0 0.0
51 | 0.5 0.0 2.0 0.5 0.0
52 | 2.0 1.0 2.0 2.0 1.0
53 | 0.5 1.0 2.0 0.5 1.0
54 | 0.5 0.0 2.0 0.5 0.0
55 |
56 | // C1
57 |
58 | -2.0 1.0 -2.0 0.0 1.0
59 | -2.0 0.0 -2.0 0.0 0.0
60 | -2.0 0.0 -0.5 1.5 0.0
61 | -2.0 1.0 -2.0 0.0 1.0
62 | -2.0 1.0 -0.5 1.5 1.0
63 | -2.0 0.0 -0.5 1.5 0.0
64 |
65 | // C2
66 |
67 | -2.0 1.0 2.0 2.0 1.0
68 | -2.0 0.0 2.0 2.0 0.0
69 | -2.0 0.0 0.5 0.5 0.0
70 | -2.0 1.0 2.0 2.0 1.0
71 | -2.0 1.0 0.5 0.5 1.0
72 | -2.0 0.0 0.5 0.5 0.0
73 |
74 | // D1
75 |
76 | 2.0 1.0 -2.0 0.0 1.0
77 | 2.0 0.0 -2.0 0.0 0.0
78 | 2.0 0.0 -0.5 1.5 0.0
79 | 2.0 1.0 -2.0 0.0 1.0
80 | 2.0 1.0 -0.5 1.5 1.0
81 | 2.0 0.0 -0.5 1.5 0.0
82 |
83 | // D2
84 |
85 | 2.0 1.0 2.0 2.0 1.0
86 | 2.0 0.0 2.0 2.0 0.0
87 | 2.0 0.0 0.5 0.5 0.0
88 | 2.0 1.0 2.0 2.0 1.0
89 | 2.0 1.0 0.5 0.5 1.0
90 | 2.0 0.0 0.5 0.5 0.0
91 |
92 | // Upper hallway - L
93 | -0.5 1.0 -3.0 0.0 1.0
94 | -0.5 0.0 -3.0 0.0 0.0
95 | -0.5 0.0 -2.0 1.0 0.0
96 | -0.5 1.0 -3.0 0.0 1.0
97 | -0.5 1.0 -2.0 1.0 1.0
98 | -0.5 0.0 -2.0 1.0 0.0
99 |
100 | // Upper hallway - R
101 | 0.5 1.0 -3.0 0.0 1.0
102 | 0.5 0.0 -3.0 0.0 0.0
103 | 0.5 0.0 -2.0 1.0 0.0
104 | 0.5 1.0 -3.0 0.0 1.0
105 | 0.5 1.0 -2.0 1.0 1.0
106 | 0.5 0.0 -2.0 1.0 0.0
107 |
108 | // Lower hallway - L
109 | -0.5 1.0 3.0 0.0 1.0
110 | -0.5 0.0 3.0 0.0 0.0
111 | -0.5 0.0 2.0 1.0 0.0
112 | -0.5 1.0 3.0 0.0 1.0
113 | -0.5 1.0 2.0 1.0 1.0
114 | -0.5 0.0 2.0 1.0 0.0
115 |
116 | // Lower hallway - R
117 | 0.5 1.0 3.0 0.0 1.0
118 | 0.5 0.0 3.0 0.0 0.0
119 | 0.5 0.0 2.0 1.0 0.0
120 | 0.5 1.0 3.0 0.0 1.0
121 | 0.5 1.0 2.0 1.0 1.0
122 | 0.5 0.0 2.0 1.0 0.0
123 |
124 |
125 | // Left hallway - Lw
126 |
127 | -3.0 1.0 0.5 1.0 1.0
128 | -3.0 0.0 0.5 1.0 0.0
129 | -2.0 0.0 0.5 0.0 0.0
130 | -3.0 1.0 0.5 1.0 1.0
131 | -2.0 1.0 0.5 0.0 1.0
132 | -2.0 0.0 0.5 0.0 0.0
133 |
134 | // Left hallway - Hi
135 |
136 | -3.0 1.0 -0.5 1.0 1.0
137 | -3.0 0.0 -0.5 1.0 0.0
138 | -2.0 0.0 -0.5 0.0 0.0
139 | -3.0 1.0 -0.5 1.0 1.0
140 | -2.0 1.0 -0.5 0.0 1.0
141 | -2.0 0.0 -0.5 0.0 0.0
142 |
143 | // Right hallway - Lw
144 |
145 | 3.0 1.0 0.5 1.0 1.0
146 | 3.0 0.0 0.5 1.0 0.0
147 | 2.0 0.0 0.5 0.0 0.0
148 | 3.0 1.0 0.5 1.0 1.0
149 | 2.0 1.0 0.5 0.0 1.0
150 | 2.0 0.0 0.5 0.0 0.0
151 |
152 | // Right hallway - Hi
153 |
154 | 3.0 1.0 -0.5 1.0 1.0
155 | 3.0 0.0 -0.5 1.0 0.0
156 | 2.0 0.0 -0.5 0.0 0.0
157 | 3.0 1.0 -0.5 1.0 1.0
158 | 2.0 1.0 -0.5 0.0 1.0
159 | 2.0 0.0 -0.5 0.0 0.0
--------------------------------------------------------------------------------
/graphics/gx/triangle/source/triangle.c:
--------------------------------------------------------------------------------
1 | // adapted from the original acube demo by tkcne.
2 |
3 | // enjoy
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | GXRModeObj *screenMode;
13 | static void *frameBuffer;
14 | static vu8 readyForCopy;
15 | #define FIFO_SIZE (256*1024)
16 |
17 | s16 vertices[] ATTRIBUTE_ALIGN(32) = {
18 | 0, 15, 0,
19 | -15, -15, 0,
20 | 15, -15, 0};
21 |
22 | u8 colors[] ATTRIBUTE_ALIGN(32) = {
23 | 255, 0, 0, 255, // red
24 | 0, 255, 0, 255, // green
25 | 0, 0, 255, 255}; // blue
26 |
27 | void update_screen(Mtx viewMatrix);
28 | static void copy_buffers(u32 unused);
29 |
30 | int main(void) {
31 | Mtx view;
32 | Mtx44 projection;
33 | GXColor backgroundColor = {0, 0, 0, 255};
34 | void *fifoBuffer = NULL;
35 |
36 | VIDEO_Init();
37 | WPAD_Init();
38 |
39 | screenMode = VIDEO_GetPreferredMode(NULL);
40 |
41 | frameBuffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(screenMode));
42 |
43 | VIDEO_Configure(screenMode);
44 | VIDEO_SetNextFramebuffer(frameBuffer);
45 | VIDEO_SetPostRetraceCallback(copy_buffers);
46 | VIDEO_SetBlack(false);
47 | VIDEO_Flush();
48 |
49 |
50 |
51 | fifoBuffer = MEM_K0_TO_K1(memalign(32,FIFO_SIZE));
52 | memset(fifoBuffer, 0, FIFO_SIZE);
53 |
54 | GX_Init(fifoBuffer, FIFO_SIZE);
55 | GX_SetCopyClear(backgroundColor, 0x00ffffff);
56 | GX_SetViewport(0,0,screenMode->fbWidth,screenMode->efbHeight,0,1);
57 | GX_SetDispCopyYScale((f32)screenMode->xfbHeight/(f32)screenMode->efbHeight);
58 | GX_SetScissor(0,0,screenMode->fbWidth,screenMode->efbHeight);
59 | GX_SetDispCopySrc(0,0,screenMode->fbWidth,screenMode->efbHeight);
60 | GX_SetDispCopyDst(screenMode->fbWidth,screenMode->xfbHeight);
61 | GX_SetCopyFilter(screenMode->aa,screenMode->sample_pattern,
62 | GX_TRUE,screenMode->vfilter);
63 | GX_SetFieldMode(screenMode->field_rendering,
64 | ((screenMode->viHeight==2*screenMode->xfbHeight)?GX_ENABLE:GX_DISABLE));
65 |
66 | GX_SetCullMode(GX_CULL_NONE);
67 | GX_CopyDisp(frameBuffer,GX_TRUE);
68 | GX_SetDispCopyGamma(GX_GM_1_0);
69 |
70 | guVector camera = {0.0F, 0.0F, 0.0F};
71 | guVector up = {0.0F, 1.0F, 0.0F};
72 | guVector look = {0.0F, 0.0F, -1.0F};
73 |
74 | guPerspective(projection, 60, (CONF_GetAspectRatio() == CONF_ASPECT_16_9) ? 16.0F/9.0F : 4.0F/3.0F, 10.0F, 300.0F);
75 | GX_LoadProjectionMtx(projection, GX_PERSPECTIVE);
76 |
77 | GX_ClearVtxDesc();
78 | GX_SetVtxDesc(GX_VA_POS, GX_INDEX8);
79 | GX_SetVtxDesc(GX_VA_CLR0, GX_INDEX8);
80 | GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
81 | GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
82 | GX_SetArray(GX_VA_POS, vertices, 3*sizeof(s16));
83 | GX_SetArray(GX_VA_CLR0, colors, 4*sizeof(u8));
84 | GX_SetNumChans(1);
85 | GX_SetNumTexGens(0);
86 | GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR0A0);
87 | GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
88 |
89 | while (1)
90 | {
91 | guLookAt(view, &camera, &up, &look);
92 | GX_SetViewport(0,0,screenMode->fbWidth,screenMode->efbHeight,0,1);
93 | GX_InvVtxCache();
94 | GX_InvalidateTexAll();
95 | update_screen(view);
96 |
97 | WPAD_ScanPads();
98 | if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
99 | }
100 | return 0;
101 | }
102 |
103 | void update_screen( Mtx viewMatrix )
104 | {
105 | Mtx modelView;
106 |
107 | guMtxIdentity(modelView);
108 | guMtxTransApply(modelView, modelView, 0.0F, 0.0F, -50.0F);
109 | guMtxConcat(viewMatrix,modelView,modelView);
110 |
111 | GX_LoadPosMtxImm(modelView, GX_PNMTX0);
112 |
113 | GX_Begin(GX_TRIANGLES, GX_VTXFMT0, 3);
114 |
115 | GX_Position1x8(0);
116 | GX_Color1x8(0);
117 | GX_Position1x8(1);
118 | GX_Color1x8(1);
119 | GX_Position1x8(2);
120 | GX_Color1x8(2);
121 |
122 | GX_End();
123 |
124 | GX_DrawDone();
125 | readyForCopy = GX_TRUE;
126 |
127 | VIDEO_WaitVSync();
128 | return;
129 | }
130 |
131 | static void copy_buffers(u32 count __attribute__ ((unused)))
132 | {
133 | if (readyForCopy==GX_TRUE) {
134 | GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
135 | GX_SetColorUpdate(GX_TRUE);
136 | GX_CopyDisp(frameBuffer,GX_TRUE);
137 | GX_Flush();
138 | readyForCopy = GX_FALSE;
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/devices/wiimote/source/wiimote.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | static void *xfb = NULL;
7 | static bool isSearching = false;
8 | static GXRModeObj *rmode = NULL;
9 |
10 | //---------------------------------------------------------------------------------
11 | int main(int argc, char **argv) {
12 | //---------------------------------------------------------------------------------
13 |
14 | // Initialise the video system
15 | VIDEO_Init();
16 |
17 | // Obtain the preferred video mode from the system
18 | // This will correspond to the settings in the Wii menu
19 | rmode = VIDEO_GetPreferredMode(NULL);
20 |
21 | // Allocate memory for the display in the uncached region
22 | xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
23 |
24 | // Initialise the console, required for printf
25 | CON_Init(xfb, 20, 20, rmode->fbWidth-20, rmode->xfbHeight-20, rmode->fbWidth*VI_DISPLAY_PIX_SZ);
26 | //SYS_STDIO_Report(true);
27 |
28 | // Set up the video registers with the chosen mode
29 | VIDEO_Configure(rmode);
30 |
31 | // Tell the video hardware where our display memory is
32 | VIDEO_SetNextFramebuffer(xfb);
33 |
34 | // Clear the framebuffer
35 | VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);
36 |
37 | // Make the display visible
38 | VIDEO_SetBlack(false);
39 |
40 | // Flush the video register changes to the hardware
41 | VIDEO_Flush();
42 |
43 | // Wait for Video setup to complete
44 | VIDEO_WaitVSync();
45 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
46 |
47 | // This function initialises the attached controllers
48 | WPAD_Init();
49 |
50 | //tell wpad to output the IR data
51 | WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR);
52 |
53 | //set console starting position to the second row, to make space for tv's offsets
54 | printf("\x1b[2;0H");
55 |
56 | printf("Hello World!\n");
57 | printf("Connect a wiimote by pressing a button\n");
58 | printf("Or press the red sync button on the wii together with the wiimote!\n");
59 | printf("to toggle searching for guest wiimotes, press +\n");
60 | printf("to exit, press the home\n");
61 |
62 | while(1)
63 | {
64 | //reset console location to 8th row
65 | printf("\x1b[8;0H");
66 |
67 | // Call WPAD_ScanPads each loop, this reads the latest controller states
68 | WPAD_ScanPads();
69 |
70 | for (int i = 0; i <= 3; i++)
71 | {
72 | //clear line and print the wiimote's data
73 | printf("\33[2K\r");
74 | WPADData* data = WPAD_Data(i);
75 | if(data->data_present)
76 | printf("wiimote %d: x -> %f y-> %f angle -> %f\n", i, data->ir.x, data->ir.y, data->ir.angle);
77 | else
78 | printf("wiimote %d: Disconnected\n", i);
79 | }
80 |
81 | // WPAD_ButtonsDown tells us which buttons were pressed in this loop
82 | // this is a "one shot" state which will not fire again until the button has been released
83 | u32 pressed = WPAD_ButtonsDown(0) | WPAD_ButtonsDown(1) | WPAD_ButtonsDown(2) | WPAD_ButtonsDown(3);
84 |
85 | // We return to the launcher application via exit
86 | if ( pressed & WPAD_BUTTON_HOME ) break;
87 |
88 | if ( pressed & WPAD_BUTTON_PLUS )
89 | {
90 | // toggle searching for guest wiimotes
91 | // these stay active and valid on the wii untill the wiimote subsystem is shutdown
92 | // when searching is started, all wiimotes will disconnect and the system will start searching for new wiimotes
93 | // the searching lasts for 60 seconds or so.
94 | if(isSearching)
95 | WPAD_StopSearch();
96 | else
97 | WPAD_Search();
98 |
99 | isSearching = !isSearching;
100 | }
101 |
102 | // Wait for the next frame
103 | VIDEO_WaitVSync();
104 | }
105 |
106 | // loop over all wiimotes and disconnect them
107 | // this would shutdown the wiimotes and they would only respond after have pressed a button again
108 | // under normal circumstances, this is not wanted and is why it's disabled here
109 | // its more user friendly if the wiimote is left in a seeking state so that the launcher can pick it back up again
110 | #if 0
111 | for (int i = 0;i < WPAD_MAX_WIIMOTES ;i++)
112 | {
113 | if(WPAD_Probe(i,0) < 0)
114 | continue;
115 | WPAD_Flush(i);
116 | WPAD_Disconnect(i);
117 | }
118 | #endif
119 |
120 | // Shutdown the WPAD system
121 | // Any wiimotes that are connected will be force disconnected
122 | // this results in any connected wiimotes to be left in a seeking state
123 | // in a seeking state the wiimotes will automatically reconnect when the subsystem is reinitialized
124 | WPAD_Shutdown();
125 |
126 | return 0;
127 | }
128 |
--------------------------------------------------------------------------------
/templates/makefile/library/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # list of directories containing libraries, this must be the top level containing
35 | # include and lib
36 | #---------------------------------------------------------------------------------
37 | LIBDIRS :=
38 |
39 | #---------------------------------------------------------------------------------
40 | # no real need to edit anything past this point unless you need to add additional
41 | # rules for different file extensions
42 | #---------------------------------------------------------------------------------
43 | ifneq ($(BUILD),$(notdir $(CURDIR)))
44 | #---------------------------------------------------------------------------------
45 |
46 | export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a
47 |
48 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
49 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
50 |
51 | export DEPSDIR := $(CURDIR)/$(BUILD)
52 |
53 | #---------------------------------------------------------------------------------
54 | # automatically build a list of object files for our project
55 | #---------------------------------------------------------------------------------
56 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
57 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
58 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
59 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
60 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
61 |
62 | export OFILES_BIN := $(addsuffix .o,$(BINFILES))
63 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
64 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
65 |
66 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
67 |
68 | #---------------------------------------------------------------------------------
69 | # build a list of include paths
70 | #---------------------------------------------------------------------------------
71 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
72 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
73 | -I$(CURDIR)/$(BUILD) \
74 | -I$(LIBOGC_INC)
75 |
76 | .PHONY: $(BUILD) clean
77 |
78 | #---------------------------------------------------------------------------------
79 | all: $(BUILD)
80 |
81 | lib:
82 | @[ -d $@ ] || mkdir -p $@
83 |
84 | $(BUILD): lib
85 | @[ -d $@ ] || mkdir -p $@
86 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
87 |
88 | #---------------------------------------------------------------------------------
89 | clean:
90 | @echo clean ...
91 | @rm -fr $(BUILD) lib
92 |
93 | #---------------------------------------------------------------------------------
94 | else
95 |
96 | DEPENDS := $(OFILES:.o=.d)
97 |
98 | #---------------------------------------------------------------------------------
99 | # main targets
100 | #---------------------------------------------------------------------------------
101 | $(OUTPUT) : $(OFILES)
102 |
103 | $(OFILES_SOURCES) : $(HFILES)
104 |
105 | -include $(DEPENDS)
106 |
107 | #---------------------------------------------------------------------------------
108 | endif
109 | #---------------------------------------------------------------------------------
110 |
--------------------------------------------------------------------------------
/devices/network/sockettest/source/sockettest.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | static void *xfb = NULL;
13 | static GXRModeObj *rmode = NULL;
14 |
15 | void *initialise();
16 | void *httpd (void *arg);
17 |
18 | static lwp_t httd_handle = (lwp_t)NULL;
19 |
20 | //---------------------------------------------------------------------------------
21 | int main(int argc, char **argv) {
22 | //---------------------------------------------------------------------------------
23 | s32 ret;
24 |
25 | char localip[16] = {0};
26 | char gateway[16] = {0};
27 | char netmask[16] = {0};
28 |
29 | xfb = initialise();
30 |
31 | printf ("\nlibogc network demo\n");
32 | printf("Configuring network ...\n");
33 |
34 | // Configure the network interface
35 | ret = if_config ( localip, netmask, gateway, true, 20);
36 | if (ret>=0) {
37 | printf ("network configured, ip: %s, gw: %s, mask %s\n", localip, gateway, netmask);
38 |
39 | LWP_CreateThread( &httd_handle, /* thread handle */
40 | httpd, /* code */
41 | localip, /* arg pointer for thread */
42 | NULL, /* stack base */
43 | 64*1024, /* stack size */
44 | 50 /* thread priority */ );
45 | } else {
46 | printf ("network configuration failed!\n");
47 | }
48 |
49 | while(1) {
50 |
51 | VIDEO_WaitVSync();
52 | WPAD_ScanPads();
53 |
54 | int buttonsDown = WPAD_ButtonsDown(0);
55 |
56 | if (buttonsDown & WPAD_BUTTON_HOME) {
57 | exit(0);
58 | }
59 | }
60 |
61 | return 0;
62 | }
63 |
64 | const static char http_200[] = "HTTP/1.1 200 OK\r\n";
65 |
66 | const static char indexdata[] = " \
67 | A test page \
68 | \
69 | This small test page has had %d hits. \
70 | \
71 | ";
72 |
73 | const static char http_html_hdr[] = "Content-type: text/html\r\n\r\n";
74 | const static char http_get_index[] = "GET / HTTP/1.1\r\n";
75 |
76 | //---------------------------------------------------------------------------------
77 | void *httpd (void *arg) {
78 | //---------------------------------------------------------------------------------
79 |
80 | int sock, csock;
81 | int ret;
82 | u32 clientlen;
83 | struct sockaddr_in client;
84 | struct sockaddr_in server;
85 | char temp[1026];
86 | static int hits=0;
87 |
88 | clientlen = sizeof(client);
89 |
90 | sock = net_socket (AF_INET, SOCK_STREAM, IPPROTO_IP);
91 |
92 | if (sock == INVALID_SOCKET) {
93 | printf ("Cannot create a socket!\n");
94 | } else {
95 |
96 | memset (&server, 0, sizeof (server));
97 | memset (&client, 0, sizeof (client));
98 |
99 | server.sin_family = AF_INET;
100 | server.sin_port = htons (80);
101 | server.sin_addr.s_addr = INADDR_ANY;
102 | ret = net_bind (sock, (struct sockaddr *) &server, sizeof (server));
103 |
104 | if ( ret ) {
105 |
106 | printf("Error %d binding socket!\n", ret);
107 |
108 | } else {
109 |
110 | if ( (ret = net_listen( sock, 5)) ) {
111 |
112 | printf("Error %d listening!\n", ret);
113 |
114 | } else {
115 |
116 | while(1) {
117 |
118 | csock = net_accept (sock, (struct sockaddr *) &client, &clientlen);
119 |
120 | if ( csock < 0 ) {
121 | printf("Error connecting socket %d!\n", csock);
122 | while(1);
123 | }
124 |
125 | printf("Connecting port %d from %s\n", client.sin_port, inet_ntoa(client.sin_addr));
126 | memset (temp, 0, 1026);
127 | ret = net_recv (csock, temp, 1024, 0);
128 | printf("Received %d bytes\n", ret);
129 |
130 | if ( !strncmp( temp, http_get_index, strlen(http_get_index) ) ) {
131 | hits++;
132 | net_send(csock, http_200, strlen(http_200), 0);
133 | net_send(csock, http_html_hdr, strlen(http_html_hdr), 0);
134 | sprintf(temp, indexdata, hits);
135 | net_send(csock, temp, strlen(temp), 0);
136 | }
137 |
138 | net_close (csock);
139 |
140 | }
141 | }
142 | }
143 | }
144 | return NULL;
145 | }
146 |
147 | //---------------------------------------------------------------------------------
148 | void *initialise() {
149 | //---------------------------------------------------------------------------------
150 |
151 | void *framebuffer;
152 |
153 | VIDEO_Init();
154 | WPAD_Init();
155 |
156 | rmode = VIDEO_GetPreferredMode(NULL);
157 | framebuffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
158 | console_init(framebuffer,20,20,rmode->fbWidth-20,rmode->xfbHeight-20,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
159 |
160 | VIDEO_Configure(rmode);
161 | VIDEO_SetNextFramebuffer(framebuffer);
162 | VIDEO_ClearFrameBuffer(rmode, framebuffer, COLOR_BLACK);
163 | VIDEO_SetBlack(false);
164 | VIDEO_Flush();
165 | VIDEO_WaitVSync();
166 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
167 |
168 | return framebuffer;
169 |
170 | }
171 |
--------------------------------------------------------------------------------
/devices/network/udptest/source/udptest.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | #define NUM_SOCKETS 4
13 |
14 | static void initialise() {
15 | GXRModeObj *rmode = NULL;
16 | void *framebuffer;
17 |
18 | VIDEO_Init();
19 | WPAD_Init();
20 |
21 | rmode = VIDEO_GetPreferredMode(NULL);
22 | framebuffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
23 | console_init(framebuffer, 20, 20, rmode->fbWidth-20, rmode->xfbHeight-20,
24 | rmode->fbWidth * VI_DISPLAY_PIX_SZ);
25 |
26 | VIDEO_Configure(rmode);
27 | VIDEO_SetNextFramebuffer(framebuffer);
28 | VIDEO_ClearFrameBuffer(rmode, framebuffer, COLOR_BLACK);
29 | VIDEO_SetBlack(false);
30 | VIDEO_Flush();
31 | VIDEO_WaitVSync();
32 | if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
33 | }
34 |
35 | static void show_help()
36 | {
37 | char local_ip[16] = {0};
38 | const char *own_ip;
39 | s32 ret;
40 |
41 | /* Note: this call is not needed to initialize the network. We just need it
42 | * to be able to show our current IP address in the message below. */
43 | ret = if_config(local_ip, NULL, NULL, true, 20);
44 | if (ret < 0) {
45 | printf("Error retrieving own IP address.\n");
46 | own_ip = "";
47 | } else {
48 | own_ip = local_ip;
49 | }
50 |
51 | printf("\nTo test this program, run this command from a terminal:\n"
52 | "\n nc -u %s 45678 (or 45679, ...)\n"
53 | "\nthen type something and press ENTER.\n\n", own_ip);
54 | }
55 |
56 | static s32 create_socket(u16 port) {
57 | int sock;
58 | int ret;
59 | struct sockaddr_in server;
60 |
61 | sock = net_socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
62 |
63 | if (sock == INVALID_SOCKET) {
64 | printf ("Cannot create a socket!\n");
65 | return -1;
66 | }
67 |
68 | memset(&server, 0, sizeof(server));
69 |
70 | server.sin_family = AF_INET;
71 | server.sin_port = htons(port);
72 | server.sin_addr.s_addr = INADDR_ANY;
73 | ret = net_bind(sock, (struct sockaddr *)&server, sizeof(server));
74 | if (ret) {
75 | printf("Error %d binding socket!\n", ret);
76 | return -1;
77 | }
78 |
79 | socklen_t len = sizeof(server);
80 | ret = net_getsockname(sock, (struct sockaddr *)&server, &len);
81 | if (ret < 0) {
82 | printf("Error %d getting socket address!\n", ret);
83 | return -1;
84 | }
85 |
86 | u32 addr = server.sin_addr.s_addr;
87 | printf("UDP socket listening on: %u.%u.%u.%u:%u\n",
88 | (addr >> 24) & 0xff,
89 | (addr >> 16) & 0xff,
90 | (addr >> 8) & 0xff,
91 | addr & 0xff,
92 | server.sin_port);
93 | return sock;
94 | }
95 |
96 | static void handle_client(s32 sock)
97 | {
98 | char buffer[256], buffer_out[256 + 16];
99 | socklen_t sock_len;
100 | struct sockaddr_in client;
101 | s32 len, len_out;
102 |
103 | sock_len = sizeof(client);
104 | /* Note: passing MSG_DONTWAIT in the flags makes net_recvfrom() return
105 | * error EOPNOTSUPP */
106 | len = net_recvfrom(sock, buffer, sizeof(buffer), 0,
107 | (struct sockaddr *)&client, &sock_len);
108 | if (len < 0) {
109 | printf("net_recvfrom returned error %d\n", len);
110 | return;
111 | }
112 | u32 addr = client.sin_addr.s_addr;
113 | printf("Received %d bytes from %u.%u.%u.%u:%u: %.*s\n", len,
114 | (addr >> 24) & 0xff,
115 | (addr >> 16) & 0xff,
116 | (addr >> 8) & 0xff,
117 | addr & 0xff,
118 | client.sin_port, len, buffer);
119 |
120 | len_out = snprintf(buffer_out, sizeof(buffer_out), "Echo: %.*s\n", len, buffer);
121 | net_sendto(sock, buffer_out, len_out, 0, (struct sockaddr *)&client, sock_len);
122 | if (strncmp(buffer, "exit", 4) == 0) exit(0);
123 | }
124 |
125 | int main(int argc, char **argv) {
126 | s32 ret;
127 |
128 | initialise();
129 |
130 | printf("\nlibogc network UDP demo\n");
131 | printf("Configuring network...\n");
132 |
133 | net_init();
134 |
135 | struct pollsd sds[NUM_SOCKETS];
136 | for (int i = 0; i < NUM_SOCKETS; i++) {
137 | s32 sock = create_socket(45678 + i);
138 | if (sock < 0) return EXIT_FAILURE;
139 |
140 | sds[i].socket = sock;
141 | sds[i].events = POLLIN;
142 | sds[i].revents = 0;
143 | }
144 |
145 | show_help();
146 |
147 | while (1) {
148 | VIDEO_WaitVSync();
149 | WPAD_ScanPads();
150 |
151 | int buttonsDown = WPAD_ButtonsDown(0);
152 |
153 | if (buttonsDown & WPAD_BUTTON_1) {
154 | exit(0);
155 | }
156 |
157 | /* This is not really needed in this case, but let's show how polling
158 | * works */
159 | s32 timeout = 10;
160 | ret = net_poll(sds, NUM_SOCKETS, timeout);
161 | if (ret > 0) {
162 | for (int i = 0; i < NUM_SOCKETS; i++) {
163 | if (sds[i].revents) {
164 | handle_client(sds[i].socket);
165 | }
166 | }
167 | }
168 | }
169 |
170 | return EXIT_SUCCESS;
171 | }
172 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson02/source/lesson2.c:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------
2 |
3 | nehe lesson 2 port to GX by WinterMute
4 |
5 | ---------------------------------------------------------------------------------*/
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #define DEFAULT_FIFO_SIZE (256*1024)
16 |
17 | static void *frameBuffer[2] = { NULL, NULL};
18 | GXRModeObj *rmode;
19 |
20 | //---------------------------------------------------------------------------------
21 | int main( int argc, char **argv ){
22 | //---------------------------------------------------------------------------------
23 | f32 yscale;
24 |
25 | u32 xfbHeight;
26 |
27 | Mtx view;
28 | Mtx44 perspective;
29 | Mtx model, modelview;
30 |
31 | u32 fb = 0; // initial framebuffer index
32 | GXColor background = {0, 0, 0, 0xff};
33 |
34 |
35 | // init the vi.
36 | VIDEO_Init();
37 | WPAD_Init();
38 |
39 | rmode = VIDEO_GetPreferredMode(NULL);
40 |
41 | // allocate 2 framebuffers for double buffering
42 | frameBuffer[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
43 | frameBuffer[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
44 |
45 | VIDEO_Configure(rmode);
46 | VIDEO_SetNextFramebuffer(frameBuffer[fb]);
47 | VIDEO_SetBlack(false);
48 | VIDEO_Flush();
49 | VIDEO_WaitVSync();
50 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
51 |
52 | // setup the fifo and then init the flipper
53 | void *gp_fifo = NULL;
54 | gp_fifo = memalign(32,DEFAULT_FIFO_SIZE);
55 | memset(gp_fifo,0,DEFAULT_FIFO_SIZE);
56 |
57 | GX_Init(gp_fifo,DEFAULT_FIFO_SIZE);
58 |
59 | // clears the bg to color and clears the z buffer
60 | GX_SetCopyClear(background, 0x00ffffff);
61 |
62 | // other gx setup
63 | GX_SetViewport(0,0,rmode->fbWidth,rmode->efbHeight,0,1);
64 | yscale = GX_GetYScaleFactor(rmode->efbHeight,rmode->xfbHeight);
65 | xfbHeight = GX_SetDispCopyYScale(yscale);
66 | GX_SetScissor(0,0,rmode->fbWidth,rmode->efbHeight);
67 | GX_SetDispCopySrc(0,0,rmode->fbWidth,rmode->efbHeight);
68 | GX_SetDispCopyDst(rmode->fbWidth,xfbHeight);
69 | GX_SetCopyFilter(rmode->aa,rmode->sample_pattern,GX_TRUE,rmode->vfilter);
70 | GX_SetFieldMode(rmode->field_rendering,((rmode->viHeight==2*rmode->xfbHeight)?GX_ENABLE:GX_DISABLE));
71 |
72 | GX_SetCullMode(GX_CULL_NONE);
73 | GX_CopyDisp(frameBuffer[fb],GX_TRUE);
74 | GX_SetDispCopyGamma(GX_GM_1_0);
75 |
76 |
77 | // setup the vertex descriptor
78 | // tells the flipper to expect direct data
79 | GX_ClearVtxDesc();
80 | GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
81 |
82 | // setup the vertex attribute table
83 | // describes the data
84 | // args: vat location 0-7, type of data, data format, size, scale
85 | // so for ex. in the first call we are sending position data with
86 | // 3 values X,Y,Z of size F32. scale sets the number of fractional
87 | // bits for non float data.
88 | GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
89 |
90 | GX_SetNumChans(1);
91 | GX_SetNumTexGens(0);
92 | GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR0A0);
93 | GX_SetTevColor(GX_TEVREG1, (GXColor){ 0xFF, 0xFF, 0xFF, 0 });
94 | GX_SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C1);
95 | GX_SetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
96 | GX_SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A1);
97 | GX_SetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
98 |
99 | // setup our camera at the origin
100 | // looking down the -z axis with y up
101 | guVector cam = {0.0F, 0.0F, 0.0F},
102 | up = {0.0F, 1.0F, 0.0F},
103 | look = {0.0F, 0.0F, -1.0F};
104 |
105 | guLookAt(view, &cam, &up, &look);
106 |
107 |
108 | // setup our projection matrix
109 | // this creates a perspective matrix with a view angle of 90,
110 | // and aspect ratio based on the display resolution
111 | f32 w = rmode->viWidth;
112 | f32 h = rmode->viHeight;
113 | guPerspective(perspective, 45, (f32)w/h, 0.1F, 300.0F);
114 | GX_LoadProjectionMtx(perspective, GX_PERSPECTIVE);
115 |
116 | while(1) {
117 |
118 | WPAD_ScanPads();
119 |
120 | if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
121 |
122 | // do this before drawing
123 | GX_SetViewport(0,0,rmode->fbWidth,rmode->efbHeight,0,1);
124 |
125 | guMtxIdentity(model);
126 | guMtxTransApply(model, model, -1.5f,0.0f,-6.0f);
127 | guMtxConcat(view,model,modelview);
128 | // load the modelview matrix into matrix memory
129 | GX_LoadPosMtxImm(modelview, GX_PNMTX0);
130 |
131 | GX_Begin(GX_TRIANGLES, GX_VTXFMT0, 3);
132 | GX_Position3f32( 0.0f, 1.0f, 0.0f); // Top
133 | GX_Position3f32(-1.0f,-1.0f, 0.0f); // Bottom Left
134 | GX_Position3f32( 1.0f,-1.0f, 0.0f); // Bottom Right
135 | GX_End();
136 |
137 | guMtxTransApply(model, model, 3.0f,0.0f,0.0f);
138 | guMtxConcat(view,model,modelview);
139 | // load the modelview matrix into matrix memory
140 | GX_LoadPosMtxImm(modelview, GX_PNMTX0);
141 |
142 | GX_Begin(GX_QUADS, GX_VTXFMT0, 4); // Draw A Quad
143 | GX_Position3f32(-1.0f, 1.0f, 0.0f); // Top Left
144 | GX_Position3f32( 1.0f, 1.0f, 0.0f); // Top Right
145 | GX_Position3f32( 1.0f,-1.0f, 0.0f); // Bottom Right
146 | GX_Position3f32(-1.0f,-1.0f, 0.0f); // Bottom Left
147 | GX_End(); // Done Drawing The Quad
148 |
149 | // do this stuff after drawing
150 | GX_DrawDone();
151 |
152 | fb ^= 1; // flip framebuffer
153 | GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
154 | GX_SetColorUpdate(GX_TRUE);
155 | GX_CopyDisp(frameBuffer[fb],GX_TRUE);
156 |
157 | VIDEO_SetNextFramebuffer(frameBuffer[fb]);
158 |
159 | VIDEO_Flush();
160 |
161 | VIDEO_WaitVSync();
162 |
163 |
164 | }
165 | return 0;
166 | }
167 |
168 |
--------------------------------------------------------------------------------
/devices/network/udptest/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # any extra libraries we wish to link with the project
35 | #---------------------------------------------------------------------------------
36 | LIBS := -lwiiuse -lbte -logc -lm
37 |
38 | #---------------------------------------------------------------------------------
39 | # list of directories containing libraries, this must be the top level containing
40 | # include and lib
41 | #---------------------------------------------------------------------------------
42 | LIBDIRS :=
43 |
44 | #---------------------------------------------------------------------------------
45 | # no real need to edit anything past this point unless you need to add additional
46 | # rules for different file extensions
47 | #---------------------------------------------------------------------------------
48 | ifneq ($(BUILD),$(notdir $(CURDIR)))
49 | #---------------------------------------------------------------------------------
50 |
51 | export OUTPUT := $(CURDIR)/$(TARGET)
52 |
53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
55 |
56 | export DEPSDIR := $(CURDIR)/$(BUILD)
57 |
58 | #---------------------------------------------------------------------------------
59 | # automatically build a list of object files for our project
60 | #---------------------------------------------------------------------------------
61 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
62 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
63 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
64 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
65 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
66 |
67 | #---------------------------------------------------------------------------------
68 | # use CXX for linking C++ projects, CC for standard C
69 | #---------------------------------------------------------------------------------
70 | ifeq ($(strip $(CPPFILES)),)
71 | export LD := $(CC)
72 | else
73 | export LD := $(CXX)
74 | endif
75 |
76 | export OFILES := $(addsuffix .o,$(BINFILES)) \
77 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
78 | $(sFILES:.s=.o) $(SFILES:.S=.o)
79 |
80 | #---------------------------------------------------------------------------------
81 | # build a list of include paths
82 | #---------------------------------------------------------------------------------
83 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
84 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
85 | -I$(CURDIR)/$(BUILD) \
86 | -I$(LIBOGC_INC)
87 |
88 | #---------------------------------------------------------------------------------
89 | # build a list of library paths
90 | #---------------------------------------------------------------------------------
91 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
92 | -L$(LIBOGC_LIB)
93 |
94 | export OUTPUT := $(CURDIR)/$(TARGET)
95 | .PHONY: $(BUILD) clean
96 |
97 | #---------------------------------------------------------------------------------
98 | $(BUILD):
99 | @[ -d $@ ] || mkdir -p $@
100 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
101 |
102 | #---------------------------------------------------------------------------------
103 | clean:
104 | @echo clean ...
105 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
106 |
107 | #---------------------------------------------------------------------------------
108 | run:
109 | wiiload $(TARGET).dol
110 |
111 |
112 | #---------------------------------------------------------------------------------
113 | else
114 |
115 | DEPENDS := $(OFILES:.o=.d)
116 |
117 | #---------------------------------------------------------------------------------
118 | # main targets
119 | #---------------------------------------------------------------------------------
120 | $(OUTPUT).dol: $(OUTPUT).elf
121 | $(OUTPUT).elf: $(OFILES)
122 |
123 | #---------------------------------------------------------------------------------
124 | # This rule links in binary data with the .jpg extension
125 | #---------------------------------------------------------------------------------
126 | %.jpg.o : %.jpg
127 | #---------------------------------------------------------------------------------
128 | @echo $(notdir $<)
129 | $(bin2o)
130 |
131 | -include $(DEPENDS)
132 |
133 | #---------------------------------------------------------------------------------
134 | endif
135 | #---------------------------------------------------------------------------------
136 |
--------------------------------------------------------------------------------
/devices/network/sockettest/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # any extra libraries we wish to link with the project
35 | #---------------------------------------------------------------------------------
36 | LIBS := -lwiiuse -lbte -logc -lm
37 |
38 | #---------------------------------------------------------------------------------
39 | # list of directories containing libraries, this must be the top level containing
40 | # include and lib
41 | #---------------------------------------------------------------------------------
42 | LIBDIRS :=
43 |
44 | #---------------------------------------------------------------------------------
45 | # no real need to edit anything past this point unless you need to add additional
46 | # rules for different file extensions
47 | #---------------------------------------------------------------------------------
48 | ifneq ($(BUILD),$(notdir $(CURDIR)))
49 | #---------------------------------------------------------------------------------
50 |
51 | export OUTPUT := $(CURDIR)/$(TARGET)
52 |
53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
55 |
56 | export DEPSDIR := $(CURDIR)/$(BUILD)
57 |
58 | #---------------------------------------------------------------------------------
59 | # automatically build a list of object files for our project
60 | #---------------------------------------------------------------------------------
61 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
62 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
63 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
64 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
65 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
66 |
67 | #---------------------------------------------------------------------------------
68 | # use CXX for linking C++ projects, CC for standard C
69 | #---------------------------------------------------------------------------------
70 | ifeq ($(strip $(CPPFILES)),)
71 | export LD := $(CC)
72 | else
73 | export LD := $(CXX)
74 | endif
75 |
76 | export OFILES := $(addsuffix .o,$(BINFILES)) \
77 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
78 | $(sFILES:.s=.o) $(SFILES:.S=.o)
79 |
80 | #---------------------------------------------------------------------------------
81 | # build a list of include paths
82 | #---------------------------------------------------------------------------------
83 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
84 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
85 | -I$(CURDIR)/$(BUILD) \
86 | -I$(LIBOGC_INC)
87 |
88 | #---------------------------------------------------------------------------------
89 | # build a list of library paths
90 | #---------------------------------------------------------------------------------
91 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
92 | -L$(LIBOGC_LIB)
93 |
94 | export OUTPUT := $(CURDIR)/$(TARGET)
95 | .PHONY: $(BUILD) clean
96 |
97 | #---------------------------------------------------------------------------------
98 | $(BUILD):
99 | @[ -d $@ ] || mkdir -p $@
100 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
101 |
102 | #---------------------------------------------------------------------------------
103 | clean:
104 | @echo clean ...
105 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
106 |
107 | #---------------------------------------------------------------------------------
108 | run:
109 | wiiload $(TARGET).dol
110 |
111 |
112 | #---------------------------------------------------------------------------------
113 | else
114 |
115 | DEPENDS := $(OFILES:.o=.d)
116 |
117 | #---------------------------------------------------------------------------------
118 | # main targets
119 | #---------------------------------------------------------------------------------
120 | $(OUTPUT).dol: $(OUTPUT).elf
121 | $(OUTPUT).elf: $(OFILES)
122 |
123 | #---------------------------------------------------------------------------------
124 | # This rule links in binary data with the .jpg extension
125 | #---------------------------------------------------------------------------------
126 | %.jpg.o : %.jpg
127 | #---------------------------------------------------------------------------------
128 | @echo $(notdir $<)
129 | $(bin2o)
130 |
131 | -include $(DEPENDS)
132 |
133 | #---------------------------------------------------------------------------------
134 | endif
135 | #---------------------------------------------------------------------------------
136 |
--------------------------------------------------------------------------------
/filesystem/directory/sd/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # any extra libraries we wish to link with the project
35 | #---------------------------------------------------------------------------------
36 | LIBS := -lwiiuse -lbte -lfat -logc -lm
37 |
38 | #---------------------------------------------------------------------------------
39 | # list of directories containing libraries, this must be the top level containing
40 | # include and lib
41 | #---------------------------------------------------------------------------------
42 | LIBDIRS :=
43 |
44 | #---------------------------------------------------------------------------------
45 | # no real need to edit anything past this point unless you need to add additional
46 | # rules for different file extensions
47 | #---------------------------------------------------------------------------------
48 | ifneq ($(BUILD),$(notdir $(CURDIR)))
49 | #---------------------------------------------------------------------------------
50 |
51 | export OUTPUT := $(CURDIR)/$(TARGET)
52 |
53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
55 |
56 | export DEPSDIR := $(CURDIR)/$(BUILD)
57 |
58 | #---------------------------------------------------------------------------------
59 | # automatically build a list of object files for our project
60 | #---------------------------------------------------------------------------------
61 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
62 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
63 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
64 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
65 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
66 |
67 | #---------------------------------------------------------------------------------
68 | # use CXX for linking C++ projects, CC for standard C
69 | #---------------------------------------------------------------------------------
70 | ifeq ($(strip $(CPPFILES)),)
71 | export LD := $(CC)
72 | else
73 | export LD := $(CXX)
74 | endif
75 |
76 | export OFILES := $(addsuffix .o,$(BINFILES)) \
77 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
78 | $(sFILES:.s=.o) $(SFILES:.S=.o)
79 |
80 | #---------------------------------------------------------------------------------
81 | # build a list of include paths
82 | #---------------------------------------------------------------------------------
83 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
84 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
85 | -I$(CURDIR)/$(BUILD) \
86 | -I$(LIBOGC_INC)
87 |
88 | #---------------------------------------------------------------------------------
89 | # build a list of library paths
90 | #---------------------------------------------------------------------------------
91 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
92 | -L$(LIBOGC_LIB)
93 |
94 | export OUTPUT := $(CURDIR)/$(TARGET)
95 | .PHONY: $(BUILD) clean
96 |
97 | #---------------------------------------------------------------------------------
98 | $(BUILD):
99 | @[ -d $@ ] || mkdir -p $@
100 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
101 |
102 | #---------------------------------------------------------------------------------
103 | clean:
104 | @echo clean ...
105 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
106 |
107 | #---------------------------------------------------------------------------------
108 | run:
109 | wiiload $(TARGET).dol
110 |
111 |
112 | #---------------------------------------------------------------------------------
113 | else
114 |
115 | DEPENDS := $(OFILES:.o=.d)
116 |
117 | #---------------------------------------------------------------------------------
118 | # main targets
119 | #---------------------------------------------------------------------------------
120 | $(OUTPUT).dol: $(OUTPUT).elf
121 | $(OUTPUT).elf: $(OFILES)
122 |
123 | #---------------------------------------------------------------------------------
124 | # This rule links in binary data with the .jpg extension
125 | #---------------------------------------------------------------------------------
126 | %.jpg.o : %.jpg
127 | #---------------------------------------------------------------------------------
128 | @echo $(notdir $<)
129 | $(bin2o)
130 |
131 | -include $(DEPENDS)
132 |
133 | #---------------------------------------------------------------------------------
134 | endif
135 | #---------------------------------------------------------------------------------
136 |
--------------------------------------------------------------------------------
/devices/usbkeyboard/basic_stdin/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # any extra libraries we wish to link with the project
35 | #---------------------------------------------------------------------------------
36 | LIBS := -lwiikeyboard -lwiiuse -lbte -logc -lm
37 |
38 | #---------------------------------------------------------------------------------
39 | # list of directories containing libraries, this must be the top level containing
40 | # include and lib
41 | #---------------------------------------------------------------------------------
42 | LIBDIRS :=
43 |
44 | #---------------------------------------------------------------------------------
45 | # no real need to edit anything past this point unless you need to add additional
46 | # rules for different file extensions
47 | #---------------------------------------------------------------------------------
48 | ifneq ($(BUILD),$(notdir $(CURDIR)))
49 | #---------------------------------------------------------------------------------
50 |
51 | export OUTPUT := $(CURDIR)/$(TARGET)
52 |
53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
55 |
56 | export DEPSDIR := $(CURDIR)/$(BUILD)
57 |
58 | #---------------------------------------------------------------------------------
59 | # automatically build a list of object files for our project
60 | #---------------------------------------------------------------------------------
61 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
62 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
63 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
64 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
65 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
66 |
67 | #---------------------------------------------------------------------------------
68 | # use CXX for linking C++ projects, CC for standard C
69 | #---------------------------------------------------------------------------------
70 | ifeq ($(strip $(CPPFILES)),)
71 | export LD := $(CC)
72 | else
73 | export LD := $(CXX)
74 | endif
75 |
76 | export OFILES := $(addsuffix .o,$(BINFILES)) \
77 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
78 | $(sFILES:.s=.o) $(SFILES:.S=.o)
79 |
80 | #---------------------------------------------------------------------------------
81 | # build a list of include paths
82 | #---------------------------------------------------------------------------------
83 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
84 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
85 | -I$(CURDIR)/$(BUILD) \
86 | -I$(LIBOGC_INC)
87 |
88 | #---------------------------------------------------------------------------------
89 | # build a list of library paths
90 | #---------------------------------------------------------------------------------
91 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
92 | -L$(LIBOGC_LIB)
93 |
94 | export OUTPUT := $(CURDIR)/$(TARGET)
95 | .PHONY: $(BUILD) clean
96 |
97 | #---------------------------------------------------------------------------------
98 | $(BUILD):
99 | @[ -d $@ ] || mkdir -p $@
100 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
101 |
102 | #---------------------------------------------------------------------------------
103 | clean:
104 | @echo clean ...
105 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
106 |
107 | #---------------------------------------------------------------------------------
108 | run:
109 | wiiload $(TARGET).dol
110 |
111 |
112 | #---------------------------------------------------------------------------------
113 | else
114 |
115 | DEPENDS := $(OFILES:.o=.d)
116 |
117 | #---------------------------------------------------------------------------------
118 | # main targets
119 | #---------------------------------------------------------------------------------
120 | $(OUTPUT).dol: $(OUTPUT).elf
121 | $(OUTPUT).elf: $(OFILES)
122 |
123 | #---------------------------------------------------------------------------------
124 | # This rule links in binary data with the .jpg extension
125 | #---------------------------------------------------------------------------------
126 | %.jpg.o : %.jpg
127 | #---------------------------------------------------------------------------------
128 | @echo $(notdir $<)
129 | $(bin2o)
130 |
131 | -include $(DEPENDS)
132 |
133 | #---------------------------------------------------------------------------------
134 | endif
135 | #---------------------------------------------------------------------------------
136 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson03/source/lesson3.c:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------
2 |
3 | nehe lesson 3 port to GX by WinterMute
4 |
5 | ---------------------------------------------------------------------------------*/
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #define DEFAULT_FIFO_SIZE (256*1024)
16 |
17 | static void *frameBuffer[2] = { NULL, NULL};
18 | GXRModeObj *rmode;
19 |
20 | //---------------------------------------------------------------------------------
21 | int main( int argc, char **argv ){
22 | //---------------------------------------------------------------------------------
23 | f32 yscale;
24 |
25 | u32 xfbHeight;
26 |
27 | Mtx view;
28 | Mtx44 perspective;
29 | Mtx model, modelview;
30 |
31 | u32 fb = 0; // initial framebuffer index
32 | GXColor background = {0, 0, 0, 0xff};
33 |
34 |
35 | // init the vi.
36 | VIDEO_Init();
37 | WPAD_Init();
38 |
39 | rmode = VIDEO_GetPreferredMode(NULL);
40 |
41 | // allocate 2 framebuffers for double buffering
42 | frameBuffer[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
43 | frameBuffer[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
44 |
45 | VIDEO_Configure(rmode);
46 | VIDEO_SetNextFramebuffer(frameBuffer[fb]);
47 | VIDEO_SetBlack(false);
48 | VIDEO_Flush();
49 | VIDEO_WaitVSync();
50 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
51 |
52 | // setup the fifo and then init the flipper
53 | void *gp_fifo = NULL;
54 | gp_fifo = memalign(32,DEFAULT_FIFO_SIZE);
55 | memset(gp_fifo,0,DEFAULT_FIFO_SIZE);
56 |
57 | GX_Init(gp_fifo,DEFAULT_FIFO_SIZE);
58 |
59 | // clears the bg to color and clears the z buffer
60 | GX_SetCopyClear(background, 0x00ffffff);
61 |
62 | // other gx setup
63 | GX_SetViewport(0,0,rmode->fbWidth,rmode->efbHeight,0,1);
64 | yscale = GX_GetYScaleFactor(rmode->efbHeight,rmode->xfbHeight);
65 | xfbHeight = GX_SetDispCopyYScale(yscale);
66 | GX_SetScissor(0,0,rmode->fbWidth,rmode->efbHeight);
67 | GX_SetDispCopySrc(0,0,rmode->fbWidth,rmode->efbHeight);
68 | GX_SetDispCopyDst(rmode->fbWidth,xfbHeight);
69 | GX_SetCopyFilter(rmode->aa,rmode->sample_pattern,GX_TRUE,rmode->vfilter);
70 | GX_SetFieldMode(rmode->field_rendering,((rmode->viHeight==2*rmode->xfbHeight)?GX_ENABLE:GX_DISABLE));
71 |
72 | GX_SetCullMode(GX_CULL_NONE);
73 | GX_CopyDisp(frameBuffer[fb],GX_TRUE);
74 | GX_SetDispCopyGamma(GX_GM_1_0);
75 |
76 |
77 | // setup the vertex descriptor
78 | // tells the flipper to expect direct data
79 | GX_ClearVtxDesc();
80 | GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
81 | GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
82 |
83 | // setup the vertex attribute table
84 | // describes the data
85 | // args: vat location 0-7, type of data, data format, size, scale
86 | // so for ex. in the first call we are sending position data with
87 | // 3 values X,Y,Z of size F32. scale sets the number of fractional
88 | // bits for non float data.
89 | GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
90 | GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGB8, 0);
91 |
92 | GX_SetNumChans(1);
93 | GX_SetNumTexGens(0);
94 | GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR0A0);
95 | GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
96 |
97 | // setup our camera at the origin
98 | // looking down the -z axis with y up
99 | guVector cam = {0.0F, 0.0F, 0.0F},
100 | up = {0.0F, 1.0F, 0.0F},
101 | look = {0.0F, 0.0F, -1.0F};
102 | guLookAt(view, &cam, &up, &look);
103 |
104 |
105 | // setup our projection matrix
106 | // this creates a perspective matrix with a view angle of 90,
107 | // and aspect ratio based on the display resolution
108 | f32 w = rmode->viWidth;
109 | f32 h = rmode->viHeight;
110 | guPerspective(perspective, 45, (f32)w/h, 0.1F, 300.0F);
111 | GX_LoadProjectionMtx(perspective, GX_PERSPECTIVE);
112 |
113 | while(1) {
114 |
115 | WPAD_ScanPads();
116 |
117 | if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
118 |
119 | // do this before drawing
120 | GX_SetViewport(0,0,rmode->fbWidth,rmode->efbHeight,0,1);
121 |
122 | guMtxIdentity(model);
123 | guMtxTransApply(model, model, -1.5f,0.0f,-6.0f);
124 | guMtxConcat(view,model,modelview);
125 | // load the modelview matrix into matrix memory
126 | GX_LoadPosMtxImm(modelview, GX_PNMTX0);
127 |
128 | GX_Begin(GX_TRIANGLES, GX_VTXFMT0, 3);
129 | GX_Position3f32( 0.0f, 1.0f, 0.0f); // Top
130 | GX_Color3f32(1.0f,0.0f,0.0f); // Set The Color To Red
131 | GX_Position3f32(-1.0f,-1.0f, 0.0f); // Bottom Left
132 | GX_Color3f32(0.0f,1.0f,0.0f); // Set The Color To Green
133 | GX_Position3f32( 1.0f,-1.0f, 0.0f); // Bottom Right
134 | GX_Color3f32(0.0f,0.0f,1.0f); // Set The Color To Blue
135 | GX_End();
136 |
137 | guMtxTransApply(model, model, 3.0f,0.0f,0.0f);
138 | guMtxConcat(view,model,modelview);
139 | // load the modelview matrix into matrix memory
140 | GX_LoadPosMtxImm(modelview, GX_PNMTX0);
141 |
142 | GX_Begin(GX_QUADS, GX_VTXFMT0, 4); // Draw A Quad
143 | GX_Position3f32(-1.0f, 1.0f, 0.0f); // Top Left
144 | GX_Color3f32(0.5f,0.5f,1.0f); // Set The Color To Blue
145 | GX_Position3f32( 1.0f, 1.0f, 0.0f); // Top Right
146 | GX_Color3f32(0.5f,0.5f,1.0f); // Set The Color To Blue
147 | GX_Position3f32( 1.0f,-1.0f, 0.0f); // Bottom Right
148 | GX_Color3f32(0.5f,0.5f,1.0f); // Set The Color To Blue
149 | GX_Position3f32(-1.0f,-1.0f, 0.0f); // Bottom Left
150 | GX_Color3f32(0.5f,0.5f,1.0f); // Set The Color To Blue
151 | GX_End(); // Done Drawing The Quad
152 |
153 | // do this stuff after drawing
154 | GX_DrawDone();
155 |
156 | fb ^= 1; // flip framebuffer
157 | GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
158 | GX_SetColorUpdate(GX_TRUE);
159 | GX_CopyDisp(frameBuffer[fb],GX_TRUE);
160 |
161 | VIDEO_SetNextFramebuffer(frameBuffer[fb]);
162 |
163 | VIDEO_Flush();
164 |
165 | VIDEO_WaitVSync();
166 |
167 |
168 | }
169 | return 0;
170 | }
171 |
172 |
--------------------------------------------------------------------------------
/crypto/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # any extra libraries we wish to link with the project
35 | #---------------------------------------------------------------------------------
36 | LIBS := -lwiiuse -lbte -logc -lm
37 |
38 | #---------------------------------------------------------------------------------
39 | # list of directories containing libraries, this must be the top level containing
40 | # include and lib
41 | #---------------------------------------------------------------------------------
42 | LIBDIRS :=
43 |
44 | #---------------------------------------------------------------------------------
45 | # no real need to edit anything past this point unless you need to add additional
46 | # rules for different file extensions
47 | #---------------------------------------------------------------------------------
48 | ifneq ($(BUILD),$(notdir $(CURDIR)))
49 | #---------------------------------------------------------------------------------
50 |
51 | export OUTPUT := $(CURDIR)/$(TARGET)
52 |
53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
55 |
56 | export DEPSDIR := $(CURDIR)/$(BUILD)
57 |
58 | #---------------------------------------------------------------------------------
59 | # automatically build a list of object files for our project
60 | #---------------------------------------------------------------------------------
61 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
62 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
63 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
64 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
65 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
66 |
67 | #---------------------------------------------------------------------------------
68 | # use CXX for linking C++ projects, CC for standard C
69 | #---------------------------------------------------------------------------------
70 | ifeq ($(strip $(CPPFILES)),)
71 | export LD := $(CC)
72 | else
73 | export LD := $(CXX)
74 | endif
75 |
76 | export OFILES_BIN := $(addsuffix .o,$(BINFILES))
77 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
78 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
79 |
80 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
81 |
82 | #---------------------------------------------------------------------------------
83 | # build a list of include paths
84 | #---------------------------------------------------------------------------------
85 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
86 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
87 | -I$(CURDIR)/$(BUILD) \
88 | -I$(LIBOGC_INC)
89 |
90 | #---------------------------------------------------------------------------------
91 | # build a list of library paths
92 | #---------------------------------------------------------------------------------
93 | export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
94 |
95 | export OUTPUT := $(CURDIR)/$(TARGET)
96 | .PHONY: $(BUILD) clean
97 |
98 | #---------------------------------------------------------------------------------
99 | $(BUILD):
100 | @[ -d $@ ] || mkdir -p $@
101 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
102 |
103 | #---------------------------------------------------------------------------------
104 | clean:
105 | @echo clean ...
106 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
107 |
108 | #---------------------------------------------------------------------------------
109 | run:
110 | wiiload $(TARGET).dol
111 |
112 |
113 | #---------------------------------------------------------------------------------
114 | else
115 |
116 | DEPENDS := $(OFILES:.o=.d)
117 |
118 | #---------------------------------------------------------------------------------
119 | # main targets
120 | #---------------------------------------------------------------------------------
121 | $(OUTPUT).dol: $(OUTPUT).elf
122 | $(OUTPUT).elf: $(OFILES)
123 |
124 | $(OFILES_SOURCES) : $(HFILES)
125 |
126 | #---------------------------------------------------------------------------------
127 | # This rule links in binary data with the .jpg extension
128 | #---------------------------------------------------------------------------------
129 | %.jpg.o %_jpg.h : %.jpg
130 | #---------------------------------------------------------------------------------
131 | @echo $(notdir $<)
132 | $(bin2o)
133 |
134 | -include $(DEPENDS)
135 |
136 | #---------------------------------------------------------------------------------
137 | endif
138 | #---------------------------------------------------------------------------------
139 |
--------------------------------------------------------------------------------
/threading/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # any extra libraries we wish to link with the project
35 | #---------------------------------------------------------------------------------
36 | LIBS := -lwiiuse -lbte -logc -lm
37 |
38 | #---------------------------------------------------------------------------------
39 | # list of directories containing libraries, this must be the top level containing
40 | # include and lib
41 | #---------------------------------------------------------------------------------
42 | LIBDIRS :=
43 |
44 | #---------------------------------------------------------------------------------
45 | # no real need to edit anything past this point unless you need to add additional
46 | # rules for different file extensions
47 | #---------------------------------------------------------------------------------
48 | ifneq ($(BUILD),$(notdir $(CURDIR)))
49 | #---------------------------------------------------------------------------------
50 |
51 | export OUTPUT := $(CURDIR)/$(TARGET)
52 |
53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
55 |
56 | export DEPSDIR := $(CURDIR)/$(BUILD)
57 |
58 | #---------------------------------------------------------------------------------
59 | # automatically build a list of object files for our project
60 | #---------------------------------------------------------------------------------
61 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
62 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
63 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
64 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
65 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
66 |
67 | #---------------------------------------------------------------------------------
68 | # use CXX for linking C++ projects, CC for standard C
69 | #---------------------------------------------------------------------------------
70 | ifeq ($(strip $(CPPFILES)),)
71 | export LD := $(CC)
72 | else
73 | export LD := $(CXX)
74 | endif
75 |
76 | export OFILES_BIN := $(addsuffix .o,$(BINFILES))
77 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
78 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
79 |
80 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
81 |
82 | #---------------------------------------------------------------------------------
83 | # build a list of include paths
84 | #---------------------------------------------------------------------------------
85 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
86 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
87 | -I$(CURDIR)/$(BUILD) \
88 | -I$(LIBOGC_INC)
89 |
90 | #---------------------------------------------------------------------------------
91 | # build a list of library paths
92 | #---------------------------------------------------------------------------------
93 | export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
94 |
95 | export OUTPUT := $(CURDIR)/$(TARGET)
96 | .PHONY: $(BUILD) clean
97 |
98 | #---------------------------------------------------------------------------------
99 | $(BUILD):
100 | @[ -d $@ ] || mkdir -p $@
101 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
102 |
103 | #---------------------------------------------------------------------------------
104 | clean:
105 | @echo clean ...
106 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
107 |
108 | #---------------------------------------------------------------------------------
109 | run:
110 | wiiload $(TARGET).dol
111 |
112 |
113 | #---------------------------------------------------------------------------------
114 | else
115 |
116 | DEPENDS := $(OFILES:.o=.d)
117 |
118 | #---------------------------------------------------------------------------------
119 | # main targets
120 | #---------------------------------------------------------------------------------
121 | $(OUTPUT).dol: $(OUTPUT).elf
122 | $(OUTPUT).elf: $(OFILES)
123 |
124 | $(OFILES_SOURCES) : $(HFILES)
125 |
126 | #---------------------------------------------------------------------------------
127 | # This rule links in binary data with the .jpg extension
128 | #---------------------------------------------------------------------------------
129 | %.jpg.o %_jpg.h : %.jpg
130 | #---------------------------------------------------------------------------------
131 | @echo $(notdir $<)
132 | $(bin2o)
133 |
134 | -include $(DEPENDS)
135 |
136 | #---------------------------------------------------------------------------------
137 | endif
138 | #---------------------------------------------------------------------------------
139 |
--------------------------------------------------------------------------------
/devices/wiimote/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # any extra libraries we wish to link with the project
35 | #---------------------------------------------------------------------------------
36 | LIBS := -lwiiuse -lbte -logc -lm
37 |
38 | #---------------------------------------------------------------------------------
39 | # list of directories containing libraries, this must be the top level containing
40 | # include and lib
41 | #---------------------------------------------------------------------------------
42 | LIBDIRS :=
43 |
44 | #---------------------------------------------------------------------------------
45 | # no real need to edit anything past this point unless you need to add additional
46 | # rules for different file extensions
47 | #---------------------------------------------------------------------------------
48 | ifneq ($(BUILD),$(notdir $(CURDIR)))
49 | #---------------------------------------------------------------------------------
50 |
51 | export OUTPUT := $(CURDIR)/$(TARGET)
52 |
53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
55 |
56 | export DEPSDIR := $(CURDIR)/$(BUILD)
57 |
58 | #---------------------------------------------------------------------------------
59 | # automatically build a list of object files for our project
60 | #---------------------------------------------------------------------------------
61 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
62 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
63 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
64 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
65 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
66 |
67 | #---------------------------------------------------------------------------------
68 | # use CXX for linking C++ projects, CC for standard C
69 | #---------------------------------------------------------------------------------
70 | ifeq ($(strip $(CPPFILES)),)
71 | export LD := $(CC)
72 | else
73 | export LD := $(CXX)
74 | endif
75 |
76 | export OFILES_BIN := $(addsuffix .o,$(BINFILES))
77 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
78 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
79 |
80 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
81 |
82 | #---------------------------------------------------------------------------------
83 | # build a list of include paths
84 | #---------------------------------------------------------------------------------
85 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
86 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
87 | -I$(CURDIR)/$(BUILD) \
88 | -I$(LIBOGC_INC)
89 |
90 | #---------------------------------------------------------------------------------
91 | # build a list of library paths
92 | #---------------------------------------------------------------------------------
93 | export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
94 |
95 | export OUTPUT := $(CURDIR)/$(TARGET)
96 | .PHONY: $(BUILD) clean
97 |
98 | #---------------------------------------------------------------------------------
99 | $(BUILD):
100 | @[ -d $@ ] || mkdir -p $@
101 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
102 |
103 | #---------------------------------------------------------------------------------
104 | clean:
105 | @echo clean ...
106 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
107 |
108 | #---------------------------------------------------------------------------------
109 | run:
110 | wiiload $(TARGET).dol
111 |
112 |
113 | #---------------------------------------------------------------------------------
114 | else
115 |
116 | DEPENDS := $(OFILES:.o=.d)
117 |
118 | #---------------------------------------------------------------------------------
119 | # main targets
120 | #---------------------------------------------------------------------------------
121 | $(OUTPUT).dol: $(OUTPUT).elf
122 | $(OUTPUT).elf: $(OFILES)
123 |
124 | $(OFILES_SOURCES) : $(HFILES)
125 |
126 | #---------------------------------------------------------------------------------
127 | # This rule links in binary data with the .jpg extension
128 | #---------------------------------------------------------------------------------
129 | %.jpg.o %_jpg.h : %.jpg
130 | #---------------------------------------------------------------------------------
131 | @echo $(notdir $<)
132 | $(bin2o)
133 |
134 | -include $(DEPENDS)
135 |
136 | #---------------------------------------------------------------------------------
137 | endif
138 | #---------------------------------------------------------------------------------
139 |
--------------------------------------------------------------------------------
/filesystem/directory/isfs/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
28 | CXXFLAGS = $(CFLAGS)
29 |
30 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
31 |
32 | #---------------------------------------------------------------------------------
33 | # any extra libraries we wish to link with the project
34 | #---------------------------------------------------------------------------------
35 | LIBS := -lwiiuse -lbte -logc -lm
36 |
37 | #---------------------------------------------------------------------------------
38 | # list of directories containing libraries, this must be the top level containing
39 | # include and lib
40 | #---------------------------------------------------------------------------------
41 | LIBDIRS :=
42 |
43 | #---------------------------------------------------------------------------------
44 | # no real need to edit anything past this point unless you need to add additional
45 | # rules for different file extensions
46 | #---------------------------------------------------------------------------------
47 | ifneq ($(BUILD),$(notdir $(CURDIR)))
48 | #---------------------------------------------------------------------------------
49 |
50 | export OUTPUT := $(CURDIR)/$(TARGET)
51 |
52 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
53 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
54 |
55 | export DEPSDIR := $(CURDIR)/$(BUILD)
56 |
57 | #---------------------------------------------------------------------------------
58 | # automatically build a list of object files for our project
59 | #---------------------------------------------------------------------------------
60 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
61 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
62 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
63 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
64 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
65 |
66 | #---------------------------------------------------------------------------------
67 | # use CXX for linking C++ projects, CC for standard C
68 | #---------------------------------------------------------------------------------
69 | ifeq ($(strip $(CPPFILES)),)
70 | export LD := $(CC)
71 | else
72 | export LD := $(CXX)
73 | endif
74 |
75 | export OFILES_BIN := $(addsuffix .o,$(BINFILES))
76 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
77 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
78 |
79 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
80 |
81 | #---------------------------------------------------------------------------------
82 | # build a list of include paths
83 | #---------------------------------------------------------------------------------
84 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
85 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
86 | -I$(CURDIR)/$(BUILD) \
87 | -I$(LIBOGC_INC)
88 |
89 | #---------------------------------------------------------------------------------
90 | # build a list of library paths
91 | #---------------------------------------------------------------------------------
92 | export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
93 |
94 | export OUTPUT := $(CURDIR)/$(TARGET)
95 | .PHONY: $(BUILD) clean
96 |
97 | #---------------------------------------------------------------------------------
98 | $(BUILD):
99 | @[ -d $@ ] || mkdir -p $@
100 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
101 |
102 | #---------------------------------------------------------------------------------
103 | clean:
104 | @echo clean ...
105 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
106 |
107 | #---------------------------------------------------------------------------------
108 | run:
109 | wiiload $(TARGET).dol
110 |
111 |
112 | #---------------------------------------------------------------------------------
113 | else
114 |
115 | DEPENDS := $(OFILES:.o=.d)
116 |
117 | #---------------------------------------------------------------------------------
118 | # main targets
119 | #---------------------------------------------------------------------------------
120 | $(OUTPUT).dol: $(OUTPUT).elf
121 | $(OUTPUT).elf: $(OFILES)
122 |
123 | $(OFILES_SOURCES) : $(HFILES)
124 |
125 | #---------------------------------------------------------------------------------
126 | # This rule links in binary data with the .jpg extension
127 | #---------------------------------------------------------------------------------
128 | %.jpg.o %_jpg.h : %.jpg
129 | #---------------------------------------------------------------------------------
130 | @echo $(notdir $<)
131 | $(bin2o)
132 |
133 | -include $(DEPENDS)
134 |
135 | #---------------------------------------------------------------------------------
136 | endif
137 | #---------------------------------------------------------------------------------
138 |
--------------------------------------------------------------------------------
/graphics/gx/romfont/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # any extra libraries we wish to link with the project
35 | #---------------------------------------------------------------------------------
36 | LIBS := -lwiiuse -lbte -logc -lm
37 |
38 | #---------------------------------------------------------------------------------
39 | # list of directories containing libraries, this must be the top level containing
40 | # include and lib
41 | #---------------------------------------------------------------------------------
42 | LIBDIRS :=
43 |
44 | #---------------------------------------------------------------------------------
45 | # no real need to edit anything past this point unless you need to add additional
46 | # rules for different file extensions
47 | #---------------------------------------------------------------------------------
48 | ifneq ($(BUILD),$(notdir $(CURDIR)))
49 | #---------------------------------------------------------------------------------
50 |
51 | export OUTPUT := $(CURDIR)/$(TARGET)
52 |
53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
55 |
56 | export DEPSDIR := $(CURDIR)/$(BUILD)
57 |
58 | #---------------------------------------------------------------------------------
59 | # automatically build a list of object files for our project
60 | #---------------------------------------------------------------------------------
61 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
62 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
63 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
64 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
65 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
66 |
67 | #---------------------------------------------------------------------------------
68 | # use CXX for linking C++ projects, CC for standard C
69 | #---------------------------------------------------------------------------------
70 | ifeq ($(strip $(CPPFILES)),)
71 | export LD := $(CC)
72 | else
73 | export LD := $(CXX)
74 | endif
75 |
76 | export OFILES_BIN := $(addsuffix .o,$(BINFILES))
77 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
78 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
79 |
80 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
81 |
82 | #---------------------------------------------------------------------------------
83 | # build a list of include paths
84 | #---------------------------------------------------------------------------------
85 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
86 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
87 | -I$(CURDIR)/$(BUILD) \
88 | -I$(LIBOGC_INC)
89 |
90 | #---------------------------------------------------------------------------------
91 | # build a list of library paths
92 | #---------------------------------------------------------------------------------
93 | export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
94 |
95 | export OUTPUT := $(CURDIR)/$(TARGET)
96 | .PHONY: $(BUILD) clean
97 |
98 | #---------------------------------------------------------------------------------
99 | $(BUILD):
100 | @[ -d $@ ] || mkdir -p $@
101 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
102 |
103 | #---------------------------------------------------------------------------------
104 | clean:
105 | @echo clean ...
106 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
107 |
108 | #---------------------------------------------------------------------------------
109 | run:
110 | wiiload $(TARGET).dol
111 |
112 |
113 | #---------------------------------------------------------------------------------
114 | else
115 |
116 | DEPENDS := $(OFILES:.o=.d)
117 |
118 | #---------------------------------------------------------------------------------
119 | # main targets
120 | #---------------------------------------------------------------------------------
121 | $(OUTPUT).dol: $(OUTPUT).elf
122 | $(OUTPUT).elf: $(OFILES)
123 |
124 | $(OFILES_SOURCES) : $(HFILES)
125 |
126 | #---------------------------------------------------------------------------------
127 | # This rule links in binary data with the .jpg extension
128 | #---------------------------------------------------------------------------------
129 | %.jpg.o %_jpg.h : %.jpg
130 | #---------------------------------------------------------------------------------
131 | @echo $(notdir $<)
132 | $(bin2o)
133 |
134 | -include $(DEPENDS)
135 |
136 | #---------------------------------------------------------------------------------
137 | endif
138 | #---------------------------------------------------------------------------------
139 |
--------------------------------------------------------------------------------
/templates/makefile/application/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # any extra libraries we wish to link with the project
35 | #---------------------------------------------------------------------------------
36 | LIBS := -lwiiuse -lbte -logc -lm
37 |
38 | #---------------------------------------------------------------------------------
39 | # list of directories containing libraries, this must be the top level containing
40 | # include and lib
41 | #---------------------------------------------------------------------------------
42 | LIBDIRS :=
43 |
44 | #---------------------------------------------------------------------------------
45 | # no real need to edit anything past this point unless you need to add additional
46 | # rules for different file extensions
47 | #---------------------------------------------------------------------------------
48 | ifneq ($(BUILD),$(notdir $(CURDIR)))
49 | #---------------------------------------------------------------------------------
50 |
51 | export OUTPUT := $(CURDIR)/$(TARGET)
52 |
53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
55 |
56 | export DEPSDIR := $(CURDIR)/$(BUILD)
57 |
58 | #---------------------------------------------------------------------------------
59 | # automatically build a list of object files for our project
60 | #---------------------------------------------------------------------------------
61 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
62 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
63 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
64 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
65 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
66 |
67 | #---------------------------------------------------------------------------------
68 | # use CXX for linking C++ projects, CC for standard C
69 | #---------------------------------------------------------------------------------
70 | ifeq ($(strip $(CPPFILES)),)
71 | export LD := $(CC)
72 | else
73 | export LD := $(CXX)
74 | endif
75 |
76 | export OFILES_BIN := $(addsuffix .o,$(BINFILES))
77 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
78 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
79 |
80 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
81 |
82 | #---------------------------------------------------------------------------------
83 | # build a list of include paths
84 | #---------------------------------------------------------------------------------
85 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
86 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
87 | -I$(CURDIR)/$(BUILD) \
88 | -I$(LIBOGC_INC)
89 |
90 | #---------------------------------------------------------------------------------
91 | # build a list of library paths
92 | #---------------------------------------------------------------------------------
93 | export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
94 |
95 | export OUTPUT := $(CURDIR)/$(TARGET)
96 | .PHONY: $(BUILD) clean
97 |
98 | #---------------------------------------------------------------------------------
99 | $(BUILD):
100 | @[ -d $@ ] || mkdir -p $@
101 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
102 |
103 | #---------------------------------------------------------------------------------
104 | clean:
105 | @echo clean ...
106 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
107 |
108 | #---------------------------------------------------------------------------------
109 | run:
110 | wiiload $(TARGET).dol
111 |
112 |
113 | #---------------------------------------------------------------------------------
114 | else
115 |
116 | DEPENDS := $(OFILES:.o=.d)
117 |
118 | #---------------------------------------------------------------------------------
119 | # main targets
120 | #---------------------------------------------------------------------------------
121 | $(OUTPUT).dol: $(OUTPUT).elf
122 | $(OUTPUT).elf: $(OFILES)
123 |
124 | $(OFILES_SOURCES) : $(HFILES)
125 |
126 | #---------------------------------------------------------------------------------
127 | # This rule links in binary data with the .jpg extension
128 | #---------------------------------------------------------------------------------
129 | %.jpg.o %_jpg.h : %.jpg
130 | #---------------------------------------------------------------------------------
131 | @echo $(notdir $<)
132 | $(bin2o)
133 |
134 | -include $(DEPENDS)
135 |
136 | #---------------------------------------------------------------------------------
137 | endif
138 | #---------------------------------------------------------------------------------
139 |
--------------------------------------------------------------------------------
/audio/mp3player/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # any extra libraries we wish to link with the project
35 | #---------------------------------------------------------------------------------
36 | LIBS := -lwiiuse -lbte -lmad -lasnd -logc -lm
37 |
38 | #---------------------------------------------------------------------------------
39 | # list of directories containing libraries, this must be the top level containing
40 | # include and lib
41 | #---------------------------------------------------------------------------------
42 | LIBDIRS :=
43 |
44 | #---------------------------------------------------------------------------------
45 | # no real need to edit anything past this point unless you need to add additional
46 | # rules for different file extensions
47 | #---------------------------------------------------------------------------------
48 | ifneq ($(BUILD),$(notdir $(CURDIR)))
49 | #---------------------------------------------------------------------------------
50 |
51 | export OUTPUT := $(CURDIR)/$(TARGET)
52 |
53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
55 |
56 | export DEPSDIR := $(CURDIR)/$(BUILD)
57 |
58 | #---------------------------------------------------------------------------------
59 | # automatically build a list of object files for our project
60 | #---------------------------------------------------------------------------------
61 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
62 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
63 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
64 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
65 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
66 |
67 | #---------------------------------------------------------------------------------
68 | # use CXX for linking C++ projects, CC for standard C
69 | #---------------------------------------------------------------------------------
70 | ifeq ($(strip $(CPPFILES)),)
71 | export LD := $(CC)
72 | else
73 | export LD := $(CXX)
74 | endif
75 |
76 | export OFILES_BIN := $(addsuffix .o,$(BINFILES))
77 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
78 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
79 |
80 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
81 |
82 | #---------------------------------------------------------------------------------
83 | # build a list of include paths
84 | #---------------------------------------------------------------------------------
85 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
86 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
87 | -I$(CURDIR)/$(BUILD) \
88 | -I$(LIBOGC_INC)
89 |
90 | #---------------------------------------------------------------------------------
91 | # build a list of library paths
92 | #---------------------------------------------------------------------------------
93 | export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
94 |
95 | export OUTPUT := $(CURDIR)/$(TARGET)
96 |
97 | .PHONY: $(BUILD) clean
98 |
99 | #---------------------------------------------------------------------------------
100 | $(BUILD):
101 | @[ -d $@ ] || mkdir -p $@
102 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
103 |
104 | #---------------------------------------------------------------------------------
105 | clean:
106 | @echo clean ...
107 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
108 |
109 | #---------------------------------------------------------------------------------
110 | run:
111 | wiiload $(TARGET).dol
112 |
113 |
114 | #---------------------------------------------------------------------------------
115 | else
116 |
117 | DEPENDS := $(OFILES:.o=.d)
118 |
119 | #---------------------------------------------------------------------------------
120 | # main targets
121 | #---------------------------------------------------------------------------------
122 | $(OUTPUT).dol: $(OUTPUT).elf
123 | $(OUTPUT).elf: $(OFILES)
124 |
125 | $(OFILES_SOURCES) : $(HFILES)
126 |
127 | #---------------------------------------------------------------------------------
128 | # This rule links in binary data with the .mp3 extension
129 | #---------------------------------------------------------------------------------
130 | %.mp3.o %_mp3.h : %.mp3
131 | #---------------------------------------------------------------------------------
132 | @echo $(notdir $<)
133 | $(bin2o)
134 |
135 | -include $(DEPENDS)
136 |
137 | #---------------------------------------------------------------------------------
138 | endif
139 | #---------------------------------------------------------------------------------
140 |
--------------------------------------------------------------------------------
/audio/modplay/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # any extra libraries we wish to link with the project
35 | #---------------------------------------------------------------------------------
36 | LIBS := -lwiiuse -lbte -lmodplay -laesnd -logc -lm
37 |
38 | #---------------------------------------------------------------------------------
39 | # list of directories containing libraries, this must be the top level containing
40 | # include and lib
41 | #---------------------------------------------------------------------------------
42 | LIBDIRS :=
43 |
44 | #---------------------------------------------------------------------------------
45 | # no real need to edit anything past this point unless you need to add additional
46 | # rules for different file extensions
47 | #---------------------------------------------------------------------------------
48 | ifneq ($(BUILD),$(notdir $(CURDIR)))
49 | #---------------------------------------------------------------------------------
50 |
51 | export OUTPUT := $(CURDIR)/$(TARGET)
52 |
53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
55 |
56 | export DEPSDIR := $(CURDIR)/$(BUILD)
57 |
58 | #---------------------------------------------------------------------------------
59 | # automatically build a list of object files for our project
60 | #---------------------------------------------------------------------------------
61 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
62 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
63 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
64 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
65 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
66 |
67 | #---------------------------------------------------------------------------------
68 | # use CXX for linking C++ projects, CC for standard C
69 | #---------------------------------------------------------------------------------
70 | ifeq ($(strip $(CPPFILES)),)
71 | export LD := $(CC)
72 | else
73 | export LD := $(CXX)
74 | endif
75 |
76 | export OFILES_BIN := $(addsuffix .o,$(BINFILES))
77 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
78 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
79 |
80 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
81 |
82 |
83 | #---------------------------------------------------------------------------------
84 | # build a list of include paths
85 | #---------------------------------------------------------------------------------
86 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
87 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
88 | -I$(CURDIR)/$(BUILD) \
89 | -I$(LIBOGC_INC)
90 |
91 | #---------------------------------------------------------------------------------
92 | # build a list of library paths
93 | #---------------------------------------------------------------------------------
94 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
95 | -L$(LIBOGC_LIB)
96 |
97 | export OUTPUT := $(CURDIR)/$(TARGET)
98 | .PHONY: $(BUILD) clean
99 |
100 | #---------------------------------------------------------------------------------
101 | $(BUILD):
102 | @[ -d $@ ] || mkdir -p $@
103 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
104 |
105 | #---------------------------------------------------------------------------------
106 | clean:
107 | @echo clean ...
108 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
109 |
110 | #---------------------------------------------------------------------------------
111 | run:
112 | wiiload $(OUTPUT).dol
113 |
114 |
115 | #---------------------------------------------------------------------------------
116 | else
117 |
118 | DEPENDS := $(OFILES:.o=.d)
119 |
120 | #---------------------------------------------------------------------------------
121 | # main targets
122 | #---------------------------------------------------------------------------------
123 | $(OUTPUT).dol: $(OUTPUT).elf
124 | $(OUTPUT).elf: $(OFILES)
125 |
126 | $(OFILES_SOURCES) : $(HFILES)
127 | #---------------------------------------------------------------------------------
128 | # This rule links in binary data with the .mod extension
129 | #---------------------------------------------------------------------------------
130 | %.mod.o %_mod.h : %.mod
131 | #---------------------------------------------------------------------------------
132 | @echo $(notdir $<)
133 | $(bin2o)
134 |
135 | -include $(DEPENDS)
136 |
137 | #---------------------------------------------------------------------------------
138 | endif
139 | #---------------------------------------------------------------------------------
140 |
--------------------------------------------------------------------------------
/devices/usbgecko/gdbstub/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | #---------------------------------------------------------------------------------
6 | ifeq ($(strip $(DEVKITPPC)),)
7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
8 | endif
9 |
10 | include $(DEVKITPPC)/wii_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # INCLUDES is a list of directories containing extra header files
17 | #---------------------------------------------------------------------------------
18 | TARGET := $(notdir $(CURDIR))
19 | BUILD := build
20 | SOURCES := source
21 | DATA := data
22 | INCLUDES :=
23 |
24 | #---------------------------------------------------------------------------------
25 | # options for code generation
26 | #---------------------------------------------------------------------------------
27 |
28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
29 | CXXFLAGS = $(CFLAGS)
30 |
31 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
32 |
33 | #---------------------------------------------------------------------------------
34 | # any extra libraries we wish to link with the project
35 | #---------------------------------------------------------------------------------
36 | LIBS := -ldb -lwiikeyboard -lwiiuse -lbte -logc -lm
37 |
38 | #---------------------------------------------------------------------------------
39 | # list of directories containing libraries, this must be the top level containing
40 | # include and lib
41 | #---------------------------------------------------------------------------------
42 | LIBDIRS :=
43 |
44 | #---------------------------------------------------------------------------------
45 | # no real need to edit anything past this point unless you need to add additional
46 | # rules for different file extensions
47 | #---------------------------------------------------------------------------------
48 | ifneq ($(BUILD),$(notdir $(CURDIR)))
49 | #---------------------------------------------------------------------------------
50 |
51 | export OUTPUT := $(CURDIR)/$(TARGET)
52 |
53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
55 |
56 | export DEPSDIR := $(CURDIR)/$(BUILD)
57 |
58 | #---------------------------------------------------------------------------------
59 | # automatically build a list of object files for our project
60 | #---------------------------------------------------------------------------------
61 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
62 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
63 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
64 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
65 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
66 |
67 | #---------------------------------------------------------------------------------
68 | # use CXX for linking C++ projects, CC for standard C
69 | #---------------------------------------------------------------------------------
70 | ifeq ($(strip $(CPPFILES)),)
71 | export LD := $(CC)
72 | else
73 | export LD := $(CXX)
74 | endif
75 |
76 | export OFILES := $(addsuffix .o,$(BINFILES)) \
77 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
78 | $(sFILES:.s=.o) $(SFILES:.S=.o)
79 |
80 | #---------------------------------------------------------------------------------
81 | # build a list of include paths
82 | #---------------------------------------------------------------------------------
83 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
84 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
85 | -I$(CURDIR)/$(BUILD) \
86 | -I$(LIBOGC_INC)
87 |
88 | #---------------------------------------------------------------------------------
89 | # build a list of library paths
90 | #---------------------------------------------------------------------------------
91 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
92 | -L$(LIBOGC_LIB)
93 |
94 | export OUTPUT := $(CURDIR)/$(TARGET)
95 | .PHONY: $(BUILD) clean
96 |
97 | #---------------------------------------------------------------------------------
98 | $(BUILD):
99 | @[ -d $@ ] || mkdir -p $@
100 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
101 |
102 | #---------------------------------------------------------------------------------
103 | clean:
104 | @echo clean ...
105 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
106 |
107 | #---------------------------------------------------------------------------------
108 | run:
109 | wiiload $(TARGET).dol
110 | #---------------------------------------------------------------------------------
111 | debug:
112 | wiiload $(TARGET).dol
113 | powerpc-gekko-gdb -n $(TARGET).elf -x gdb.txt
114 |
115 | #---------------------------------------------------------------------------------
116 | else
117 |
118 | DEPENDS := $(OFILES:.o=.d)
119 |
120 | #---------------------------------------------------------------------------------
121 | # main targets
122 | #---------------------------------------------------------------------------------
123 | $(OUTPUT).dol: $(OUTPUT).elf
124 | $(OUTPUT).elf: $(OFILES)
125 |
126 | #---------------------------------------------------------------------------------
127 | # This rule links in binary data with the .jpg extension
128 | #---------------------------------------------------------------------------------
129 | %.jpg.o : %.jpg
130 | #---------------------------------------------------------------------------------
131 | @echo $(notdir $<)
132 | $(bin2o)
133 |
134 | -include $(DEPENDS)
135 |
136 | #---------------------------------------------------------------------------------
137 | endif
138 | #---------------------------------------------------------------------------------
139 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson04/source/lesson4.c:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------
2 |
3 | nehe lesson 4 port to GX by WinterMute
4 |
5 | ---------------------------------------------------------------------------------*/
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #define DEFAULT_FIFO_SIZE (256*1024)
16 |
17 | static void *frameBuffer[2] = { NULL, NULL};
18 | GXRModeObj *rmode;
19 |
20 | //---------------------------------------------------------------------------------
21 | int main( int argc, char **argv ){
22 | //---------------------------------------------------------------------------------
23 | f32 yscale;
24 |
25 | u32 xfbHeight;
26 |
27 | Mtx view;
28 | Mtx44 perspective;
29 | Mtx model, modelview;
30 |
31 | float rtri = 0.0f , rquad = 0.0f;
32 |
33 | u32 fb = 0; // initial framebuffer index
34 | GXColor background = {0, 0, 0, 0xff};
35 |
36 |
37 | // init the vi.
38 | VIDEO_Init();
39 | WPAD_Init();
40 |
41 | rmode = VIDEO_GetPreferredMode(NULL);
42 |
43 | // allocate 2 framebuffers for double buffering
44 | frameBuffer[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
45 | frameBuffer[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
46 |
47 | VIDEO_Configure(rmode);
48 | VIDEO_SetNextFramebuffer(frameBuffer[fb]);
49 | VIDEO_SetBlack(false);
50 | VIDEO_Flush();
51 | VIDEO_WaitVSync();
52 | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
53 |
54 | // setup the fifo and then init the flipper
55 | void *gp_fifo = NULL;
56 | gp_fifo = memalign(32,DEFAULT_FIFO_SIZE);
57 | memset(gp_fifo,0,DEFAULT_FIFO_SIZE);
58 |
59 | GX_Init(gp_fifo,DEFAULT_FIFO_SIZE);
60 |
61 | // clears the bg to color and clears the z buffer
62 | GX_SetCopyClear(background, 0x00ffffff);
63 |
64 | // other gx setup
65 | GX_SetViewport(0,0,rmode->fbWidth,rmode->efbHeight,0,1);
66 | yscale = GX_GetYScaleFactor(rmode->efbHeight,rmode->xfbHeight);
67 | xfbHeight = GX_SetDispCopyYScale(yscale);
68 | GX_SetScissor(0,0,rmode->fbWidth,rmode->efbHeight);
69 | GX_SetDispCopySrc(0,0,rmode->fbWidth,rmode->efbHeight);
70 | GX_SetDispCopyDst(rmode->fbWidth,xfbHeight);
71 | GX_SetCopyFilter(rmode->aa,rmode->sample_pattern,GX_TRUE,rmode->vfilter);
72 | GX_SetFieldMode(rmode->field_rendering,((rmode->viHeight==2*rmode->xfbHeight)?GX_ENABLE:GX_DISABLE));
73 |
74 | GX_SetCullMode(GX_CULL_NONE);
75 | GX_CopyDisp(frameBuffer[fb],GX_TRUE);
76 | GX_SetDispCopyGamma(GX_GM_1_0);
77 |
78 |
79 | // setup the vertex descriptor
80 | // tells the flipper to expect direct data
81 | GX_ClearVtxDesc();
82 | GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
83 | GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
84 |
85 | // setup the vertex attribute table
86 | // describes the data
87 | // args: vat location 0-7, type of data, data format, size, scale
88 | // so for ex. in the first call we are sending position data with
89 | // 3 values X,Y,Z of size F32. scale sets the number of fractional
90 | // bits for non float data.
91 | GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
92 | GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGB8, 0);
93 |
94 | GX_SetNumChans(1);
95 | GX_SetNumTexGens(0);
96 | GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR0A0);
97 | GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
98 |
99 | // setup our camera at the origin
100 | // looking down the -z axis with y up
101 | guVector cam = {0.0F, 0.0F, 0.0F},
102 | up = {0.0F, 1.0F, 0.0F},
103 | look = {0.0F, 0.0F, -1.0F};
104 | guLookAt(view, &cam, &up, &look);
105 |
106 |
107 | // setup our projection matrix
108 | // this creates a perspective matrix with a view angle of 90,
109 | // and aspect ratio based on the display resolution
110 | f32 w = rmode->viWidth;
111 | f32 h = rmode->viHeight;
112 | guPerspective(perspective, 45, (f32)w/h, 0.1F, 300.0F);
113 | GX_LoadProjectionMtx(perspective, GX_PERSPECTIVE);
114 |
115 | guVector Yaxis = {0,1,0};
116 | guVector Xaxis = {1,0,0};
117 |
118 | while(1) {
119 |
120 | WPAD_ScanPads();
121 |
122 | if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
123 |
124 | // do this before drawing
125 | GX_SetViewport(0,0,rmode->fbWidth,rmode->efbHeight,0,1);
126 |
127 | guMtxIdentity(model);
128 | guMtxRotAxisDeg(model, &Yaxis, rtri);
129 | guMtxTransApply(model, model, -1.5f,0.0f,-6.0f);
130 | guMtxConcat(view,model,modelview);
131 | // load the modelview matrix into matrix memory
132 | GX_LoadPosMtxImm(modelview, GX_PNMTX0);
133 |
134 | GX_Begin(GX_TRIANGLES, GX_VTXFMT0, 3);
135 | GX_Position3f32( 0.0f, 1.0f, 0.0f); // Top
136 | GX_Color3f32(1.0f,0.0f,0.0f); // Set The Color To Red
137 | GX_Position3f32(-1.0f,-1.0f, 0.0f); // Bottom Left
138 | GX_Color3f32(0.0f,1.0f,0.0f); // Set The Color To Green
139 | GX_Position3f32( 1.0f,-1.0f, 0.0f); // Bottom Right
140 | GX_Color3f32(0.0f,0.0f,1.0f); // Set The Color To Blue
141 | GX_End();
142 |
143 | guMtxIdentity(model);
144 | guMtxRotAxisDeg(model, &Xaxis, rquad);
145 | guMtxTransApply(model, model, 1.5f,0.0f,-6.0f);
146 | guMtxConcat(view,model,modelview);
147 | // load the modelview matrix into matrix memory
148 | GX_LoadPosMtxImm(modelview, GX_PNMTX0);
149 |
150 | GX_Begin(GX_QUADS, GX_VTXFMT0, 4); // Draw A Quad
151 | GX_Position3f32(-1.0f, 1.0f, 0.0f); // Top Left
152 | GX_Color3f32(0.5f,0.5f,1.0f); // Set The Color To Blue
153 | GX_Position3f32( 1.0f, 1.0f, 0.0f); // Top Right
154 | GX_Color3f32(0.5f,0.5f,1.0f); // Set The Color To Blue
155 | GX_Position3f32( 1.0f,-1.0f, 0.0f); // Bottom Right
156 | GX_Color3f32(0.5f,0.5f,1.0f); // Set The Color To Blue
157 | GX_Position3f32(-1.0f,-1.0f, 0.0f); // Bottom Left
158 | GX_Color3f32(0.5f,0.5f,1.0f); // Set The Color To Blue
159 | GX_End(); // Done Drawing The Quad
160 |
161 | // do this stuff after drawing
162 | GX_DrawDone();
163 |
164 | fb ^= 1; // flip framebuffer
165 | GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
166 | GX_SetColorUpdate(GX_TRUE);
167 | GX_CopyDisp(frameBuffer[fb],GX_TRUE);
168 |
169 | VIDEO_SetNextFramebuffer(frameBuffer[fb]);
170 |
171 | VIDEO_Flush();
172 |
173 | VIDEO_WaitVSync();
174 |
175 | rtri+=0.2f; // Increase The Rotation Variable For The Triangle ( NEW )
176 | rquad-=0.15f; // Decrease The Rotation Variable For The Quad ( NEW )
177 |
178 | }
179 | return 0;
180 | }
181 |
182 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson10/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | .SECONDARY:
6 | #---------------------------------------------------------------------------------
7 | ifeq ($(strip $(DEVKITPPC)),)
8 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
9 | endif
10 |
11 | include $(DEVKITPPC)/wii_rules
12 |
13 | #---------------------------------------------------------------------------------
14 | # TARGET is the name of the output
15 | # BUILD is the directory where object files & intermediate files will be placed
16 | # SOURCES is a list of directories containing source code
17 | # INCLUDES is a list of directories containing extra header files
18 | #---------------------------------------------------------------------------------
19 | TARGET := $(notdir $(CURDIR))
20 | BUILD := build
21 | SOURCES := source
22 | DATA := data
23 | TEXTURES := textures
24 | INCLUDES :=
25 |
26 | #---------------------------------------------------------------------------------
27 | # options for code generation
28 | #---------------------------------------------------------------------------------
29 |
30 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
31 | CXXFLAGS = $(CFLAGS)
32 |
33 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
34 |
35 | #---------------------------------------------------------------------------------
36 | # any extra libraries we wish to link with the project
37 | #---------------------------------------------------------------------------------
38 | LIBS := -lwiiuse -lbte -logc -lm
39 |
40 | #---------------------------------------------------------------------------------
41 | # list of directories containing libraries, this must be the top level containing
42 | # include and lib
43 | #---------------------------------------------------------------------------------
44 | LIBDIRS :=
45 |
46 | #---------------------------------------------------------------------------------
47 | # no real need to edit anything past this point unless you need to add additional
48 | # rules for different file extensions
49 | #---------------------------------------------------------------------------------
50 | ifneq ($(BUILD),$(notdir $(CURDIR)))
51 | #---------------------------------------------------------------------------------
52 |
53 | export OUTPUT := $(CURDIR)/$(TARGET)
54 |
55 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
56 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
57 | $(foreach dir,$(TEXTURES),$(CURDIR)/$(dir))
58 |
59 | export DEPSDIR := $(CURDIR)/$(BUILD)
60 |
61 | #---------------------------------------------------------------------------------
62 | # automatically build a list of object files for our project
63 | #---------------------------------------------------------------------------------
64 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
65 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
66 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
67 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
68 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
69 | SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf)))
70 | TPLFILES := $(SCFFILES:.scf=.tpl)
71 |
72 | #---------------------------------------------------------------------------------
73 | # use CXX for linking C++ projects, CC for standard C
74 | #---------------------------------------------------------------------------------
75 | ifeq ($(strip $(CPPFILES)),)
76 | export LD := $(CC)
77 | else
78 | export LD := $(CXX)
79 | endif
80 |
81 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
82 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
83 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
84 |
85 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))
86 |
87 | #---------------------------------------------------------------------------------
88 | # build a list of include paths
89 | #---------------------------------------------------------------------------------
90 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
91 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
92 | -I$(CURDIR)/$(BUILD) \
93 | -I$(LIBOGC_INC)
94 |
95 | #---------------------------------------------------------------------------------
96 | # build a list of library paths
97 | #---------------------------------------------------------------------------------
98 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
99 | -L$(LIBOGC_LIB)
100 |
101 | export OUTPUT := $(CURDIR)/$(TARGET)
102 | .PHONY: $(BUILD) clean
103 |
104 | #---------------------------------------------------------------------------------
105 | $(BUILD):
106 | @[ -d $@ ] || mkdir -p $@
107 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
108 |
109 | #---------------------------------------------------------------------------------
110 | clean:
111 | @echo clean ...
112 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
113 | #---------------------------------------------------------------------------------
114 | run:
115 | wiiload $(OUTPUT).dol
116 |
117 | #---------------------------------------------------------------------------------
118 | else
119 |
120 | #---------------------------------------------------------------------------------
121 | # main targets
122 | #---------------------------------------------------------------------------------
123 | $(OUTPUT).dol: $(OUTPUT).elf
124 | $(OUTPUT).elf: $(OFILES)
125 |
126 | $(OFILES_SOURCES) : $(HFILES)
127 |
128 | #---------------------------------------------------------------------------------
129 | %.txt.o %_txt.h : %.txt
130 | #---------------------------------------------------------------------------------
131 | @echo $(notdir $<)
132 | @$(bin2o)
133 |
134 | #---------------------------------------------------------------------------------
135 | %.tpl.o %_tpl.h : %.tpl
136 | #---------------------------------------------------------------------------------
137 | @echo $(notdir $<)
138 | @$(bin2o)
139 |
140 |
141 | -include $(DEPSDIR)/*.d
142 |
143 | #---------------------------------------------------------------------------------
144 | endif
145 | #---------------------------------------------------------------------------------
146 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson08/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | .SECONDARY:
6 | #---------------------------------------------------------------------------------
7 | ifeq ($(strip $(DEVKITPPC)),)
8 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
9 | endif
10 |
11 | include $(DEVKITPPC)/wii_rules
12 |
13 | #---------------------------------------------------------------------------------
14 | # TARGET is the name of the output
15 | # BUILD is the directory where object files & intermediate files will be placed
16 | # SOURCES is a list of directories containing source code
17 | # INCLUDES is a list of directories containing extra header files
18 | #---------------------------------------------------------------------------------
19 | TARGET := $(notdir $(CURDIR))
20 | BUILD := build
21 | SOURCES := source
22 | DATA :=
23 | TEXTURES := textures
24 | INCLUDES :=
25 |
26 | #---------------------------------------------------------------------------------
27 | # options for code generation
28 | #---------------------------------------------------------------------------------
29 |
30 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
31 | CXXFLAGS = $(CFLAGS)
32 |
33 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
34 |
35 | #---------------------------------------------------------------------------------
36 | # any extra libraries we wish to link with the project
37 | #---------------------------------------------------------------------------------
38 | LIBS := -lwiiuse -lbte -logc -lm
39 |
40 | #---------------------------------------------------------------------------------
41 | # list of directories containing libraries, this must be the top level containing
42 | # include and lib
43 | #---------------------------------------------------------------------------------
44 | LIBDIRS :=
45 |
46 | #---------------------------------------------------------------------------------
47 | # no real need to edit anything past this point unless you need to add additional
48 | # rules for different file extensions
49 | #---------------------------------------------------------------------------------
50 | ifneq ($(BUILD),$(notdir $(CURDIR)))
51 | #---------------------------------------------------------------------------------
52 |
53 | export OUTPUT := $(CURDIR)/$(TARGET)
54 |
55 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
56 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
57 | $(foreach dir,$(TEXTURES),$(CURDIR)/$(dir))
58 |
59 | export DEPSDIR := $(CURDIR)/$(BUILD)
60 |
61 | #---------------------------------------------------------------------------------
62 | # automatically build a list of object files for our project
63 | #---------------------------------------------------------------------------------
64 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
65 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
66 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
67 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
68 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
69 | SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf)))
70 | TPLFILES := $(SCFFILES:.scf=.tpl)
71 |
72 | #---------------------------------------------------------------------------------
73 | # use CXX for linking C++ projects, CC for standard C
74 | #---------------------------------------------------------------------------------
75 | ifeq ($(strip $(CPPFILES)),)
76 | export LD := $(CC)
77 | else
78 | export LD := $(CXX)
79 | endif
80 |
81 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
82 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
83 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
84 |
85 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))
86 |
87 | #---------------------------------------------------------------------------------
88 | # build a list of include paths
89 | #---------------------------------------------------------------------------------
90 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
91 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
92 | -I$(CURDIR)/$(BUILD) \
93 | -I$(LIBOGC_INC)
94 |
95 | #---------------------------------------------------------------------------------
96 | # build a list of library paths
97 | #---------------------------------------------------------------------------------
98 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
99 | -L$(LIBOGC_LIB)
100 |
101 | export OUTPUT := $(CURDIR)/$(TARGET)
102 | .PHONY: $(BUILD) clean
103 |
104 | #---------------------------------------------------------------------------------
105 | $(BUILD):
106 | @[ -d $@ ] || mkdir -p $@
107 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
108 |
109 | #---------------------------------------------------------------------------------
110 | clean:
111 | @echo clean ...
112 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
113 | #---------------------------------------------------------------------------------
114 | run:
115 | wiiload $(OUTPUT).dol
116 |
117 | #---------------------------------------------------------------------------------
118 | else
119 |
120 | #---------------------------------------------------------------------------------
121 | # main targets
122 | #---------------------------------------------------------------------------------
123 | $(OUTPUT).dol: $(OUTPUT).elf
124 | $(OUTPUT).elf: $(OFILES)
125 |
126 | $(OFILES_SOURCES) : $(HFILES)
127 |
128 | #---------------------------------------------------------------------------------
129 | # This rule links in binary data with the .bin extension
130 | #---------------------------------------------------------------------------------
131 | %.bin.o %_bin.h : %.bin
132 | #---------------------------------------------------------------------------------
133 | @echo $(notdir $<)
134 | @$(bin2o)
135 |
136 | #---------------------------------------------------------------------------------
137 | %.tpl.o %_tpl.h : %.tpl
138 | #---------------------------------------------------------------------------------
139 | @echo $(notdir $<)
140 | @$(bin2o)
141 |
142 |
143 | -include $(DEPSDIR)/*.d
144 |
145 | #---------------------------------------------------------------------------------
146 | endif
147 | #---------------------------------------------------------------------------------
148 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson01/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | .SECONDARY:
6 | #---------------------------------------------------------------------------------
7 | ifeq ($(strip $(DEVKITPPC)),)
8 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
9 | endif
10 |
11 | include $(DEVKITPPC)/wii_rules
12 |
13 | #---------------------------------------------------------------------------------
14 | # TARGET is the name of the output
15 | # BUILD is the directory where object files & intermediate files will be placed
16 | # SOURCES is a list of directories containing source code
17 | # INCLUDES is a list of directories containing extra header files
18 | #---------------------------------------------------------------------------------
19 | TARGET := $(notdir $(CURDIR))
20 | BUILD := build
21 | SOURCES := source
22 | DATA :=
23 | TEXTURES := textures
24 | INCLUDES :=
25 |
26 | #---------------------------------------------------------------------------------
27 | # options for code generation
28 | #---------------------------------------------------------------------------------
29 |
30 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
31 | CXXFLAGS = $(CFLAGS)
32 |
33 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
34 |
35 | #---------------------------------------------------------------------------------
36 | # any extra libraries we wish to link with the project
37 | #---------------------------------------------------------------------------------
38 | LIBS := -lwiiuse -lbte -logc -lm
39 |
40 | #---------------------------------------------------------------------------------
41 | # list of directories containing libraries, this must be the top level containing
42 | # include and lib
43 | #---------------------------------------------------------------------------------
44 | LIBDIRS :=
45 |
46 | #---------------------------------------------------------------------------------
47 | # no real need to edit anything past this point unless you need to add additional
48 | # rules for different file extensions
49 | #---------------------------------------------------------------------------------
50 | ifneq ($(BUILD),$(notdir $(CURDIR)))
51 | #---------------------------------------------------------------------------------
52 |
53 | export OUTPUT := $(CURDIR)/$(TARGET)
54 |
55 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
56 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
57 | $(foreach dir,$(TEXTURES),$(CURDIR)/$(dir))
58 |
59 | export DEPSDIR := $(CURDIR)/$(BUILD)
60 |
61 | #---------------------------------------------------------------------------------
62 | # automatically build a list of object files for our project
63 | #---------------------------------------------------------------------------------
64 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
65 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
66 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
67 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
68 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
69 | SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf)))
70 | TPLFILES := $(SCFFILES:.scf=.tpl)
71 |
72 | #---------------------------------------------------------------------------------
73 | # use CXX for linking C++ projects, CC for standard C
74 | #---------------------------------------------------------------------------------
75 | ifeq ($(strip $(CPPFILES)),)
76 | export LD := $(CC)
77 | else
78 | export LD := $(CXX)
79 | endif
80 |
81 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
82 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
83 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
84 |
85 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))
86 |
87 | #---------------------------------------------------------------------------------
88 | # build a list of include paths
89 | #---------------------------------------------------------------------------------
90 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
91 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
92 | -I$(CURDIR)/$(BUILD) \
93 | -I$(LIBOGC_INC)
94 |
95 | #---------------------------------------------------------------------------------
96 | # build a list of library paths
97 | #---------------------------------------------------------------------------------
98 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
99 | -L$(LIBOGC_LIB)
100 |
101 | export OUTPUT := $(CURDIR)/$(TARGET)
102 | .PHONY: $(BUILD) clean
103 |
104 | #---------------------------------------------------------------------------------
105 | $(BUILD):
106 | @[ -d $@ ] || mkdir -p $@
107 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
108 |
109 | #---------------------------------------------------------------------------------
110 | clean:
111 | @echo clean ...
112 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
113 | #---------------------------------------------------------------------------------
114 | run:
115 | wiiload $(OUTPUT).dol
116 |
117 | #---------------------------------------------------------------------------------
118 | else
119 |
120 | #---------------------------------------------------------------------------------
121 | # main targets
122 | #---------------------------------------------------------------------------------
123 | $(OUTPUT).dol: $(OUTPUT).elf
124 | $(OUTPUT).elf: $(OFILES)
125 |
126 | $(OFILES_SOURCES) : $(HFILES)
127 |
128 | #---------------------------------------------------------------------------------
129 | # This rule links in binary data with the .bin extension
130 | #---------------------------------------------------------------------------------
131 | %.bin.o %_bin.h : %.bin
132 | #---------------------------------------------------------------------------------
133 | @echo $(notdir $<)
134 | @$(bin2o)
135 |
136 | #---------------------------------------------------------------------------------
137 | %.tpl.o %_tpl.h : %.tpl
138 | #---------------------------------------------------------------------------------
139 | @echo $(notdir $<)
140 | @$(bin2o)
141 |
142 |
143 | -include $(DEPSDIR)/*.d
144 |
145 | #---------------------------------------------------------------------------------
146 | endif
147 | #---------------------------------------------------------------------------------
148 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson02/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | .SECONDARY:
6 | #---------------------------------------------------------------------------------
7 | ifeq ($(strip $(DEVKITPPC)),)
8 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
9 | endif
10 |
11 | include $(DEVKITPPC)/wii_rules
12 |
13 | #---------------------------------------------------------------------------------
14 | # TARGET is the name of the output
15 | # BUILD is the directory where object files & intermediate files will be placed
16 | # SOURCES is a list of directories containing source code
17 | # INCLUDES is a list of directories containing extra header files
18 | #---------------------------------------------------------------------------------
19 | TARGET := $(notdir $(CURDIR))
20 | BUILD := build
21 | SOURCES := source
22 | DATA :=
23 | TEXTURES := textures
24 | INCLUDES :=
25 |
26 | #---------------------------------------------------------------------------------
27 | # options for code generation
28 | #---------------------------------------------------------------------------------
29 |
30 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
31 | CXXFLAGS = $(CFLAGS)
32 |
33 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
34 |
35 | #---------------------------------------------------------------------------------
36 | # any extra libraries we wish to link with the project
37 | #---------------------------------------------------------------------------------
38 | LIBS := -lwiiuse -lbte -logc -lm
39 |
40 | #---------------------------------------------------------------------------------
41 | # list of directories containing libraries, this must be the top level containing
42 | # include and lib
43 | #---------------------------------------------------------------------------------
44 | LIBDIRS :=
45 |
46 | #---------------------------------------------------------------------------------
47 | # no real need to edit anything past this point unless you need to add additional
48 | # rules for different file extensions
49 | #---------------------------------------------------------------------------------
50 | ifneq ($(BUILD),$(notdir $(CURDIR)))
51 | #---------------------------------------------------------------------------------
52 |
53 | export OUTPUT := $(CURDIR)/$(TARGET)
54 |
55 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
56 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
57 | $(foreach dir,$(TEXTURES),$(CURDIR)/$(dir))
58 |
59 | export DEPSDIR := $(CURDIR)/$(BUILD)
60 |
61 | #---------------------------------------------------------------------------------
62 | # automatically build a list of object files for our project
63 | #---------------------------------------------------------------------------------
64 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
65 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
66 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
67 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
68 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
69 | SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf)))
70 | TPLFILES := $(SCFFILES:.scf=.tpl)
71 |
72 | #---------------------------------------------------------------------------------
73 | # use CXX for linking C++ projects, CC for standard C
74 | #---------------------------------------------------------------------------------
75 | ifeq ($(strip $(CPPFILES)),)
76 | export LD := $(CC)
77 | else
78 | export LD := $(CXX)
79 | endif
80 |
81 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
82 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
83 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
84 |
85 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))
86 |
87 | #---------------------------------------------------------------------------------
88 | # build a list of include paths
89 | #---------------------------------------------------------------------------------
90 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
91 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
92 | -I$(CURDIR)/$(BUILD) \
93 | -I$(LIBOGC_INC)
94 |
95 | #---------------------------------------------------------------------------------
96 | # build a list of library paths
97 | #---------------------------------------------------------------------------------
98 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
99 | -L$(LIBOGC_LIB)
100 |
101 | export OUTPUT := $(CURDIR)/$(TARGET)
102 | .PHONY: $(BUILD) clean
103 |
104 | #---------------------------------------------------------------------------------
105 | $(BUILD):
106 | @[ -d $@ ] || mkdir -p $@
107 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
108 |
109 | #---------------------------------------------------------------------------------
110 | clean:
111 | @echo clean ...
112 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
113 | #---------------------------------------------------------------------------------
114 | run:
115 | wiiload $(OUTPUT).dol
116 |
117 | #---------------------------------------------------------------------------------
118 | else
119 |
120 | #---------------------------------------------------------------------------------
121 | # main targets
122 | #---------------------------------------------------------------------------------
123 | $(OUTPUT).dol: $(OUTPUT).elf
124 | $(OUTPUT).elf: $(OFILES)
125 |
126 | $(OFILES_SOURCES) : $(HFILES)
127 |
128 | #---------------------------------------------------------------------------------
129 | # This rule links in binary data with the .bin extension
130 | #---------------------------------------------------------------------------------
131 | %.bin.o %_bin.h : %.bin
132 | #---------------------------------------------------------------------------------
133 | @echo $(notdir $<)
134 | @$(bin2o)
135 |
136 | #---------------------------------------------------------------------------------
137 | %.tpl.o %_tpl.h : %.tpl
138 | #---------------------------------------------------------------------------------
139 | @echo $(notdir $<)
140 | @$(bin2o)
141 |
142 |
143 | -include $(DEPSDIR)/*.d
144 |
145 | #---------------------------------------------------------------------------------
146 | endif
147 | #---------------------------------------------------------------------------------
148 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson03/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | .SECONDARY:
6 | #---------------------------------------------------------------------------------
7 | ifeq ($(strip $(DEVKITPPC)),)
8 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
9 | endif
10 |
11 | include $(DEVKITPPC)/wii_rules
12 |
13 | #---------------------------------------------------------------------------------
14 | # TARGET is the name of the output
15 | # BUILD is the directory where object files & intermediate files will be placed
16 | # SOURCES is a list of directories containing source code
17 | # INCLUDES is a list of directories containing extra header files
18 | #---------------------------------------------------------------------------------
19 | TARGET := $(notdir $(CURDIR))
20 | BUILD := build
21 | SOURCES := source
22 | DATA :=
23 | TEXTURES := textures
24 | INCLUDES :=
25 |
26 | #---------------------------------------------------------------------------------
27 | # options for code generation
28 | #---------------------------------------------------------------------------------
29 |
30 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
31 | CXXFLAGS = $(CFLAGS)
32 |
33 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
34 |
35 | #---------------------------------------------------------------------------------
36 | # any extra libraries we wish to link with the project
37 | #---------------------------------------------------------------------------------
38 | LIBS := -lwiiuse -lbte -logc -lm
39 |
40 | #---------------------------------------------------------------------------------
41 | # list of directories containing libraries, this must be the top level containing
42 | # include and lib
43 | #---------------------------------------------------------------------------------
44 | LIBDIRS :=
45 |
46 | #---------------------------------------------------------------------------------
47 | # no real need to edit anything past this point unless you need to add additional
48 | # rules for different file extensions
49 | #---------------------------------------------------------------------------------
50 | ifneq ($(BUILD),$(notdir $(CURDIR)))
51 | #---------------------------------------------------------------------------------
52 |
53 | export OUTPUT := $(CURDIR)/$(TARGET)
54 |
55 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
56 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
57 | $(foreach dir,$(TEXTURES),$(CURDIR)/$(dir))
58 |
59 | export DEPSDIR := $(CURDIR)/$(BUILD)
60 |
61 | #---------------------------------------------------------------------------------
62 | # automatically build a list of object files for our project
63 | #---------------------------------------------------------------------------------
64 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
65 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
66 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
67 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
68 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
69 | SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf)))
70 | TPLFILES := $(SCFFILES:.scf=.tpl)
71 |
72 | #---------------------------------------------------------------------------------
73 | # use CXX for linking C++ projects, CC for standard C
74 | #---------------------------------------------------------------------------------
75 | ifeq ($(strip $(CPPFILES)),)
76 | export LD := $(CC)
77 | else
78 | export LD := $(CXX)
79 | endif
80 |
81 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
82 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
83 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
84 |
85 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))
86 |
87 | #---------------------------------------------------------------------------------
88 | # build a list of include paths
89 | #---------------------------------------------------------------------------------
90 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
91 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
92 | -I$(CURDIR)/$(BUILD) \
93 | -I$(LIBOGC_INC)
94 |
95 | #---------------------------------------------------------------------------------
96 | # build a list of library paths
97 | #---------------------------------------------------------------------------------
98 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
99 | -L$(LIBOGC_LIB)
100 |
101 | export OUTPUT := $(CURDIR)/$(TARGET)
102 | .PHONY: $(BUILD) clean
103 |
104 | #---------------------------------------------------------------------------------
105 | $(BUILD):
106 | @[ -d $@ ] || mkdir -p $@
107 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
108 |
109 | #---------------------------------------------------------------------------------
110 | clean:
111 | @echo clean ...
112 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
113 | #---------------------------------------------------------------------------------
114 | run:
115 | wiiload $(OUTPUT).dol
116 |
117 | #---------------------------------------------------------------------------------
118 | else
119 |
120 | #---------------------------------------------------------------------------------
121 | # main targets
122 | #---------------------------------------------------------------------------------
123 | $(OUTPUT).dol: $(OUTPUT).elf
124 | $(OUTPUT).elf: $(OFILES)
125 |
126 | $(OFILES_SOURCES) : $(HFILES)
127 |
128 | #---------------------------------------------------------------------------------
129 | # This rule links in binary data with the .bin extension
130 | #---------------------------------------------------------------------------------
131 | %.bin.o %_bin.h : %.bin
132 | #---------------------------------------------------------------------------------
133 | @echo $(notdir $<)
134 | @$(bin2o)
135 |
136 | #---------------------------------------------------------------------------------
137 | %.tpl.o %_tpl.h : %.tpl
138 | #---------------------------------------------------------------------------------
139 | @echo $(notdir $<)
140 | @$(bin2o)
141 |
142 |
143 | -include $(DEPSDIR)/*.d
144 |
145 | #---------------------------------------------------------------------------------
146 | endif
147 | #---------------------------------------------------------------------------------
148 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson04/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | .SECONDARY:
6 | #---------------------------------------------------------------------------------
7 | ifeq ($(strip $(DEVKITPPC)),)
8 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
9 | endif
10 |
11 | include $(DEVKITPPC)/wii_rules
12 |
13 | #---------------------------------------------------------------------------------
14 | # TARGET is the name of the output
15 | # BUILD is the directory where object files & intermediate files will be placed
16 | # SOURCES is a list of directories containing source code
17 | # INCLUDES is a list of directories containing extra header files
18 | #---------------------------------------------------------------------------------
19 | TARGET := $(notdir $(CURDIR))
20 | BUILD := build
21 | SOURCES := source
22 | DATA :=
23 | TEXTURES := textures
24 | INCLUDES :=
25 |
26 | #---------------------------------------------------------------------------------
27 | # options for code generation
28 | #---------------------------------------------------------------------------------
29 |
30 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
31 | CXXFLAGS = $(CFLAGS)
32 |
33 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
34 |
35 | #---------------------------------------------------------------------------------
36 | # any extra libraries we wish to link with the project
37 | #---------------------------------------------------------------------------------
38 | LIBS := -lwiiuse -lbte -logc -lm
39 |
40 | #---------------------------------------------------------------------------------
41 | # list of directories containing libraries, this must be the top level containing
42 | # include and lib
43 | #---------------------------------------------------------------------------------
44 | LIBDIRS :=
45 |
46 | #---------------------------------------------------------------------------------
47 | # no real need to edit anything past this point unless you need to add additional
48 | # rules for different file extensions
49 | #---------------------------------------------------------------------------------
50 | ifneq ($(BUILD),$(notdir $(CURDIR)))
51 | #---------------------------------------------------------------------------------
52 |
53 | export OUTPUT := $(CURDIR)/$(TARGET)
54 |
55 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
56 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
57 | $(foreach dir,$(TEXTURES),$(CURDIR)/$(dir))
58 |
59 | export DEPSDIR := $(CURDIR)/$(BUILD)
60 |
61 | #---------------------------------------------------------------------------------
62 | # automatically build a list of object files for our project
63 | #---------------------------------------------------------------------------------
64 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
65 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
66 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
67 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
68 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
69 | SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf)))
70 | TPLFILES := $(SCFFILES:.scf=.tpl)
71 |
72 | #---------------------------------------------------------------------------------
73 | # use CXX for linking C++ projects, CC for standard C
74 | #---------------------------------------------------------------------------------
75 | ifeq ($(strip $(CPPFILES)),)
76 | export LD := $(CC)
77 | else
78 | export LD := $(CXX)
79 | endif
80 |
81 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
82 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
83 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
84 |
85 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))
86 |
87 | #---------------------------------------------------------------------------------
88 | # build a list of include paths
89 | #---------------------------------------------------------------------------------
90 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
91 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
92 | -I$(CURDIR)/$(BUILD) \
93 | -I$(LIBOGC_INC)
94 |
95 | #---------------------------------------------------------------------------------
96 | # build a list of library paths
97 | #---------------------------------------------------------------------------------
98 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
99 | -L$(LIBOGC_LIB)
100 |
101 | export OUTPUT := $(CURDIR)/$(TARGET)
102 | .PHONY: $(BUILD) clean
103 |
104 | #---------------------------------------------------------------------------------
105 | $(BUILD):
106 | @[ -d $@ ] || mkdir -p $@
107 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
108 |
109 | #---------------------------------------------------------------------------------
110 | clean:
111 | @echo clean ...
112 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
113 | #---------------------------------------------------------------------------------
114 | run:
115 | wiiload $(OUTPUT).dol
116 |
117 | #---------------------------------------------------------------------------------
118 | else
119 |
120 | #---------------------------------------------------------------------------------
121 | # main targets
122 | #---------------------------------------------------------------------------------
123 | $(OUTPUT).dol: $(OUTPUT).elf
124 | $(OUTPUT).elf: $(OFILES)
125 |
126 | $(OFILES_SOURCES) : $(HFILES)
127 |
128 | #---------------------------------------------------------------------------------
129 | # This rule links in binary data with the .bin extension
130 | #---------------------------------------------------------------------------------
131 | %.bin.o %_bin.h : %.bin
132 | #---------------------------------------------------------------------------------
133 | @echo $(notdir $<)
134 | @$(bin2o)
135 |
136 | #---------------------------------------------------------------------------------
137 | %.tpl.o %_tpl.h : %.tpl
138 | #---------------------------------------------------------------------------------
139 | @echo $(notdir $<)
140 | @$(bin2o)
141 |
142 |
143 | -include $(DEPSDIR)/*.d
144 |
145 | #---------------------------------------------------------------------------------
146 | endif
147 | #---------------------------------------------------------------------------------
148 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson05/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | .SECONDARY:
6 | #---------------------------------------------------------------------------------
7 | ifeq ($(strip $(DEVKITPPC)),)
8 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
9 | endif
10 |
11 | include $(DEVKITPPC)/wii_rules
12 |
13 | #---------------------------------------------------------------------------------
14 | # TARGET is the name of the output
15 | # BUILD is the directory where object files & intermediate files will be placed
16 | # SOURCES is a list of directories containing source code
17 | # INCLUDES is a list of directories containing extra header files
18 | #---------------------------------------------------------------------------------
19 | TARGET := $(notdir $(CURDIR))
20 | BUILD := build
21 | SOURCES := source
22 | DATA :=
23 | TEXTURES := textures
24 | INCLUDES :=
25 |
26 | #---------------------------------------------------------------------------------
27 | # options for code generation
28 | #---------------------------------------------------------------------------------
29 |
30 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
31 | CXXFLAGS = $(CFLAGS)
32 |
33 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
34 |
35 | #---------------------------------------------------------------------------------
36 | # any extra libraries we wish to link with the project
37 | #---------------------------------------------------------------------------------
38 | LIBS := -lwiiuse -lbte -logc -lm
39 |
40 | #---------------------------------------------------------------------------------
41 | # list of directories containing libraries, this must be the top level containing
42 | # include and lib
43 | #---------------------------------------------------------------------------------
44 | LIBDIRS :=
45 |
46 | #---------------------------------------------------------------------------------
47 | # no real need to edit anything past this point unless you need to add additional
48 | # rules for different file extensions
49 | #---------------------------------------------------------------------------------
50 | ifneq ($(BUILD),$(notdir $(CURDIR)))
51 | #---------------------------------------------------------------------------------
52 |
53 | export OUTPUT := $(CURDIR)/$(TARGET)
54 |
55 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
56 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
57 | $(foreach dir,$(TEXTURES),$(CURDIR)/$(dir))
58 |
59 | export DEPSDIR := $(CURDIR)/$(BUILD)
60 |
61 | #---------------------------------------------------------------------------------
62 | # automatically build a list of object files for our project
63 | #---------------------------------------------------------------------------------
64 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
65 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
66 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
67 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
68 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
69 | SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf)))
70 | TPLFILES := $(SCFFILES:.scf=.tpl)
71 |
72 | #---------------------------------------------------------------------------------
73 | # use CXX for linking C++ projects, CC for standard C
74 | #---------------------------------------------------------------------------------
75 | ifeq ($(strip $(CPPFILES)),)
76 | export LD := $(CC)
77 | else
78 | export LD := $(CXX)
79 | endif
80 |
81 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
82 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
83 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
84 |
85 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))
86 |
87 | #---------------------------------------------------------------------------------
88 | # build a list of include paths
89 | #---------------------------------------------------------------------------------
90 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
91 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
92 | -I$(CURDIR)/$(BUILD) \
93 | -I$(LIBOGC_INC)
94 |
95 | #---------------------------------------------------------------------------------
96 | # build a list of library paths
97 | #---------------------------------------------------------------------------------
98 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
99 | -L$(LIBOGC_LIB)
100 |
101 | export OUTPUT := $(CURDIR)/$(TARGET)
102 | .PHONY: $(BUILD) clean
103 |
104 | #---------------------------------------------------------------------------------
105 | $(BUILD):
106 | @[ -d $@ ] || mkdir -p $@
107 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
108 |
109 | #---------------------------------------------------------------------------------
110 | clean:
111 | @echo clean ...
112 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
113 | #---------------------------------------------------------------------------------
114 | run:
115 | wiiload $(OUTPUT).dol
116 |
117 | #---------------------------------------------------------------------------------
118 | else
119 |
120 | #---------------------------------------------------------------------------------
121 | # main targets
122 | #---------------------------------------------------------------------------------
123 | $(OUTPUT).dol: $(OUTPUT).elf
124 | $(OUTPUT).elf: $(OFILES)
125 |
126 | $(OFILES_SOURCES) : $(HFILES)
127 |
128 | #---------------------------------------------------------------------------------
129 | # This rule links in binary data with the .bin extension
130 | #---------------------------------------------------------------------------------
131 | %.bin.o %_bin.h : %.bin
132 | #---------------------------------------------------------------------------------
133 | @echo $(notdir $<)
134 | @$(bin2o)
135 |
136 | #---------------------------------------------------------------------------------
137 | %.tpl.o %_tpl.h : %.tpl
138 | #---------------------------------------------------------------------------------
139 | @echo $(notdir $<)
140 | @$(bin2o)
141 |
142 |
143 | -include $(DEPSDIR)/*.d
144 |
145 | #---------------------------------------------------------------------------------
146 | endif
147 | #---------------------------------------------------------------------------------
148 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson06/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | .SECONDARY:
6 | #---------------------------------------------------------------------------------
7 | ifeq ($(strip $(DEVKITPPC)),)
8 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
9 | endif
10 |
11 | include $(DEVKITPPC)/wii_rules
12 |
13 | #---------------------------------------------------------------------------------
14 | # TARGET is the name of the output
15 | # BUILD is the directory where object files & intermediate files will be placed
16 | # SOURCES is a list of directories containing source code
17 | # INCLUDES is a list of directories containing extra header files
18 | #---------------------------------------------------------------------------------
19 | TARGET := $(notdir $(CURDIR))
20 | BUILD := build
21 | SOURCES := source
22 | DATA :=
23 | TEXTURES := textures
24 | INCLUDES :=
25 |
26 | #---------------------------------------------------------------------------------
27 | # options for code generation
28 | #---------------------------------------------------------------------------------
29 |
30 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
31 | CXXFLAGS = $(CFLAGS)
32 |
33 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
34 |
35 | #---------------------------------------------------------------------------------
36 | # any extra libraries we wish to link with the project
37 | #---------------------------------------------------------------------------------
38 | LIBS := -lwiiuse -lbte -logc -lm
39 |
40 | #---------------------------------------------------------------------------------
41 | # list of directories containing libraries, this must be the top level containing
42 | # include and lib
43 | #---------------------------------------------------------------------------------
44 | LIBDIRS :=
45 |
46 | #---------------------------------------------------------------------------------
47 | # no real need to edit anything past this point unless you need to add additional
48 | # rules for different file extensions
49 | #---------------------------------------------------------------------------------
50 | ifneq ($(BUILD),$(notdir $(CURDIR)))
51 | #---------------------------------------------------------------------------------
52 |
53 | export OUTPUT := $(CURDIR)/$(TARGET)
54 |
55 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
56 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
57 | $(foreach dir,$(TEXTURES),$(CURDIR)/$(dir))
58 |
59 | export DEPSDIR := $(CURDIR)/$(BUILD)
60 |
61 | #---------------------------------------------------------------------------------
62 | # automatically build a list of object files for our project
63 | #---------------------------------------------------------------------------------
64 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
65 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
66 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
67 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
68 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
69 | SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf)))
70 | TPLFILES := $(SCFFILES:.scf=.tpl)
71 |
72 | #---------------------------------------------------------------------------------
73 | # use CXX for linking C++ projects, CC for standard C
74 | #---------------------------------------------------------------------------------
75 | ifeq ($(strip $(CPPFILES)),)
76 | export LD := $(CC)
77 | else
78 | export LD := $(CXX)
79 | endif
80 |
81 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
82 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
83 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
84 |
85 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))
86 |
87 | #---------------------------------------------------------------------------------
88 | # build a list of include paths
89 | #---------------------------------------------------------------------------------
90 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
91 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
92 | -I$(CURDIR)/$(BUILD) \
93 | -I$(LIBOGC_INC)
94 |
95 | #---------------------------------------------------------------------------------
96 | # build a list of library paths
97 | #---------------------------------------------------------------------------------
98 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
99 | -L$(LIBOGC_LIB)
100 |
101 | export OUTPUT := $(CURDIR)/$(TARGET)
102 | .PHONY: $(BUILD) clean
103 |
104 | #---------------------------------------------------------------------------------
105 | $(BUILD):
106 | @[ -d $@ ] || mkdir -p $@
107 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
108 |
109 | #---------------------------------------------------------------------------------
110 | clean:
111 | @echo clean ...
112 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
113 | #---------------------------------------------------------------------------------
114 | run:
115 | wiiload $(OUTPUT).dol
116 |
117 | #---------------------------------------------------------------------------------
118 | else
119 |
120 | #---------------------------------------------------------------------------------
121 | # main targets
122 | #---------------------------------------------------------------------------------
123 | $(OUTPUT).dol: $(OUTPUT).elf
124 | $(OUTPUT).elf: $(OFILES)
125 |
126 | $(OFILES_SOURCES) : $(HFILES)
127 |
128 | #---------------------------------------------------------------------------------
129 | # This rule links in binary data with the .bin extension
130 | #---------------------------------------------------------------------------------
131 | %.bin.o %_bin.h : %.bin
132 | #---------------------------------------------------------------------------------
133 | @echo $(notdir $<)
134 | @$(bin2o)
135 |
136 | #---------------------------------------------------------------------------------
137 | %.tpl.o %_tpl.h : %.tpl
138 | #---------------------------------------------------------------------------------
139 | @echo $(notdir $<)
140 | @$(bin2o)
141 |
142 |
143 | -include $(DEPSDIR)/*.d
144 |
145 | #---------------------------------------------------------------------------------
146 | endif
147 | #---------------------------------------------------------------------------------
148 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson07/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | .SECONDARY:
6 | #---------------------------------------------------------------------------------
7 | ifeq ($(strip $(DEVKITPPC)),)
8 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
9 | endif
10 |
11 | include $(DEVKITPPC)/wii_rules
12 |
13 | #---------------------------------------------------------------------------------
14 | # TARGET is the name of the output
15 | # BUILD is the directory where object files & intermediate files will be placed
16 | # SOURCES is a list of directories containing source code
17 | # INCLUDES is a list of directories containing extra header files
18 | #---------------------------------------------------------------------------------
19 | TARGET := $(notdir $(CURDIR))
20 | BUILD := build
21 | SOURCES := source
22 | DATA :=
23 | TEXTURES := textures
24 | INCLUDES :=
25 |
26 | #---------------------------------------------------------------------------------
27 | # options for code generation
28 | #---------------------------------------------------------------------------------
29 |
30 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
31 | CXXFLAGS = $(CFLAGS)
32 |
33 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
34 |
35 | #---------------------------------------------------------------------------------
36 | # any extra libraries we wish to link with the project
37 | #---------------------------------------------------------------------------------
38 | LIBS := -lwiiuse -lbte -logc -lm
39 |
40 | #---------------------------------------------------------------------------------
41 | # list of directories containing libraries, this must be the top level containing
42 | # include and lib
43 | #---------------------------------------------------------------------------------
44 | LIBDIRS :=
45 |
46 | #---------------------------------------------------------------------------------
47 | # no real need to edit anything past this point unless you need to add additional
48 | # rules for different file extensions
49 | #---------------------------------------------------------------------------------
50 | ifneq ($(BUILD),$(notdir $(CURDIR)))
51 | #---------------------------------------------------------------------------------
52 |
53 | export OUTPUT := $(CURDIR)/$(TARGET)
54 |
55 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
56 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
57 | $(foreach dir,$(TEXTURES),$(CURDIR)/$(dir))
58 |
59 | export DEPSDIR := $(CURDIR)/$(BUILD)
60 |
61 | #---------------------------------------------------------------------------------
62 | # automatically build a list of object files for our project
63 | #---------------------------------------------------------------------------------
64 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
65 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
66 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
67 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
68 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
69 | SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf)))
70 | TPLFILES := $(SCFFILES:.scf=.tpl)
71 |
72 | #---------------------------------------------------------------------------------
73 | # use CXX for linking C++ projects, CC for standard C
74 | #---------------------------------------------------------------------------------
75 | ifeq ($(strip $(CPPFILES)),)
76 | export LD := $(CC)
77 | else
78 | export LD := $(CXX)
79 | endif
80 |
81 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
82 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
83 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
84 |
85 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))
86 |
87 | #---------------------------------------------------------------------------------
88 | # build a list of include paths
89 | #---------------------------------------------------------------------------------
90 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
91 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
92 | -I$(CURDIR)/$(BUILD) \
93 | -I$(LIBOGC_INC)
94 |
95 | #---------------------------------------------------------------------------------
96 | # build a list of library paths
97 | #---------------------------------------------------------------------------------
98 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
99 | -L$(LIBOGC_LIB)
100 |
101 | export OUTPUT := $(CURDIR)/$(TARGET)
102 | .PHONY: $(BUILD) clean
103 |
104 | #---------------------------------------------------------------------------------
105 | $(BUILD):
106 | @[ -d $@ ] || mkdir -p $@
107 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
108 |
109 | #---------------------------------------------------------------------------------
110 | clean:
111 | @echo clean ...
112 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
113 | #---------------------------------------------------------------------------------
114 | run:
115 | wiiload $(OUTPUT).dol
116 |
117 | #---------------------------------------------------------------------------------
118 | else
119 |
120 | #---------------------------------------------------------------------------------
121 | # main targets
122 | #---------------------------------------------------------------------------------
123 | $(OUTPUT).dol: $(OUTPUT).elf
124 | $(OUTPUT).elf: $(OFILES)
125 |
126 | $(OFILES_SOURCES) : $(HFILES)
127 |
128 | #---------------------------------------------------------------------------------
129 | # This rule links in binary data with the .bin extension
130 | #---------------------------------------------------------------------------------
131 | %.bin.o %_bin.h : %.bin
132 | #---------------------------------------------------------------------------------
133 | @echo $(notdir $<)
134 | @$(bin2o)
135 |
136 | #---------------------------------------------------------------------------------
137 | %.tpl.o %_tpl.h : %.tpl
138 | #---------------------------------------------------------------------------------
139 | @echo $(notdir $<)
140 | @$(bin2o)
141 |
142 |
143 | -include $(DEPSDIR)/*.d
144 |
145 | #---------------------------------------------------------------------------------
146 | endif
147 | #---------------------------------------------------------------------------------
148 |
--------------------------------------------------------------------------------
/graphics/gx/neheGX/lesson09/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | # Clear the implicit built in rules
3 | #---------------------------------------------------------------------------------
4 | .SUFFIXES:
5 | .SECONDARY:
6 | #---------------------------------------------------------------------------------
7 | ifeq ($(strip $(DEVKITPPC)),)
8 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
9 | endif
10 |
11 | include $(DEVKITPPC)/wii_rules
12 |
13 | #---------------------------------------------------------------------------------
14 | # TARGET is the name of the output
15 | # BUILD is the directory where object files & intermediate files will be placed
16 | # SOURCES is a list of directories containing source code
17 | # INCLUDES is a list of directories containing extra header files
18 | #---------------------------------------------------------------------------------
19 | TARGET := $(notdir $(CURDIR))
20 | BUILD := build
21 | SOURCES := source
22 | DATA :=
23 | TEXTURES := textures
24 | INCLUDES :=
25 |
26 | #---------------------------------------------------------------------------------
27 | # options for code generation
28 | #---------------------------------------------------------------------------------
29 |
30 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
31 | CXXFLAGS = $(CFLAGS)
32 |
33 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
34 |
35 | #---------------------------------------------------------------------------------
36 | # any extra libraries we wish to link with the project
37 | #---------------------------------------------------------------------------------
38 | LIBS := -lwiiuse -lbte -logc -lm
39 |
40 | #---------------------------------------------------------------------------------
41 | # list of directories containing libraries, this must be the top level containing
42 | # include and lib
43 | #---------------------------------------------------------------------------------
44 | LIBDIRS :=
45 |
46 | #---------------------------------------------------------------------------------
47 | # no real need to edit anything past this point unless you need to add additional
48 | # rules for different file extensions
49 | #---------------------------------------------------------------------------------
50 | ifneq ($(BUILD),$(notdir $(CURDIR)))
51 | #---------------------------------------------------------------------------------
52 |
53 | export OUTPUT := $(CURDIR)/$(TARGET)
54 |
55 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
56 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
57 | $(foreach dir,$(TEXTURES),$(CURDIR)/$(dir))
58 |
59 | export DEPSDIR := $(CURDIR)/$(BUILD)
60 |
61 | #---------------------------------------------------------------------------------
62 | # automatically build a list of object files for our project
63 | #---------------------------------------------------------------------------------
64 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
65 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
66 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
67 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
68 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
69 | SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf)))
70 | TPLFILES := $(SCFFILES:.scf=.tpl)
71 |
72 | #---------------------------------------------------------------------------------
73 | # use CXX for linking C++ projects, CC for standard C
74 | #---------------------------------------------------------------------------------
75 | ifeq ($(strip $(CPPFILES)),)
76 | export LD := $(CC)
77 | else
78 | export LD := $(CXX)
79 | endif
80 |
81 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
82 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
83 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
84 |
85 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))
86 |
87 | #---------------------------------------------------------------------------------
88 | # build a list of include paths
89 | #---------------------------------------------------------------------------------
90 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
91 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
92 | -I$(CURDIR)/$(BUILD) \
93 | -I$(LIBOGC_INC)
94 |
95 | #---------------------------------------------------------------------------------
96 | # build a list of library paths
97 | #---------------------------------------------------------------------------------
98 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
99 | -L$(LIBOGC_LIB)
100 |
101 | export OUTPUT := $(CURDIR)/$(TARGET)
102 | .PHONY: $(BUILD) clean
103 |
104 | #---------------------------------------------------------------------------------
105 | $(BUILD):
106 | @[ -d $@ ] || mkdir -p $@
107 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
108 |
109 | #---------------------------------------------------------------------------------
110 | clean:
111 | @echo clean ...
112 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
113 | #---------------------------------------------------------------------------------
114 | run:
115 | wiiload $(OUTPUT).dol
116 |
117 | #---------------------------------------------------------------------------------
118 | else
119 |
120 | #---------------------------------------------------------------------------------
121 | # main targets
122 | #---------------------------------------------------------------------------------
123 | $(OUTPUT).dol: $(OUTPUT).elf
124 | $(OUTPUT).elf: $(OFILES)
125 |
126 | $(OFILES_SOURCES) : $(HFILES)
127 |
128 | #---------------------------------------------------------------------------------
129 | # This rule links in binary data with the .bin extension
130 | #---------------------------------------------------------------------------------
131 | %.bin.o %_bin.h : %.bin
132 | #---------------------------------------------------------------------------------
133 | @echo $(notdir $<)
134 | @$(bin2o)
135 |
136 | #---------------------------------------------------------------------------------
137 | %.tpl.o %_tpl.h : %.tpl
138 | #---------------------------------------------------------------------------------
139 | @echo $(notdir $<)
140 | @$(bin2o)
141 |
142 |
143 | -include $(DEPSDIR)/*.d
144 |
145 | #---------------------------------------------------------------------------------
146 | endif
147 | #---------------------------------------------------------------------------------
148 |
--------------------------------------------------------------------------------