Ver código fonte

* Updated libndsfpc to 1.4.10:
+ Added support for Tetris paddle, Guitar Hero grip and easy piano controller
+ Added sdmmc support for reading DSi internal SD card
+ i2c communication functions for DSi
+ Added some time handling related examples
* Improved timing functions
* Some small bug fixes and improvements, both in library and examples
- Removed unused SVN macros from header and license infos to save space :)

git-svn-id: trunk@16879 -

Legolas 14 anos atrás
pai
commit
c3698c84be
82 arquivos alterados com 6231 adições e 2366 exclusões
  1. 17 5
      .gitattributes
  2. 44 18
      .gitignore
  3. 0 93
      packages/libndsfpc/examples/RealTimeClock/Watch/Makefile.fpc
  4. 8 3
      packages/libndsfpc/examples/graphics/3D/3D_Both_Screens/3DBothScreens.pp
  5. 1 1
      packages/libndsfpc/examples/graphics/3D/Display_List/DisplayList.pp
  6. 1 1
      packages/libndsfpc/examples/graphics/3D/Env_Mapping/EnvMapping.pp
  7. 10 4
      packages/libndsfpc/examples/graphics/3D/Paletted_Cube/PalettedCube.pp
  8. 6 6
      packages/libndsfpc/examples/graphics/3D/Picking/Picking.pp
  9. 1 1
      packages/libndsfpc/examples/graphics/3D/Simple_Quad/SimpleQuad.pp
  10. 1 1
      packages/libndsfpc/examples/graphics/3D/Simple_Tri/SimpleTri.pp
  11. 58 1
      packages/libndsfpc/examples/graphics/3D/Textured_Cube/TexturedCube.pp
  12. 1 1
      packages/libndsfpc/examples/graphics/3D/Textured_Quad/TexturedQuad.pp
  13. BIN
      packages/libndsfpc/examples/graphics/3D/nehe/lesson10/data/drunkenlogo.pcx
  14. 130 5
      packages/libndsfpc/examples/graphics/3D/nehe/lesson10/lesson10.pp
  15. 11 8
      packages/libndsfpc/examples/graphics/3D/nehe/lesson10b/lesson10b.pp
  16. 5 1
      packages/libndsfpc/examples/graphics/Backgrounds/16bit_color_bmp/16bitColorBmp.pp
  17. 1 1
      packages/libndsfpc/examples/graphics/Backgrounds/Double_Buffer/DoubleBuffer.pp
  18. 2 2
      packages/libndsfpc/examples/graphics/Sprites/bitmap_sprites/BitmapSprites.pp
  19. 1 1
      packages/libndsfpc/examples/graphics/Sprites/fire_and_sprites/FireAndSprites.pp
  20. 0 6
      packages/libndsfpc/examples/input/Touch_Pad/touch_test/touchTest.pp
  21. 415 190
      packages/libndsfpc/examples/time/Makefile
  22. 1 1
      packages/libndsfpc/examples/time/Makefile.fpc
  23. 170 376
      packages/libndsfpc/examples/time/RealTimeClock/Makefile
  24. 46 0
      packages/libndsfpc/examples/time/RealTimeClock/Makefile.fpc
  25. 1 1
      packages/libndsfpc/examples/time/RealTimeClock/realtimeclock.pp
  26. 2384 0
      packages/libndsfpc/examples/time/stopwatch/Makefile
  27. 46 0
      packages/libndsfpc/examples/time/stopwatch/Makefile.fpc
  28. 68 0
      packages/libndsfpc/examples/time/stopwatch/stopwatch.pp
  29. 2384 0
      packages/libndsfpc/examples/time/timercallback/Makefile
  30. 46 0
      packages/libndsfpc/examples/time/timercallback/Makefile.fpc
  31. 44 0
      packages/libndsfpc/examples/time/timercallback/timercallback.pp
  32. 1 41
      packages/libndsfpc/src/nds/arm7/audio.inc
  33. 1 41
      packages/libndsfpc/src/nds/arm7/clock.inc
  34. 34 0
      packages/libndsfpc/src/nds/arm7/i2c.inc
  35. 0 2
      packages/libndsfpc/src/nds/arm7/input.inc
  36. 94 0
      packages/libndsfpc/src/nds/arm7/sdmmc.inc
  37. 1 41
      packages/libndsfpc/src/nds/arm7/serial.inc
  38. 1 41
      packages/libndsfpc/src/nds/arm7/touch.inc
  39. 0 40
      packages/libndsfpc/src/nds/arm9/background.inc
  40. 0 41
      packages/libndsfpc/src/nds/arm9/boxtest.inc
  41. 0 45
      packages/libndsfpc/src/nds/arm9/cache.inc
  42. 1 41
      packages/libndsfpc/src/nds/arm9/console.inc
  43. 0 40
      packages/libndsfpc/src/nds/arm9/decompress.inc
  44. 0 40
      packages/libndsfpc/src/nds/arm9/dynamicArray.inc
  45. 0 40
      packages/libndsfpc/src/nds/arm9/exceptions.inc
  46. 17 0
      packages/libndsfpc/src/nds/arm9/guitarGrip.inc
  47. 0 40
      packages/libndsfpc/src/nds/arm9/image.inc
  48. 0 40
      packages/libndsfpc/src/nds/arm9/input.inc
  49. 0 27
      packages/libndsfpc/src/nds/arm9/linkedlist.inc
  50. 0 40
      packages/libndsfpc/src/nds/arm9/math.inc
  51. 0 38
      packages/libndsfpc/src/nds/arm9/ndsmotion.inc
  52. 6 0
      packages/libndsfpc/src/nds/arm9/paddle.inc
  53. 0 40
      packages/libndsfpc/src/nds/arm9/pcx.inc
  54. 24 0
      packages/libndsfpc/src/nds/arm9/piano.inc
  55. 0 38
      packages/libndsfpc/src/nds/arm9/postest.inc
  56. 0 40
      packages/libndsfpc/src/nds/arm9/rumble.inc
  57. 0 41
      packages/libndsfpc/src/nds/arm9/sassert.inc
  58. 0 40
      packages/libndsfpc/src/nds/arm9/sound.inc
  59. 0 42
      packages/libndsfpc/src/nds/arm9/sprite.inc
  60. 0 40
      packages/libndsfpc/src/nds/arm9/trig_lut.inc
  61. 38 45
      packages/libndsfpc/src/nds/arm9/video.inc
  62. 1 42
      packages/libndsfpc/src/nds/arm9/videoGL.inc
  63. 0 40
      packages/libndsfpc/src/nds/bios.inc
  64. 1 34
      packages/libndsfpc/src/nds/card.inc
  65. 0 40
      packages/libndsfpc/src/nds/debug.inc
  66. 10 40
      packages/libndsfpc/src/nds/disc_io.inc
  67. 0 42
      packages/libndsfpc/src/nds/dma.inc
  68. 8 44
      packages/libndsfpc/src/nds/fifocommon.inc
  69. 9 29
      packages/libndsfpc/src/nds/fifomessages.inc
  70. 0 37
      packages/libndsfpc/src/nds/helper.inc
  71. 0 40
      packages/libndsfpc/src/nds/input.inc
  72. 1 42
      packages/libndsfpc/src/nds/interrupts.inc
  73. 0 40
      packages/libndsfpc/src/nds/jtypes.inc
  74. 0 40
      packages/libndsfpc/src/nds/memory.inc
  75. 1 5
      packages/libndsfpc/src/nds/nds.inc
  76. 4 0
      packages/libndsfpc/src/nds/ndsinclude.inc
  77. 0 40
      packages/libndsfpc/src/nds/ndstypes.inc
  78. 0 40
      packages/libndsfpc/src/nds/registers_alt.inc
  79. 0 40
      packages/libndsfpc/src/nds/system.inc
  80. 12 40
      packages/libndsfpc/src/nds/timers.inc
  81. 32 0
      packages/libndsfpc/src/nds7.pp
  82. 31 0
      packages/libndsfpc/src/nds9.pp

+ 17 - 5
.gitattributes

@@ -3973,11 +3973,6 @@ packages/libndsfpc/Makefile svneol=native#text/plain
 packages/libndsfpc/Makefile.fpc svneol=native#text/plain
 packages/libndsfpc/examples/Makefile svneol=native#text/plain
 packages/libndsfpc/examples/Makefile.fpc svneol=native#text/plain
-packages/libndsfpc/examples/RealTimeClock/Makefile svneol=native#text/plain
-packages/libndsfpc/examples/RealTimeClock/Makefile.fpc svneol=native#text/plain
-packages/libndsfpc/examples/RealTimeClock/Watch/Makefile svneol=native#text/plain
-packages/libndsfpc/examples/RealTimeClock/Watch/Makefile.fpc svneol=native#text/plain
-packages/libndsfpc/examples/RealTimeClock/Watch/watch.pp svneol=native#text/plain
 packages/libndsfpc/examples/audio/Makefile svneol=native#text/plain
 packages/libndsfpc/examples/audio/Makefile.fpc svneol=native#text/plain
 packages/libndsfpc/examples/audio/maxmod/Makefile svneol=native#text/plain
@@ -4164,6 +4159,7 @@ packages/libndsfpc/examples/graphics/3D/nehe/lesson10/Makefile svneol=native#tex
 packages/libndsfpc/examples/graphics/3D/nehe/lesson10/Makefile.fpc svneol=native#text/plain
 packages/libndsfpc/examples/graphics/3D/nehe/lesson10/data/Mud.pcx -text
 packages/libndsfpc/examples/graphics/3D/nehe/lesson10/data/World.txt svneol=native#text/plain
+packages/libndsfpc/examples/graphics/3D/nehe/lesson10/data/drunkenlogo.pcx -text
 packages/libndsfpc/examples/graphics/3D/nehe/lesson10/lesson10.pp svneol=native#text/plain
 packages/libndsfpc/examples/graphics/3D/nehe/lesson10b/Makefile svneol=native#text/plain
 packages/libndsfpc/examples/graphics/3D/nehe/lesson10b/Makefile.fpc svneol=native#text/plain
@@ -4288,6 +4284,17 @@ packages/libndsfpc/examples/input/keyboard/keyboard_async/keyboardAsync.pp svneo
 packages/libndsfpc/examples/input/keyboard/keyboard_stdin/Makefile svneol=native#text/plain
 packages/libndsfpc/examples/input/keyboard/keyboard_stdin/Makefile.fpc svneol=native#text/plain
 packages/libndsfpc/examples/input/keyboard/keyboard_stdin/keyboardStdin.pp svneol=native#text/plain
+packages/libndsfpc/examples/time/Makefile svneol=native#text/plain
+packages/libndsfpc/examples/time/Makefile.fpc svneol=native#text/plain
+packages/libndsfpc/examples/time/RealTimeClock/Makefile svneol=native#text/plain
+packages/libndsfpc/examples/time/RealTimeClock/Makefile.fpc svneol=native#text/plain
+packages/libndsfpc/examples/time/RealTimeClock/realtimeclock.pp svneol=native#text/plain
+packages/libndsfpc/examples/time/stopwatch/Makefile svneol=native#text/plain
+packages/libndsfpc/examples/time/stopwatch/Makefile.fpc svneol=native#text/plain
+packages/libndsfpc/examples/time/stopwatch/stopwatch.pp svneol=native#text/plain
+packages/libndsfpc/examples/time/timercallback/Makefile svneol=native#text/plain
+packages/libndsfpc/examples/time/timercallback/Makefile.fpc svneol=native#text/plain
+packages/libndsfpc/examples/time/timercallback/timercallback.pp svneol=native#text/plain
 packages/libndsfpc/fpmake.pp svneol=native#text/plain
 packages/libndsfpc/src/dswifi/dswifi7.pp svneol=native#text/plain
 packages/libndsfpc/src/dswifi/dswifi9.pp svneol=native#text/plain
@@ -4315,7 +4322,9 @@ packages/libndsfpc/src/maxmod/maxmod7.pp svneol=native#text/plain
 packages/libndsfpc/src/maxmod/maxmod9.pp svneol=native#text/plain
 packages/libndsfpc/src/nds/arm7/audio.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm7/clock.inc svneol=native#text/plain
+packages/libndsfpc/src/nds/arm7/i2c.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm7/input.inc svneol=native#text/plain
+packages/libndsfpc/src/nds/arm7/sdmmc.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm7/serial.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm7/touch.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/background.inc svneol=native#text/plain
@@ -4326,13 +4335,16 @@ packages/libndsfpc/src/nds/arm9/decompress.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/dldi.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/dynamicArray.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/exceptions.inc svneol=native#text/plain
+packages/libndsfpc/src/nds/arm9/guitarGrip.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/image.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/input.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/keyboard.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/linkedlist.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/math.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/ndsmotion.inc svneol=native#text/plain
+packages/libndsfpc/src/nds/arm9/paddle.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/pcx.inc svneol=native#text/plain
+packages/libndsfpc/src/nds/arm9/piano.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/postest.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/rumble.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/arm9/sassert.inc svneol=native#text/plain

+ 44 - 18
.gitignore

@@ -3074,30 +3074,13 @@ packages/libndsfpc/*.ppu
 packages/libndsfpc/*.s
 packages/libndsfpc/Package.fpc
 packages/libndsfpc/build-stamp.*
+packages/libndsfpc/build_docs.bat
 packages/libndsfpc/examples/*.bak
 packages/libndsfpc/examples/*.exe
 packages/libndsfpc/examples/*.o
 packages/libndsfpc/examples/*.ppu
 packages/libndsfpc/examples/*.s
 packages/libndsfpc/examples/Package.fpc
-packages/libndsfpc/examples/RealTimeClock/*.bak
-packages/libndsfpc/examples/RealTimeClock/*.exe
-packages/libndsfpc/examples/RealTimeClock/*.o
-packages/libndsfpc/examples/RealTimeClock/*.ppu
-packages/libndsfpc/examples/RealTimeClock/*.s
-packages/libndsfpc/examples/RealTimeClock/Package.fpc
-packages/libndsfpc/examples/RealTimeClock/Watch/*.bak
-packages/libndsfpc/examples/RealTimeClock/Watch/*.exe
-packages/libndsfpc/examples/RealTimeClock/Watch/*.o
-packages/libndsfpc/examples/RealTimeClock/Watch/*.ppu
-packages/libndsfpc/examples/RealTimeClock/Watch/*.s
-packages/libndsfpc/examples/RealTimeClock/Watch/Package.fpc
-packages/libndsfpc/examples/RealTimeClock/Watch/build-stamp.*
-packages/libndsfpc/examples/RealTimeClock/Watch/fpcmade.*
-packages/libndsfpc/examples/RealTimeClock/Watch/units
-packages/libndsfpc/examples/RealTimeClock/build-stamp.*
-packages/libndsfpc/examples/RealTimeClock/fpcmade.*
-packages/libndsfpc/examples/RealTimeClock/units
 packages/libndsfpc/examples/audio/*.bak
 packages/libndsfpc/examples/audio/*.exe
 packages/libndsfpc/examples/audio/*.o
@@ -4119,8 +4102,51 @@ packages/libndsfpc/examples/input/keyboard/keyboard_stdin/fpcmade.*
 packages/libndsfpc/examples/input/keyboard/keyboard_stdin/units
 packages/libndsfpc/examples/input/keyboard/units
 packages/libndsfpc/examples/input/units
+packages/libndsfpc/examples/time/*.bak
+packages/libndsfpc/examples/time/*.exe
+packages/libndsfpc/examples/time/*.o
+packages/libndsfpc/examples/time/*.ppu
+packages/libndsfpc/examples/time/*.s
+packages/libndsfpc/examples/time/Package.fpc
+packages/libndsfpc/examples/time/RealTimeClock/*.bak
+packages/libndsfpc/examples/time/RealTimeClock/*.exe
+packages/libndsfpc/examples/time/RealTimeClock/*.o
+packages/libndsfpc/examples/time/RealTimeClock/*.ppu
+packages/libndsfpc/examples/time/RealTimeClock/*.s
+packages/libndsfpc/examples/time/RealTimeClock/Package.fpc
+packages/libndsfpc/examples/time/RealTimeClock/build-stamp.*
+packages/libndsfpc/examples/time/RealTimeClock/fpcmade.*
+packages/libndsfpc/examples/time/RealTimeClock/units
+packages/libndsfpc/examples/time/build-stamp.*
+packages/libndsfpc/examples/time/fpcmade.*
+packages/libndsfpc/examples/time/stopwatch/*.bak
+packages/libndsfpc/examples/time/stopwatch/*.exe
+packages/libndsfpc/examples/time/stopwatch/*.o
+packages/libndsfpc/examples/time/stopwatch/*.ppu
+packages/libndsfpc/examples/time/stopwatch/*.s
+packages/libndsfpc/examples/time/stopwatch/Package.fpc
+packages/libndsfpc/examples/time/stopwatch/build-stamp.*
+packages/libndsfpc/examples/time/stopwatch/fpcmade.*
+packages/libndsfpc/examples/time/stopwatch/units
+packages/libndsfpc/examples/time/timercallback/*.bak
+packages/libndsfpc/examples/time/timercallback/*.exe
+packages/libndsfpc/examples/time/timercallback/*.o
+packages/libndsfpc/examples/time/timercallback/*.ppu
+packages/libndsfpc/examples/time/timercallback/*.s
+packages/libndsfpc/examples/time/timercallback/Package.fpc
+packages/libndsfpc/examples/time/timercallback/build-stamp.*
+packages/libndsfpc/examples/time/timercallback/fpcmade.*
+packages/libndsfpc/examples/time/timercallback/units
+packages/libndsfpc/examples/time/units
 packages/libndsfpc/examples/units
 packages/libndsfpc/fpcmade.*
+packages/libndsfpc/fpdoc.css
+packages/libndsfpc/ndsDoc[!!-~]-[!!-~]Copia.xml
+packages/libndsfpc/ndsDoc.blg
+packages/libndsfpc/ndsDoc.chm
+packages/libndsfpc/ndsDoc.new.xml
+packages/libndsfpc/ndsDoc.xml
+packages/libndsfpc/ndsDoc.~xml
 packages/libndsfpc/src/*.bak
 packages/libndsfpc/src/*.exe
 packages/libndsfpc/src/*.o

+ 0 - 93
packages/libndsfpc/examples/RealTimeClock/Watch/Makefile.fpc

@@ -1,93 +0,0 @@
-#
-#   Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
-#
-
-[target]
-loaders= 
-programs=watch
-
-[require]
-packages=libndsfpc
-tools=bin2s mmutil grit rmdir
-nortl=y
-
-[install]
-fpcpackage=y
-
-[default]
-cpu=arm
-target=nds
-fpcdir=../../../../..
-
-[compiler]
-options=-g -Xm
-#-d__THUMB__
-
-[clean]
-files=*.elf *.o *.s *.nds *.nef *.h *.bin \
-       $(BUILD)/* \
-       $(INC)/*
-units=*
-
-[prerules]
-BUILD = build
-INC = inc
-AUDIO_FILES = $(foreach dir, $(notdir $(wildcard audio/*.*)), $(CURDIR)/audio/$(dir))
-GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png)))
-BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
-
-[rules]
-.NOTPARALLEL:
-clean: dir_delete fpc_clean fpc_cleanall
-all: dir_make $(BIN_FILES) $(GFX_FILES) fpc_all 
-
-#
-# Delete temp directories
-#
-dir_delete:
-        @$(DELTREE) $(CURDIR)/$(BUILD) 
-        @$(DELTREE) $(CURDIR)/$(INC) 
-        
-#
-# Create temp directories
-#
-dir_make:
-ifneq ($(BUILD), $(CURDIR))
-        @$(MKDIR) $(BUILD)
-endif
-ifneq ($(INC), $(CURDIR))
-        @$(MKDIR) $(INC)
-endif
-
-#
-# Audio files processing rule
-#
-soundbank.bin.o : $(AUDIO_FILES)
-        @$(MMUTIL) $^ -d -o$(BUILD)/soundbank.bin -h$(BUILD)/soundbank.h
-        $(BIN2S) $(BUILD)/soundbank.bin > $(BUILD)/soundbank.bin.s
-        $(AS) -o $(BUILD)/soundbank.bin.o $(BUILD)/soundbank.bin.s
-
-#
-# Png files processing rule
-#
-$(GFX_FILES): $(wildcard %.png) 
-        @echo 'Converting $(@) file to asm...'
-        $(GRIT) gfx/$(@) -fts -ff gfx/$(basename $(@)).grit -o$(BUILD)/$(@)
-        @echo 'Assembling $(@).s file...'
-        $(AS) -o $(BUILD)/$(basename $(@)).o $(BUILD)/$(basename $(@)).s
-        @echo 'Done!'
-
-#
-# Binary files processing rule
-# 
-$(BIN_FILES): $(wildcard %.*)
-        @echo 'Converting $(@) file to asm...'
-        @$(BIN2S) data/$(@) > $(BUILD)/$(@).s
-        @echo 'Creating $(@).inc include file...'
-        @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
-        @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
-        @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
-        @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
-        @echo 'Assembling $(@).s file...'
-        @$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
-        @echo 'Done!'

+ 8 - 3
packages/libndsfpc/examples/graphics/3D/3D_Both_Screens/3DBothScreens.pp

@@ -104,6 +104,7 @@ procedure initSubSprites();
 var
   x: integer;
   y: integer;
+  id: integer;
   offset: pcuint16;
 begin
   oamInit(oamSub, SpriteMapping_Bmp_2D_256, false);
@@ -115,9 +116,13 @@ begin
   for y := 0 to 2 do
     for x := 0 to 3 do
     begin
-      offset := pcuint16(@SPRITE_GFX_SUB[(x * 64) + (y * 64 * 256)]);
-      oamSet(oamSub, x + y * 4, x * 64, y * 64, 0, 15, SpriteSize_64x64, 
-			SpriteColorFormat_Bmp, offset, -1, false,false,false,false,false);
+//      offset := pcuint16(@SPRITE_GFX_SUB[(x * 64) + (y * 64 * 256)]);
+//      oamSet(oamSub, x + y * 4, x * 64, y * 64, 0, 15, SpriteSize_64x64, 
+//      SpriteColorFormat_Bmp, offset, -1, false,false,false,false,false);
+      oamSub.oamMemory[id].attribute[0] := ATTR0_BMP or ATTR0_SQUARE or (64 * y);
+      oamSub.oamMemory[id].attribute[1] := ATTR1_SIZE_64 or (64 * x);
+      oamSub.oamMemory[id].attribute[2] := ATTR2_ALPHA(1) or (8 * 32 * y) or (8 * x);
+      inc(id);
     end;
  
   swiWaitForVBlank();

+ 1 - 1
packages/libndsfpc/examples/graphics/3D/Display_List/DisplayList.pp

@@ -61,7 +61,7 @@ begin
     glPushMatrix();
 
     //move it away from the camera
-    glTranslate3f32(0, 0, floattof32(-1.0));
+    glTranslatef32(0, 0, floattof32(-1.0));
 
     glRotateX(rotateX);
     glRotateY(rotateY);

+ 1 - 1
packages/libndsfpc/examples/graphics/3D/Env_Mapping/EnvMapping.pp

@@ -98,7 +98,7 @@ begin
 
 		glMatrixMode(GL_POSITION);
 		glLoadIdentity();
-		glTranslate3f32(0, 0, floattof32(-3));
+		glTranslatef32(0, 0, floattof32(-3));
 		glRotateXi(rotateX);
 		glRotateYi(rotateY);
 

+ 10 - 4
packages/libndsfpc/examples/graphics/3D/Paletted_Cube/PalettedCube.pp

@@ -129,7 +129,7 @@ type
 var
   textureIDS: array [0..9] of cint;
   textures: array [0..9] of TTextures;
-  i: integer;
+  i, j: integer;
   rotateX: cfloat = 0.0;
   rotateY: cfloat = 0.0;
   keyspressed: cuint16;
@@ -143,7 +143,7 @@ begin
   //set mode 0, enable BG0 and set it to 3D
   videoSetMode(MODE_0_3D);
   consoleDemoInit();
-
+  consoleDebugInit(DebugDevice_NOCASH);
 
   // initialize gl
   glInit();
@@ -175,7 +175,9 @@ begin
   glLight(0, RGB15(31,31,31) , 0, floattov10(-0.5), floattov10(-0.85));
 
   vramSetBankA(VRAM_A_TEXTURE);
-
+  vramSetBankF(VRAM_F_TEX_PALETTE_SLOT0);
+  vramSetBankG(VRAM_G_TEX_PALETTE_SLOT1);
+	
   glGenTextures(10, textureIDS);
 
   // inital full 16 bit colour texture
@@ -235,7 +237,10 @@ begin
   glBindTexture(0, textureIDS[8]);
   glTexImage2D(0, 0, GL_RGB32_A3, TEXTURE_SIZE_128, TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD, pcuint8(@texture8_RGB32_A3_tex_bin));
   textures[8].format := GL_RGB32_A3;
-  textures[8].pal_addr := gluTexLoadPal( pcuint16(@texture8_RGB32_A3_pal_bin), 32, GL_RGB32_A3 );
+	// this line seems stupid, but for purposes of a demo, it will prove that you can 
+	// load palettes to F and G by pushing the allocated textures from F and into G
+  for i := 0 to 299 do
+    textures[8].pal_addr := gluTexLoadPal( pcuint16(@texture8_RGB32_A3_pal_bin), 32, GL_RGB32_A3 );
   textures[8].size := texture8_RGB32_A3_tex_bin_size+texture8_RGB32_A3_pal_bin_size;
 
   glBindTexture(0, textureIDS[9]);
@@ -304,6 +309,7 @@ begin
     glPopMatrix(1);
 
     glFlush(0);
+    swiWaitForVBlank();
   end;
 
 end.

+ 6 - 6
packages/libndsfpc/examples/graphics/3D/Picking/Picking.pp

@@ -110,7 +110,7 @@ begin
 			glPushMatrix(); // save the state of the modelview matrix while making the first pass
 				// draw the scene for displaying
 				
-				glTranslate3f32(floattof32(2.9),floattof32(0),floattof32(0)); // translate the modelview matrix to the drawing location
+				glTranslatef32(floattof32(2.9),floattof32(0),floattof32(0)); // translate the modelview matrix to the drawing location
 				if (clicked = clCone) then
 					glPolyFmt(POLY_ALPHA(31) or POLY_CULL_BACK or POLY_FORMAT_LIGHT0 or POLY_ID(1)) // set a poly ID for outlining
 				else
@@ -119,7 +119,7 @@ begin
 				glCallList((@cone_bin)); // draw a green cone from a predefined packed command list
 
 				
-				glTranslate3f32(floattof32(-3),floattof32(1.8),floattof32(2)); // translate the modelview matrix to the drawing location
+				glTranslatef32(floattof32(-3),floattof32(1.8),floattof32(2)); // translate the modelview matrix to the drawing location
 				if (clicked = clCylinder) then
 					glPolyFmt(POLY_ALPHA(31) or POLY_CULL_BACK or POLY_FORMAT_LIGHT0 or POLY_ID(1)) // set a poly ID for outlining
 				else
@@ -128,7 +128,7 @@ begin
         glCallList((@cylinder_bin)); // draw a blue cylinder from a predefined packed command list
 
 
-				glTranslate3f32(floattof32(0.5),floattof32(-2.6),floattof32(-4)); // translate the modelview matrix to the drawing location
+				glTranslatef32(floattof32(0.5),floattof32(-2.6),floattof32(-4)); // translate the modelview matrix to the drawing location
 				if(clicked = clSphere) then
 					glPolyFmt(POLY_ALPHA(31) or POLY_CULL_BACK or POLY_FORMAT_LIGHT0 or POLY_ID(1)) // set a poly ID for outlining
 				else
@@ -153,17 +153,17 @@ begin
 				
 				glMatrixMode(GL_MODELVIEW); // switch back to modifying the modelview matrix for drawing
 				
-				glTranslate3f32(floattof32(2.9),floattof32(0),floattof32(0)); // translate the modelview matrix to the drawing location
+				glTranslatef32(floattof32(2.9),floattof32(0),floattof32(0)); // translate the modelview matrix to the drawing location
 				startCheck();
 				glCallList((@cone_bin)); // draw a cone from a predefined packed command list
 				endCheck(clCone);
 
-				glTranslate3f32(floattof32(-3),floattof32(1.8),floattof32(2)); // translate the modelview matrix to the drawing location
+				glTranslatef32(floattof32(-3),floattof32(1.8),floattof32(2)); // translate the modelview matrix to the drawing location
 				startCheck();
 				glCallList((@cylinder_bin)); // draw a cylinder from a predefined packed command list
 				endCheck(clCylinder);
 
-				glTranslate3f32(floattof32(0.5),floattof32(-2.6),floattof32(-4)); // translate the modelview matrix to the drawing location
+				glTranslatef32(floattof32(0.5),floattof32(-2.6),floattof32(-4)); // translate the modelview matrix to the drawing location
 				startCheck();
 				glCallList((@sphere_bin)); // draw a sphere from a predefined packed command list
 				endCheck(clSphere);

+ 1 - 1
packages/libndsfpc/examples/graphics/3D/Simple_Quad/SimpleQuad.pp

@@ -42,7 +42,7 @@ begin
     glPushMatrix();
 
     //move it away from the camera
-    glTranslate3f32(0, 0, floattof32(-1));
+    glTranslatef32(0, 0, floattof32(-1));
 
     glRotateX(rotateX);
     glRotateY(rotateY);

+ 1 - 1
packages/libndsfpc/examples/graphics/3D/Simple_Tri/SimpleTri.pp

@@ -43,7 +43,7 @@ begin
     glPushMatrix();
 
     //move it away from the camera
-    glTranslate3f32(0, 0, floattof32(-1));
+    glTranslatef32(0, 0, floattof32(-1));
 
     glRotateX(rotateX);
     glRotateY(rotateY);

+ 58 - 1
packages/libndsfpc/examples/graphics/3D/Textured_Cube/TexturedCube.pp

@@ -79,6 +79,28 @@ begin
   glVertex3v16(CubeVectors[f4*3], CubeVectors[f4*3 + 1], CubeVectors[f4*3 + 2] );
 end;
 
+procedure DisplayEnableMotionBlur();
+var
+  dispcnt: cuint32;
+begin
+  dispcnt := REG_DISPCNT^;
+  //set main display to display from VRAM
+  dispcnt := dispcnt and ($00030000 xor $FFFFFFFF); 
+  dispcnt := dispcnt or (2 shl 16); //choose to display screen from VRAM
+  dispcnt := dispcnt and ($000C0000 xor $FFFFFFFF); 
+  dispcnt := dispcnt or (1 shl 18); //choose to display screen from VRAM_B
+  REG_DISPCNT^ := dispcnt;
+end;
+ 
+procedure DisplayEnableNormal();
+var         
+  dispcnt: cuint32;
+begin
+  dispcnt := REG_DISPCNT^;
+  dispcnt := dispcnt and ($00030000 xor $FFFFFFFF); 
+  dispcnt := dispcnt or (1 shl 16); //choose to display screen from normal layer composition
+  REG_DISPCNT^ := dispcnt;
+end;
 
 var
   textureID: integer;
@@ -86,6 +108,7 @@ var
   rotateX: cfloat = 0.0;
   rotateY: cfloat = 0.0;
   keys: cuint16;
+  displayBlurred: boolean;
 
 begin
   Initialize();
@@ -109,6 +132,28 @@ begin
   glClearPolyID(63); // BG must have a unique polygon ID for AA to work
   glClearDepth($7FFF);
 
+
+  vramSetBankB(VRAM_B_LCD);
+  REG_DISPCAPCNT^ := DCAP_MODE(DCAP_MODE_BLEND) //blend source A and source B
+                      //or  DCAP_SRC_ADDR //this is not used since we are setting the display to render from VRAM
+                      or    DCAP_SRC_B(DCAP_SRC_B_VRAM)
+                      or    DCAP_SRC_A(DCAP_SRC_A_3DONLY)
+                      or    DCAP_SIZE(DCAP_SIZE_256x192)
+                      or    DCAP_OFFSET(0) //where to write the captured data within our chosen VRAM bank
+                      or    DCAP_BANK(DCAP_BANK_VRAM_B)
+                      or    DCAP_B(12) //blend mostly from B to make a very dramatic effect
+                      or    DCAP_A(4) //and blend only a little bit from the new scene
+                      ;
+  //but, dramatic effects tend to leave some garbage on the screen since the precision of the math is low,
+  //and we're not putting a lot of dampening on the effect.
+  //a more realistic value might be 8 and 8, but perhaps in a more complex 3d scene the garbage isn't such a bad thing
+  //since the scene is changing constantly
+ 
+  DisplayEnableMotionBlur();
+  displayBlurred := true;
+ 
+ 
+
   vramSetBankA(VRAM_A_TEXTURE);
 
   glGenTextures(1, @textureID);
@@ -135,7 +180,7 @@ begin
     glPushMatrix();
 
     //move it away from the camera
-    glTranslate3f32(0, 0, floattof32(-1));
+    glTranslatef32(0, 0, floattof32(-1));
 
     glRotateX(rotateX);
     glRotateY(rotateY);
@@ -166,6 +211,15 @@ begin
 		if((keys and KEY_LEFT)) <> 0 then rotateY := rotateY +3;
 		if((keys and KEY_RIGHT)) <> 0 then rotateY := rotateY -3;
 
+    if (keysDown() and KEY_A) <> 0 then
+    begin
+      displayBlurred := not displayBlurred;
+      if displayBlurred then
+        DisplayEnableMotionBlur()
+      else
+        DisplayEnableNormal();
+    end;
+
 		glBindTexture(0, textureID);
 
 		//draw the obj
@@ -179,5 +233,8 @@ begin
 		glFlush(0);
 
 		swiWaitForVBlank();
+    
+    //the display capture enable bit must be set again each frame if you want to continue capturing.
+    REG_DISPCAPCNT^ := REG_DISPCAPCNT^ or DCAP_ENABLE;		
   end;
 end.

+ 1 - 1
packages/libndsfpc/examples/graphics/3D/Textured_Quad/TexturedQuad.pp

@@ -58,7 +58,7 @@ begin
     glPushMatrix();
 
     //move it away from the camera
-    glTranslate3f32(0, 0, floattof32(-1));
+    glTranslatef32(0, 0, floattof32(-1));
 
     glRotateX(rotateX);
     glRotateY(rotateY);

BIN
packages/libndsfpc/examples/graphics/3D/nehe/lesson10/data/drunkenlogo.pcx


+ 130 - 5
packages/libndsfpc/examples/graphics/3D/nehe/lesson10/lesson10.pp

@@ -7,12 +7,14 @@ program Lesson10;
 
 {$L build/Mud.pcx.o}
 {$L build/World.txt.o}
+{$L build/drunkenlogo.pcx.o}
 
 uses
   ctypes, nds9;
 
 {$include inc/Mud.pcx.inc}
 {$include inc/World.txt.inc}
+{$include inc/drunkenlogo.pcx.inc}
 
 const
   piover180: cfloat = 0.0174532925;
@@ -47,10 +49,17 @@ type
   end;
   SECTOR = tagSECTOR;
 
+  TCubeRot = record
+    x, y, z: cfloat;
+  end;
+
 var
   sector1: SECTOR;        // Our Model Goes Here:
   Myfile: pchar;
+  cuberot: TCubeRot;
 
+procedure ShadowDemo(); forward;
+  
 function DrawGLScene(): boolean;
 var
   x_m, y_m, z_m:  cfloat;
@@ -104,6 +113,7 @@ begin
       glTexCoord2f(u_m,v_m); glVertex3f(x_m,y_m,z_m);
     glEnd();
   end;
+  ShadowDemo();
   DrawGLScene := true;                    // Everything Went OK
 end;
 
@@ -184,25 +194,125 @@ function LoadGLTextures(): boolean;
 var
   pcx: sImage;
 begin
+  glGenTextures(2, @texture[0]);
+
   //load our texture
   loadPCX(pcuint8(Mud_pcx), @pcx);
 
   image8to16(@pcx);
 
-  glGenTextures(1, @texture[0]);
   glBindTexture(0, texture[0]);
   glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_128 , TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD or GL_TEXTURE_WRAP_S or GL_TEXTURE_WRAP_T, pcx.image.data8);
 
   imageDestroy(@pcx);
 
+  loadPCX(pcuint8(drunkenlogo_pcx), @pcx);
+  image8to16(@pcx);
+  glBindTexture(0, texture[1]);
+  glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_128, TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD, pcx.image.data8);
+
+  imageDestroy(@pcx);
+
   result := true;
 end;
 
+procedure TransformCube();
+begin
+  glRotatef(cubeRot.x, 1.0, 0.0, 0.0);
+  glRotatef(cubeRot.y, 0.0, 1.0, 0.0);
+  glRotatef(cubeRot.z, 0.0, 0.0, 1.0);
+end;
+
+procedure EmitCube();
+begin
+  glPushMatrix();
+  glScalef(0.03, 0.03, 0.03);	
+  
+  glRotatef(cubeRot.x, 1.0, 0.0, 0.0);
+  glRotatef(cubeRot.y, 0.0, 1.0, 0.0);
+  glRotatef(cubeRot.z, 0.0, 0.0, 1.0);
+  
+  glBegin(GL_QUADS);
+    // Front Face
+    glTexCoord2f(0.0, 0.0); glVertex3f(-1.0, -1.0,  1.0);
+    glTexCoord2f(1.0, 0.0); glVertex3f( 1.0, -1.0,  1.0);
+    glTexCoord2f(1.0, 1.0); glVertex3f( 1.0,  1.0,  1.0);
+    glTexCoord2f(0.0, 1.0); glVertex3f(-1.0,  1.0,  1.0);
+    // Back Face
+    glTexCoord2f(1.0, 0.0); glVertex3f(-1.0, -1.0, -1.0);
+    glTexCoord2f(1.0, 1.0); glVertex3f(-1.0,  1.0, -1.0);
+    glTexCoord2f(0.0, 1.0); glVertex3f( 1.0,  1.0, -1.0);
+    glTexCoord2f(0.0, 0.0); glVertex3f( 1.0, -1.0, -1.0);
+    // Top Face
+    glTexCoord2f(0.0, 1.0); glVertex3f(-1.0,  1.0, -1.0);
+    glTexCoord2f(0.0, 0.0); glVertex3f(-1.0,  1.0,  1.0);
+    glTexCoord2f(1.0, 0.0); glVertex3f( 1.0,  1.0,  1.0);
+    glTexCoord2f(1.0, 1.0); glVertex3f( 1.0,  1.0, -1.0);
+    // Bottom Face
+    glTexCoord2f(1.0, 1.0); glVertex3f(-1.0, -1.0, -1.0);
+    glTexCoord2f(0.0, 1.0); glVertex3f( 1.0, -1.0, -1.0);
+    glTexCoord2f(0.0, 0.0); glVertex3f( 1.0, -1.0,  1.0);
+    glTexCoord2f(1.0, 0.0); glVertex3f(-1.0, -1.0,  1.0);
+    // Right face
+    glTexCoord2f(1.0, 0.0); glVertex3f( 1.0, -1.0, -1.0);
+    glTexCoord2f(1.0, 1.0); glVertex3f( 1.0,  1.0, -1.0);
+    glTexCoord2f(0.0, 1.0); glVertex3f( 1.0,  1.0,  1.0);
+    glTexCoord2f(0.0, 0.0); glVertex3f( 1.0, -1.0,  1.0);
+    // Left Face
+    glTexCoord2f(0.0, 0.0); glVertex3f(-1.0, -1.0, -1.0);
+    glTexCoord2f(1.0, 0.0); glVertex3f(-1.0, -1.0,  1.0);
+    glTexCoord2f(1.0, 1.0); glVertex3f(-1.0,  1.0,  1.0);
+    glTexCoord2f(0.0, 1.0); glVertex3f(-1.0,  1.0, -1.0);
+  glEnd();
+  glPopMatrix(1);
+end;
+
+procedure ShadowDemo();
+begin
+  cubeRot.y := cubeRot.y + 0.8;
+  
+  //draw the actual cube
+  glPushMatrix();
+  glTranslatef(0.0, 0.4, -0.4); //draw the cube up in the air
+  TransformCube();
+  glBindTexture(GL_TEXTURE_2D, texture[1]);
+  EmitCube();
+  glPopMatrix(1);
+  
+  //draw the shadow:
+  begin
+    //draw the cube shadow on the ground
+    glPushMatrix();
+    glTranslatef(0.0, 0.0, -0.4);
+    TransformCube();
+    
+    //use no texture. set shadow color: we'll use green just to show that it is possible
+    glBindTexture(0, 0);
+    glColor(RGB15(0, 8, 0));
+    
+    //1st shadow pass
+    //be sure to use opaque here
+    glPolyFmt(POLY_SHADOW or POLY_CULL_FRONT or POLY_ALPHA(31));
+    EmitCube();
+    
+    //2nd shadow pass
+    //be sure to use a different polyID here (shadow with polyID 0 can't be cast on surface with polyID 0)
+    //we set the fog bit here because we want the shadow to be fogged later. i think it may be buggy but it looks better.
+    glPolyFmt(POLY_SHADOW or POLY_CULL_BACK or POLY_ALPHA(15) or POLY_ID(1) or POLY_FOG);
+    EmitCube();
+    
+    //reset poly attribute
+    glPolyFmt(POLY_ALPHA(31) or POLY_CULL_NONE or POLY_FORMAT_LIGHT0 or POLY_FOG);
+    
+    glPopMatrix(1);
+  end;
+end;
+
 var
   thisXY: touchPosition;
   lastXY: touchPosition;
   dx, dy: cint16;
-
+  i: integer;
 begin
   MyFile := pchar(@World_txt);
   // Setup the Main screen for 3D
@@ -220,6 +330,9 @@ begin
   // enable antialiasing
   glEnable(GL_ANTIALIAS);
 
+  // enable alpha blending for shadow demo
+  glEnable(GL_BLEND);
+
   // setup the rear plane
   glClearColor(0,0,0,31); // BG must be opaque for AA to work
   glClearPolyID(63); // BG must have a unique polygon ID for AA to work
@@ -235,7 +348,7 @@ begin
   glLoadIdentity();
   gluPerspective(70, 256.0 / 192.0, 0.1, 100);
 
-  glLight(0, RGB15(31,31,31) , 0,         floattov10(-1.0),    0);
+  glLight(0, RGB15(31,31,31) , 0, floattov10(-1.0), 0);
 
   //need to set up some material properties since DS does not have them set by default
   glMaterialf(GL_AMBIENT, RGB15(16,16,16));
@@ -247,11 +360,24 @@ begin
   glMaterialShinyness();
 
   //ds specific, several attributes can be set here
-  glPolyFmt(POLY_ALPHA(31) or POLY_CULL_NONE or POLY_FORMAT_LIGHT0);
+  glPolyFmt(POLY_ALPHA(31) or POLY_CULL_NONE or POLY_FORMAT_LIGHT0 or POLY_FOG);
 
   // Set the current matrix to be the model matrix
   glMatrixMode(GL_MODELVIEW);
 
+  //setup demo fog parameters
+  //these parameters are somewhat arbitrary, and designed to illustrate fog in just this one case.
+  //you will certainly need to tweak them for your own use.
+  //be sure to have set the POLY_FOG bit on any material you want to be fogged.
+  glEnable(GL_FOG);
+  glFogShift(2);
+  glFogColor(0, 0, 0, 0);
+
+  for i := 0 to 31 do
+    glFogDensity(i, i * 4);
+
+  glFogDensity(31, 127);
+  glFogOffset($6000);
 
   while true do
   begin
@@ -299,7 +425,6 @@ begin
       walkbias := tsin(walkbiasangle) / 20.0;
     end;
 
-
     glColor3f(1,1,1);
 
     DrawGLScene();

+ 11 - 8
packages/libndsfpc/examples/graphics/3D/nehe/lesson10b/lesson10b.pp

@@ -72,7 +72,7 @@ begin
   glRotatef32i(lookupdown, (1 shl 12),          0, 0);
   glRotatef32i( sceneroty,          0, (1 shl 12), 0);
 
-  glTranslate3f32(xtrans, ytrans, ztrans);
+  glTranslatef32(xtrans, ytrans, ztrans);
   glBindTexture(GL_TEXTURE_2D, texture[0]);
 
   numtriangles := sector1.numtriangles;
@@ -182,6 +182,9 @@ begin
   result := true;
 end;
 
+var
+  held: integer;
+
 begin
   MyFile := pchar(@World_txt);
 
@@ -236,25 +239,25 @@ begin
   begin
     //these little button functions are pretty handy
     scanKeys();
+    held := keysHeld();
 
+    if (held and KEY_A) <> 0 then lookupdown := lookupdown - 1;
 
-    if (keysHeld() and KEY_A) <> 0 then lookupdown := lookupdown - 1;
-
-    if (keysHeld() and KEY_B) <> 0 then lookupdown := lookupdown + 1;
+    if (held and KEY_B) <> 0 then lookupdown := lookupdown + 1;
 
-    if (keysHeld() and KEY_LEFT) <> 0 then
+    if (held and KEY_LEFT) <> 0 then
     begin
       heading := heading + 64;
       yrot := heading;
     end;
 
-    if (keysHeld() and KEY_RIGHT) <> 0 then
+    if (held and KEY_RIGHT) <> 0 then
     begin
       heading := heading - 64;
       yrot := heading;
     end;
 
-    if (keysHeld() and KEY_DOWN) <> 0 then
+    if (held and KEY_DOWN) <> 0 then
     begin
 
       xpos := xpos + sinLerp(heading) div 20;
@@ -265,7 +268,7 @@ begin
       walkbias := sinLerp(walkbiasangle) div 20;
     end;
 
-    if (keysHeld() and KEY_UP) <> 0 then
+    if (held and KEY_UP) <> 0 then
     begin
       xpos := xpos - sinLerp(heading) div 20;
       zpos := zpos - cosLerp(heading) div 20;

+ 5 - 1
packages/libndsfpc/examples/graphics/Backgrounds/16bit_color_bmp/16bitColorBmp.pp

@@ -34,6 +34,10 @@ begin
   decompress(@drunkenlogoBitmap, BG_GFX,  LZ77Vram);
 
   while true do
+  begin
     swiWaitForVBlank();
-
+    ScanKeys();
+    if (keysDown() and KEY_START) <> 0 then 
+      break;
+  end;
 end.

+ 1 - 1
packages/libndsfpc/examples/graphics/Backgrounds/Double_Buffer/DoubleBuffer.pp

@@ -19,7 +19,7 @@ begin
 	//set the first two banks as background memory and the third as sub background memory
 	//D is not used..if you need a bigger background then you will need to map
 	//more vram banks consecutivly (VRAM A-D are all 0x20000 bytes in size)
-	vramSetMainBanks(	VRAM_A_MAIN_BG_0x06000000, VRAM_B_MAIN_BG_0x06020000, 
+	vramSetPrimaryBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_MAIN_BG_0x06020000, 
 		VRAM_C_SUB_BG, VRAM_D_LCD);
 
 	consoleDemoInit();

+ 2 - 2
packages/libndsfpc/examples/graphics/Sprites/bitmap_sprites/BitmapSprites.pp

@@ -41,7 +41,7 @@ begin
     gfx := nil;
     size := SpriteSize_32x32;
     format := SpriteColorFormat_256Color;
-    rotationIndex := -1;
+    rotationIndex := 0;
     paletteAlpha := 0;
     x := 20;
     y := 80;
@@ -52,7 +52,7 @@ begin
     gfx := nil;
     size := SpriteSize_32x32;
     format := SpriteColorFormat_16Color;
-    rotationIndex := -1;
+    rotationIndex := 0;
     paletteAlpha := 1;
     x := 20;
     y := 136;

+ 1 - 1
packages/libndsfpc/examples/graphics/Sprites/fire_and_sprites/FireAndSprites.pp

@@ -83,7 +83,7 @@ begin
           DISPLAY_BG1_ACTIVE );
 
 	//vram banks are somewhat complex
-	vramSetMainBanks(VRAM_A_LCD, VRAM_B_LCD, VRAM_C_SUB_BG, VRAM_D_SUB_SPRITE);
+	vramSetPrimaryBanks(VRAM_A_LCD, VRAM_B_LCD, VRAM_C_SUB_BG, VRAM_D_SUB_SPRITE);
 
   //load our ball pcx file into an image
   loadPCX(pcuint8(ball_pcx), @ball);

+ 0 - 6
packages/libndsfpc/examples/input/Touch_Pad/touch_test/touchTest.pp

@@ -59,12 +59,6 @@ begin
   lcdMainOnBottom();
   
   initOAM();
-  //enable vram and map it to the right places
-  vramSetMainBanks(   VRAM_A_MAIN_SPRITE,         //A and B maped consecutively as sprite memory
-                      VRAM_B_MAIN_SPRITE,         //this gives us 256KB which is the max
-                      VRAM_C_MAIN_BG_0x06000000,  //map C to background memory
-                      VRAM_D_LCD                  //not using D
-                      ); 
    
   //set the video mode
   videoSetMode(  MODE_0_2D or 

+ 415 - 190
packages/libndsfpc/examples/RealTimeClock/Makefile → packages/libndsfpc/examples/time/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/09/29]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/11/11]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-gamecube powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx haiku
 LIMIT83fs = go32v2 os2 emx watcom
@@ -245,7 +245,7 @@ endif
 ifndef CROSSBINDIR
 CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
 endif
-ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+ifeq ($(OS_TARGET),darwin)
 ifeq ($(OS_SOURCE),darwin)
 DARWIN2DARWIN=1
 endif
@@ -265,190 +265,190 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_DIRS+=Watch
-endif
-ifeq ($(FULL_TARGET),i386-nativent)
-override TARGET_DIRS+=Watch
-endif
-ifeq ($(FULL_TARGET),i386-iphonesim)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_DIRS+=Watch
+override TARGET_DIRS+=RealTimeClock timercallback stopwatch
 endif
 override INSTALL_FPCPACKAGE=y
 ifdef REQUIRE_UNITSDIR
@@ -778,7 +778,7 @@ DEBUGSYMEXT=.xcoff
 SHORTSUFFIX=mac
 IMPORTLIBPREFIX=imp
 endif
-ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+ifeq ($(OS_TARGET),darwin)
 BATCHEXT=.sh
 EXEEXT=
 HASSHAREDLIB=1
@@ -789,13 +789,24 @@ EXEEXT=.gba
 SHAREDLIBEXT=.so
 SHORTSUFFIX=gba
 endif
+ifeq ($(OS_TARGET),nds)
+EXEEXT=.nds
+SHAREDLIBEXT=.so
+SHORTSUFFIX=nds
+endif
 ifeq ($(OS_TARGET),symbian)
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=symbian
 endif
-ifeq ($(OS_TARGET),NativeNT)
-SHAREDLIBEXT=.dll
-SHORTSUFFIX=nativent
+ifeq ($(OS_TARGET),gamecube)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gamecube
+endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
 endif
 else
 ifeq ($(OS_TARGET),go32v1)
@@ -1282,12 +1293,6 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 REQUIRE_PACKAGES_LIBNDSFPC=1
 endif
-ifeq ($(FULL_TARGET),i386-nativent)
-REQUIRE_PACKAGES_LIBNDSFPC=1
-endif
-ifeq ($(FULL_TARGET),i386-iphonesim)
-REQUIRE_PACKAGES_LIBNDSFPC=1
-endif
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_LIBNDSFPC=1
 endif
@@ -1333,6 +1338,12 @@ endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 REQUIRE_PACKAGES_LIBNDSFPC=1
 endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_LIBNDSFPC=1
 endif
@@ -1771,235 +1782,449 @@ fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIR
 fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
 fpc_makefiles: fpc_makefile fpc_makefile_dirs
 ifeq ($(FULL_TARGET),i386-linux)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-TARGET_DIRS_WATCH=1
-endif
-ifeq ($(FULL_TARGET),i386-nativent)
-TARGET_DIRS_WATCH=1
-endif
-ifeq ($(FULL_TARGET),i386-iphonesim)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
+endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
-TARGET_DIRS_WATCH=1
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
-TARGET_DIRS_WATCH=1
-endif
-ifdef TARGET_DIRS_WATCH
-Watch_all:
-	$(MAKE) -C Watch all
-Watch_debug:
-	$(MAKE) -C Watch debug
-Watch_smart:
-	$(MAKE) -C Watch smart
-Watch_release:
-	$(MAKE) -C Watch release
-Watch_units:
-	$(MAKE) -C Watch units
-Watch_examples:
-	$(MAKE) -C Watch examples
-Watch_shared:
-	$(MAKE) -C Watch shared
-Watch_install:
-	$(MAKE) -C Watch install
-Watch_sourceinstall:
-	$(MAKE) -C Watch sourceinstall
-Watch_exampleinstall:
-	$(MAKE) -C Watch exampleinstall
-Watch_distinstall:
-	$(MAKE) -C Watch distinstall
-Watch_zipinstall:
-	$(MAKE) -C Watch zipinstall
-Watch_zipsourceinstall:
-	$(MAKE) -C Watch zipsourceinstall
-Watch_zipexampleinstall:
-	$(MAKE) -C Watch zipexampleinstall
-Watch_zipdistinstall:
-	$(MAKE) -C Watch zipdistinstall
-Watch_clean:
-	$(MAKE) -C Watch clean
-Watch_distclean:
-	$(MAKE) -C Watch distclean
-Watch_cleanall:
-	$(MAKE) -C Watch cleanall
-Watch_info:
-	$(MAKE) -C Watch info
-Watch_makefiles:
-	$(MAKE) -C Watch makefiles
-Watch:
-	$(MAKE) -C Watch all
-.PHONY: Watch_all Watch_debug Watch_smart Watch_release Watch_units Watch_examples Watch_shared Watch_install Watch_sourceinstall Watch_exampleinstall Watch_distinstall Watch_zipinstall Watch_zipsourceinstall Watch_zipexampleinstall Watch_zipdistinstall Watch_clean Watch_distclean Watch_cleanall Watch_info Watch_makefiles Watch
+TARGET_DIRS_REALTIMECLOCK=1
+TARGET_DIRS_TIMERCALLBACK=1
+TARGET_DIRS_STOPWATCH=1
+endif
+ifdef TARGET_DIRS_REALTIMECLOCK
+RealTimeClock_all:
+	$(MAKE) -C RealTimeClock all
+RealTimeClock_debug:
+	$(MAKE) -C RealTimeClock debug
+RealTimeClock_smart:
+	$(MAKE) -C RealTimeClock smart
+RealTimeClock_release:
+	$(MAKE) -C RealTimeClock release
+RealTimeClock_units:
+	$(MAKE) -C RealTimeClock units
+RealTimeClock_examples:
+	$(MAKE) -C RealTimeClock examples
+RealTimeClock_shared:
+	$(MAKE) -C RealTimeClock shared
+RealTimeClock_install:
+	$(MAKE) -C RealTimeClock install
+RealTimeClock_sourceinstall:
+	$(MAKE) -C RealTimeClock sourceinstall
+RealTimeClock_exampleinstall:
+	$(MAKE) -C RealTimeClock exampleinstall
+RealTimeClock_distinstall:
+	$(MAKE) -C RealTimeClock distinstall
+RealTimeClock_zipinstall:
+	$(MAKE) -C RealTimeClock zipinstall
+RealTimeClock_zipsourceinstall:
+	$(MAKE) -C RealTimeClock zipsourceinstall
+RealTimeClock_zipexampleinstall:
+	$(MAKE) -C RealTimeClock zipexampleinstall
+RealTimeClock_zipdistinstall:
+	$(MAKE) -C RealTimeClock zipdistinstall
+RealTimeClock_clean:
+	$(MAKE) -C RealTimeClock clean
+RealTimeClock_distclean:
+	$(MAKE) -C RealTimeClock distclean
+RealTimeClock_cleanall:
+	$(MAKE) -C RealTimeClock cleanall
+RealTimeClock_info:
+	$(MAKE) -C RealTimeClock info
+RealTimeClock_makefiles:
+	$(MAKE) -C RealTimeClock makefiles
+RealTimeClock:
+	$(MAKE) -C RealTimeClock all
+.PHONY: RealTimeClock_all RealTimeClock_debug RealTimeClock_smart RealTimeClock_release RealTimeClock_units RealTimeClock_examples RealTimeClock_shared RealTimeClock_install RealTimeClock_sourceinstall RealTimeClock_exampleinstall RealTimeClock_distinstall RealTimeClock_zipinstall RealTimeClock_zipsourceinstall RealTimeClock_zipexampleinstall RealTimeClock_zipdistinstall RealTimeClock_clean RealTimeClock_distclean RealTimeClock_cleanall RealTimeClock_info RealTimeClock_makefiles RealTimeClock
+endif
+ifdef TARGET_DIRS_TIMERCALLBACK
+timercallback_all:
+	$(MAKE) -C timercallback all
+timercallback_debug:
+	$(MAKE) -C timercallback debug
+timercallback_smart:
+	$(MAKE) -C timercallback smart
+timercallback_release:
+	$(MAKE) -C timercallback release
+timercallback_units:
+	$(MAKE) -C timercallback units
+timercallback_examples:
+	$(MAKE) -C timercallback examples
+timercallback_shared:
+	$(MAKE) -C timercallback shared
+timercallback_install:
+	$(MAKE) -C timercallback install
+timercallback_sourceinstall:
+	$(MAKE) -C timercallback sourceinstall
+timercallback_exampleinstall:
+	$(MAKE) -C timercallback exampleinstall
+timercallback_distinstall:
+	$(MAKE) -C timercallback distinstall
+timercallback_zipinstall:
+	$(MAKE) -C timercallback zipinstall
+timercallback_zipsourceinstall:
+	$(MAKE) -C timercallback zipsourceinstall
+timercallback_zipexampleinstall:
+	$(MAKE) -C timercallback zipexampleinstall
+timercallback_zipdistinstall:
+	$(MAKE) -C timercallback zipdistinstall
+timercallback_clean:
+	$(MAKE) -C timercallback clean
+timercallback_distclean:
+	$(MAKE) -C timercallback distclean
+timercallback_cleanall:
+	$(MAKE) -C timercallback cleanall
+timercallback_info:
+	$(MAKE) -C timercallback info
+timercallback_makefiles:
+	$(MAKE) -C timercallback makefiles
+timercallback:
+	$(MAKE) -C timercallback all
+.PHONY: timercallback_all timercallback_debug timercallback_smart timercallback_release timercallback_units timercallback_examples timercallback_shared timercallback_install timercallback_sourceinstall timercallback_exampleinstall timercallback_distinstall timercallback_zipinstall timercallback_zipsourceinstall timercallback_zipexampleinstall timercallback_zipdistinstall timercallback_clean timercallback_distclean timercallback_cleanall timercallback_info timercallback_makefiles timercallback
+endif
+ifdef TARGET_DIRS_STOPWATCH
+stopwatch_all:
+	$(MAKE) -C stopwatch all
+stopwatch_debug:
+	$(MAKE) -C stopwatch debug
+stopwatch_smart:
+	$(MAKE) -C stopwatch smart
+stopwatch_release:
+	$(MAKE) -C stopwatch release
+stopwatch_units:
+	$(MAKE) -C stopwatch units
+stopwatch_examples:
+	$(MAKE) -C stopwatch examples
+stopwatch_shared:
+	$(MAKE) -C stopwatch shared
+stopwatch_install:
+	$(MAKE) -C stopwatch install
+stopwatch_sourceinstall:
+	$(MAKE) -C stopwatch sourceinstall
+stopwatch_exampleinstall:
+	$(MAKE) -C stopwatch exampleinstall
+stopwatch_distinstall:
+	$(MAKE) -C stopwatch distinstall
+stopwatch_zipinstall:
+	$(MAKE) -C stopwatch zipinstall
+stopwatch_zipsourceinstall:
+	$(MAKE) -C stopwatch zipsourceinstall
+stopwatch_zipexampleinstall:
+	$(MAKE) -C stopwatch zipexampleinstall
+stopwatch_zipdistinstall:
+	$(MAKE) -C stopwatch zipdistinstall
+stopwatch_clean:
+	$(MAKE) -C stopwatch clean
+stopwatch_distclean:
+	$(MAKE) -C stopwatch distclean
+stopwatch_cleanall:
+	$(MAKE) -C stopwatch cleanall
+stopwatch_info:
+	$(MAKE) -C stopwatch info
+stopwatch_makefiles:
+	$(MAKE) -C stopwatch makefiles
+stopwatch:
+	$(MAKE) -C stopwatch all
+.PHONY: stopwatch_all stopwatch_debug stopwatch_smart stopwatch_release stopwatch_units stopwatch_examples stopwatch_shared stopwatch_install stopwatch_sourceinstall stopwatch_exampleinstall stopwatch_distinstall stopwatch_zipinstall stopwatch_zipsourceinstall stopwatch_zipexampleinstall stopwatch_zipdistinstall stopwatch_clean stopwatch_distclean stopwatch_cleanall stopwatch_info stopwatch_makefiles stopwatch
 endif
 all: $(addsuffix _all,$(TARGET_DIRS))
 debug: $(addsuffix _debug,$(TARGET_DIRS))

+ 1 - 1
packages/libndsfpc/examples/RealTimeClock/Makefile.fpc → packages/libndsfpc/examples/time/Makefile.fpc

@@ -3,7 +3,7 @@
 #
 
 [target]
-dirs=Watch
+dirs=RealTimeClock timercallback stopwatch
 
 [require]
 packages=libndsfpc

+ 170 - 376
packages/libndsfpc/examples/RealTimeClock/Watch/Makefile → packages/libndsfpc/examples/time/RealTimeClock/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/09/29]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/11/11]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-gamecube powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx haiku
 LIMIT83fs = go32v2 os2 emx watcom
@@ -247,7 +247,7 @@ endif
 ifndef CROSSBINDIR
 CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
 endif
-ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+ifeq ($(OS_TARGET),darwin)
 ifeq ($(OS_SOURCE),darwin)
 DARWIN2DARWIN=1
 endif
@@ -267,195 +267,193 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 BUILD = build
-INC = inc
-AUDIO_FILES = $(foreach dir, $(notdir $(wildcard audio/*.*)), $(CURDIR)/audio/$(dir))
+AUDIO_FILES = $(foreach dir,$(notdir $(wildcard audio/*.*)),$(CURDIR)/audio/$(dir))
 GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png)))
-BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_PROGRAMS+=watch
-endif
-ifeq ($(FULL_TARGET),i386-nativent)
-override TARGET_PROGRAMS+=watch
-endif
-ifeq ($(FULL_TARGET),i386-iphonesim)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
+endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+override TARGET_PROGRAMS+=RealTimeClock
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_PROGRAMS+=watch
+override TARGET_PROGRAMS+=RealTimeClock
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override CLEAN_UNITS+=*
@@ -517,12 +515,6 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override CLEAN_UNITS+=*
 endif
-ifeq ($(FULL_TARGET),i386-nativent)
-override CLEAN_UNITS+=*
-endif
-ifeq ($(FULL_TARGET),i386-iphonesim)
-override CLEAN_UNITS+=*
-endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override CLEAN_UNITS+=*
 endif
@@ -568,6 +560,12 @@ endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 override CLEAN_UNITS+=*
 endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override CLEAN_UNITS+=*
+endif
 ifeq ($(FULL_TARGET),sparc-linux)
 override CLEAN_UNITS+=*
 endif
@@ -644,378 +642,192 @@ ifeq ($(FULL_TARGET),mipsel-linux)
 override CLEAN_UNITS+=*
 endif
 ifeq ($(FULL_TARGET),i386-linux)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),i386-nativent)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),i386-iphonesim)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),sparc-linux)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),sparc-netbsd)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),sparc-solaris)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),sparc-embedded)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),x86_64-linux)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),x86_64-freebsd)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),x86_64-solaris)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),x86_64-darwin)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),x86_64-win64)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),x86_64-embedded)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),arm-linux)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),arm-palmos)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),arm-darwin)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),arm-wince)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),arm-gba)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),arm-nds)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),arm-embedded)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),arm-symbian)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),powerpc64-linux)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),powerpc64-darwin)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),powerpc64-embedded)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),avr-embedded)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),armeb-linux)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),armeb-embedded)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-ifeq ($(FULL_TARGET),mipsel-linux)
-override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/* $(INC)/*
-endif
-override INSTALL_FPCPACKAGE=y
-ifeq ($(FULL_TARGET),i386-linux)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-go32v2)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-win32)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-os2)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-freebsd)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-beos)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
-ifeq ($(FULL_TARGET),i386-haiku)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-netbsd)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-solaris)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-qnx)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-netware)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-openbsd)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-wdosx)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-darwin)
-override COMPILER_OPTIONS+=-g -Xm
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
-ifeq ($(FULL_TARGET),i386-emx)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-watcom)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-netwlibc)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-wince)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-embedded)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-symbian)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-nativent)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),i386-iphonesim)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),m68k-linux)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),m68k-freebsd)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),m68k-netbsd)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),m68k-amiga)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),m68k-atari)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),m68k-openbsd)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),m68k-palmos)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),m68k-embedded)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),powerpc-linux)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),powerpc-netbsd)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),powerpc-amiga)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),powerpc-macos)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),powerpc-darwin)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),powerpc-morphos)
-override COMPILER_OPTIONS+=-g -Xm
-endif
-ifeq ($(FULL_TARGET),powerpc-embedded)
-override COMPILER_OPTIONS+=-g -Xm
+ifeq ($(FULL_TARGET),powerpc-wii)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
-override COMPILER_OPTIONS+=-g -Xm
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
 endif
+override INSTALL_FPCPACKAGE=y
 ifdef REQUIRE_UNITSDIR
 override UNITSDIR+=$(REQUIRE_UNITSDIR)
 endif
@@ -1343,7 +1155,7 @@ DEBUGSYMEXT=.xcoff
 SHORTSUFFIX=mac
 IMPORTLIBPREFIX=imp
 endif
-ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+ifeq ($(OS_TARGET),darwin)
 BATCHEXT=.sh
 EXEEXT=
 HASSHAREDLIB=1
@@ -1354,13 +1166,24 @@ EXEEXT=.gba
 SHAREDLIBEXT=.so
 SHORTSUFFIX=gba
 endif
+ifeq ($(OS_TARGET),nds)
+EXEEXT=.nds
+SHAREDLIBEXT=.so
+SHORTSUFFIX=nds
+endif
 ifeq ($(OS_TARGET),symbian)
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=symbian
 endif
-ifeq ($(OS_TARGET),NativeNT)
-SHAREDLIBEXT=.dll
-SHORTSUFFIX=nativent
+ifeq ($(OS_TARGET),gamecube)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gamecube
+endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
 endif
 else
 ifeq ($(OS_TARGET),go32v1)
@@ -1847,12 +1670,6 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 REQUIRE_PACKAGES_LIBNDSFPC=1
 endif
-ifeq ($(FULL_TARGET),i386-nativent)
-REQUIRE_PACKAGES_LIBNDSFPC=1
-endif
-ifeq ($(FULL_TARGET),i386-iphonesim)
-REQUIRE_PACKAGES_LIBNDSFPC=1
-endif
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_LIBNDSFPC=1
 endif
@@ -1898,6 +1715,12 @@ endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 REQUIRE_PACKAGES_LIBNDSFPC=1
 endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_LIBNDSFPC=1
 endif
@@ -2523,15 +2346,6 @@ GRIT:=$(firstword $(GRIT))
 endif
 endif
 export GRIT
-ifndef RMDIR
-RMDIR:=$(strip $(wildcard $(addsuffix /rmdir$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(RMDIR),)
-RMDIR= __missing_command_RMDIR
-else
-RMDIR:=$(firstword $(RMDIR))
-endif
-endif
-export RMDIR
 debug: fpc_debug
 smart: fpc_smart
 release: fpc_release
@@ -2546,45 +2360,25 @@ zipinstall:
 zipsourceinstall:
 zipexampleinstall:
 zipdistinstall:
+clean: fpc_clean
 distclean: fpc_distclean
 cleanall: fpc_cleanall
 info: fpc_info
 makefiles: fpc_makefiles
-.PHONY: debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall distclean cleanall info makefiles
+.PHONY: debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
 ifneq ($(wildcard fpcmake.loc),)
 include fpcmake.loc
 endif
 .NOTPARALLEL:
-clean: dir_delete fpc_clean fpc_cleanall
-all: dir_make $(BIN_FILES) $(GFX_FILES) fpc_all 
-dir_delete:
-	@$(DELTREE) $(CURDIR)/$(BUILD) 
-	@$(DELTREE) $(CURDIR)/$(INC) 
-dir_make:
+all: direc fpc_all 
+direc:
 ifneq ($(BUILD), $(CURDIR))
-	@$(MKDIR) $(BUILD)
-endif
-ifneq ($(INC), $(CURDIR))
-	@$(MKDIR) $(INC)
+	$(MKDIR) $(BUILD)
 endif
 soundbank.bin.o : $(AUDIO_FILES)
 	@$(MMUTIL) $^ -d -o$(BUILD)/soundbank.bin -h$(BUILD)/soundbank.h
 	$(BIN2S) $(BUILD)/soundbank.bin > $(BUILD)/soundbank.bin.s
 	$(AS) -o $(BUILD)/soundbank.bin.o $(BUILD)/soundbank.bin.s
-$(GFX_FILES): $(wildcard %.png) 
-	@echo 'Converting $(@) file to asm...'
-	$(GRIT) gfx/$(@) -fts -ff gfx/$(basename $(@)).grit -o$(BUILD)/$(@)
-	@echo 'Assembling $(@).s file...'
-	$(AS) -o $(BUILD)/$(basename $(@)).o $(BUILD)/$(basename $(@)).s
-	@echo 'Done!'
-$(BIN_FILES): $(wildcard %.*)
-	@echo 'Converting $(@) file to asm...'
-	@$(BIN2S) data/$(@) > $(BUILD)/$(@).s
-	@echo 'Creating $(@).inc include file...'
-	@echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
-	@echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
-	@echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
-	@echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
-	@echo 'Assembling $(@).s file...'
-	@$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
-	@echo 'Done!'
+$(GFX_FILES).o: 
+	$(GRIT) gfx/$(GFX_FILES) -fts -ff gfx/$(basename $(GFX_FILES)).grit -o$(BUILD)/$(GFX_FILES)
+	$(AS) -o $(BUILD)/$(basename $(GFX_FILES)).o $(BUILD)/$(basename $(GFX_FILES)).s

+ 46 - 0
packages/libndsfpc/examples/time/RealTimeClock/Makefile.fpc

@@ -0,0 +1,46 @@
+#
+#   Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
+#
+
+[target]
+loaders=
+programs=RealTimeClock
+
+[require]
+packages=libndsfpc
+tools=bin2s mmutil grit
+nortl=y
+
+[install]
+fpcpackage=y
+
+[default]
+cpu=arm
+target=nds
+fpcdir=../../../../..
+
+[clean]
+files=*.elf *.o *.s *.nds *.nef *.h *.bin \
+       $(BUILD)/*
+units=*
+
+[prerules]
+BUILD = build
+AUDIO_FILES = $(foreach dir,$(notdir $(wildcard audio/*.*)),$(CURDIR)/audio/$(dir))
+GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png)))
+
+[rules]
+.NOTPARALLEL:
+all: direc fpc_all 
+direc:
+ifneq ($(BUILD), $(CURDIR))
+        $(MKDIR) $(BUILD)
+endif
+soundbank.bin.o : $(AUDIO_FILES)
+        @$(MMUTIL) $^ -d -o$(BUILD)/soundbank.bin -h$(BUILD)/soundbank.h
+        $(BIN2S) $(BUILD)/soundbank.bin > $(BUILD)/soundbank.bin.s
+        $(AS) -o $(BUILD)/soundbank.bin.o $(BUILD)/soundbank.bin.s
+
+$(GFX_FILES).o: 
+        $(GRIT) gfx/$(GFX_FILES) -fts -ff gfx/$(basename $(GFX_FILES)).grit -o$(BUILD)/$(GFX_FILES)
+        $(AS) -o $(BUILD)/$(basename $(GFX_FILES)).o $(BUILD)/$(basename $(GFX_FILES)).s

+ 1 - 1
packages/libndsfpc/examples/RealTimeClock/Watch/watch.pp → packages/libndsfpc/examples/time/RealTimeClock/realtimeclock.pp

@@ -1,4 +1,4 @@
-program watch;
+program realtimeclock;
 
 {$mode objfpc}
 

+ 2384 - 0
packages/libndsfpc/examples/time/stopwatch/Makefile

@@ -0,0 +1,2384 @@
+#
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/11/11]
+#
+default: all
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-gamecube powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+BSDs = freebsd netbsd openbsd darwin
+UNIXs = linux $(BSDs) solaris qnx haiku
+LIMIT83fs = go32v2 os2 emx watcom
+OSNeedsComspecToRunBatch = go32v2 watcom
+FORCE:
+.PHONY: FORCE
+override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
+ifneq ($(findstring darwin,$(OSTYPE)),)
+inUnix=1 #darwin
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+SEARCHPATH:=$(subst ;, ,$(PATH))
+endif
+endif
+SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+$(error You need the GNU utils package to use this Makefile)
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=
+endif
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=.exe
+endif
+ifndef inUnix
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+else
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+else
+ifneq ($(findstring cygdrive,$(PATH)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+SRCBATCHEXT=.sh
+else
+ifdef inOS2
+SRCBATCHEXT=.cmd
+else
+SRCBATCHEXT=.bat
+endif
+endif
+ifdef COMSPEC
+ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),)
+ifndef RUNBATCH
+RUNBATCH=$(COMSPEC) /C
+endif
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP:=$(subst /,\,/)
+ifdef inCygWin
+PATHSEP=/
+endif
+endif
+ifdef PWD
+BASEDIR:=$(subst \,/,$(shell $(PWD)))
+ifdef inCygWin
+ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
+BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
+BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
+BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
+endif
+endif
+else
+BASEDIR=.
+endif
+ifdef inOS2
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO=echo
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+endif
+override OS_TARGET_DEFAULT=nds
+override CPU_TARGET_DEFAULT=arm
+override DEFAULT_FPCDIR=../../../../..
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+endif
+endif
+ifndef FPC
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+ifneq ($(CPU_TARGET),)
+FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
+else
+FPC:=$(shell $(FPCPROG) -PB)
+endif
+ifneq ($(findstring Error,$(FPC)),)
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+else
+ifeq ($(strip $(wildcard $(FPC))),)
+FPC:=$(firstword $(FPCPROG))
+endif
+endif
+else
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+FOUNDFPC:=$(strip $(wildcard $(FPC)))
+ifeq ($(FOUNDFPC),)
+FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))
+ifeq ($(FOUNDFPC),)
+$(error Compiler $(FPC) not found)
+endif
+endif
+ifndef FPC_COMPILERINFO
+FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)
+endif
+ifndef FPC_VERSION
+FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))
+endif
+export FPC FPC_VERSION FPC_COMPILERINFO
+unexport CHECKDEPEND ALLDEPENDENCIES
+ifndef CPU_TARGET
+ifdef CPU_TARGET_DEFAULT
+CPU_TARGET=$(CPU_TARGET_DEFAULT)
+endif
+endif
+ifndef OS_TARGET
+ifdef OS_TARGET_DEFAULT
+OS_TARGET=$(OS_TARGET_DEFAULT)
+endif
+endif
+ifneq ($(words $(FPC_COMPILERINFO)),5)
+FPC_COMPILERINFO+=$(shell $(FPC) -iSP)
+FPC_COMPILERINFO+=$(shell $(FPC) -iTP)
+FPC_COMPILERINFO+=$(shell $(FPC) -iSO)
+FPC_COMPILERINFO+=$(shell $(FPC) -iTO)
+endif
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))
+endif
+ifndef OS_TARGET
+OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
+endif
+FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifeq ($(CPU_TARGET),armeb)
+ARCH=arm
+override FPCOPT+=-Cb
+else
+ifeq ($(CPU_TARGET),armel)
+ARCH=arm
+override FPCOPT+=-CaEABI
+else
+ARCH=$(CPU_TARGET)
+endif
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+SOURCESUFFIX=$(OS_SOURCE)
+else
+TARGETSUFFIX=$(FULL_TARGET)
+SOURCESUFFIX=$(FULL_SOURCE)
+endif
+ifneq ($(FULL_TARGET),$(FULL_SOURCE))
+CROSSCOMPILE=1
+endif
+ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
+ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),)
+$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first)
+endif
+endif
+ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
+BSDhier=1
+endif
+ifeq ($(OS_TARGET),linux)
+linuxHier=1
+endif
+export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifdef DEFAULT_FPCDIR
+ifeq ($(FPCDIR),wrong)
+override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+endif
+endif
+ifeq ($(FPCDIR),wrong)
+ifdef inUnix
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(BASEDIR)
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
+endif
+ifeq ($(OS_TARGET),darwin)
+ifeq ($(OS_SOURCE),darwin)
+DARWIN2DARWIN=1
+endif
+endif
+ifndef BINUTILSPREFIX
+ifndef CROSSBINDIR
+ifdef CROSSCOMPILE
+ifndef DARWIN2DARWIN
+BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
+endif
+endif
+endif
+endif
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
+ifeq ($(UNITSDIR),)
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+endif
+PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+BUILD = build
+AUDIO_FILES = $(foreach dir,$(notdir $(wildcard audio/*.*)),$(CURDIR)/audio/$(dir))
+GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png)))
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override TARGET_PROGRAMS+=stopwatch
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+override INSTALL_FPCPACKAGE=y
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
+UNIXHier=1
+endif
+else
+ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
+UNIXHier=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef PREFIX
+INSTALL_PREFIX=$(PREFIX)
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXHier
+INSTALL_PREFIX=/usr/local
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=/pp
+else
+INSTALL_BASEDIR:=/$(PACKAGE_NAME)
+endif
+endif
+endif
+export INSTALL_PREFIX
+ifdef INSTALL_FPCSUBDIR
+export INSTALL_FPCSUBDIR
+endif
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef COMPILER_UNITTARGETDIR
+ifdef PACKAGEDIR_MAIN
+COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX)
+else
+COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX)
+endif
+endif
+ifndef COMPILER_TARGETDIR
+COMPILER_TARGETDIR=.
+endif
+ifndef INSTALL_BASEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
+endif
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXHier
+INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
+else
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
+ifdef INSTALL_FPCPACKAGE
+ifdef CROSSCOMPILE
+ifdef CROSSINSTALL
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX)
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+endif
+endif
+endif
+ifndef INSTALL_UNITDIR
+INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX)
+ifdef INSTALL_FPCPACKAGE
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXHier
+INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXHier
+ifdef BSDhier
+SRCPREFIXDIR=share/src
+else
+ifdef linuxHier
+SRCPREFIXDIR=share/src
+else
+SRCPREFIXDIR=src
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
+endif
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXHier
+ifdef BSDhier
+DOCPREFIXDIR=share/doc
+else
+ifdef linuxHier
+DOCPREFIXDIR=share/doc
+else
+DOCPREFIXDIR=doc
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
+endif
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
+endif
+endif
+else
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+endif
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
+endif
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifndef INSTALL_SHAREDDIR
+INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib
+endif
+ifdef CROSSCOMPILE
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
+ifeq ($(CROSSBINDIR),)
+CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE))
+endif
+endif
+else
+CROSSBINDIR=
+endif
+BATCHEXT=.bat
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+SHAREDLIBPREFIX=libfp
+STATICLIBPREFIX=libp
+IMPORTLIBPREFIX=libimp
+RSTEXT=.rst
+ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),go32v1)
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+OEXT=.obj
+ASMEXT=.asm
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=wat
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),emx)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=emx
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),morphos)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=mos
+endif
+ifeq ($(OS_TARGET),atari)
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),haiku)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=hai
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nw
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),netwlibc)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nwl
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),darwin)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=dwn
+endif
+ifeq ($(OS_TARGET),gba)
+EXEEXT=.gba
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gba
+endif
+ifeq ($(OS_TARGET),nds)
+EXEEXT=.nds
+SHAREDLIBEXT=.so
+SHORTSUFFIX=nds
+endif
+ifeq ($(OS_TARGET),symbian)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=symbian
+endif
+ifeq ($(OS_TARGET),gamecube)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gamecube
+endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
+endif
+else
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+SHORTSUFFIX=wat
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+AOUTEXT=.out
+SMARTEXT=.sl2
+STATICLIBPREFIX=
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),atari)
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+STATICLIBPREFIX=
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.nlm
+EXEEXT=.nlm
+SHORTSUFFIX=nw
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),netwlibc)
+STATICLIBPREFIX=
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.nlm
+EXEEXT=.nlm
+SHORTSUFFIX=nwl
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+IMPORTLIBPREFIX=imp
+endif
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+FPCMADE=fpcmade.$(SHORTSUFFIX)
+ZIPSUFFIX=$(SHORTSUFFIX)
+ZIPCROSSPREFIX=
+ZIPSOURCESUFFIX=src
+ZIPEXAMPLESUFFIX=exm
+else
+FPCMADE=fpcmade.$(TARGETSUFFIX)
+ZIPSOURCESUFFIX=.source
+ZIPEXAMPLESUFFIX=.examples
+ifdef CROSSCOMPILE
+ZIPSUFFIX=.$(SOURCESUFFIX)
+ZIPCROSSPREFIX=$(TARGETSUFFIX)-
+else
+ZIPSUFFIX=.$(TARGETSUFFIX)
+ZIPCROSSPREFIX=
+endif
+endif
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO= __missing_command_ECHO
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE= __missing_command_DATE
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifndef GINSTALL
+GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL= __missing_command_GINSTALL
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+endif
+export GINSTALL
+ifndef CPPROG
+CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(CPPROG),)
+CPPROG= __missing_command_CPPROG
+else
+CPPROG:=$(firstword $(CPPROG))
+endif
+endif
+export CPPROG
+ifndef RMPROG
+RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(RMPROG),)
+RMPROG= __missing_command_RMPROG
+else
+RMPROG:=$(firstword $(RMPROG))
+endif
+endif
+export RMPROG
+ifndef MVPROG
+MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MVPROG),)
+MVPROG= __missing_command_MVPROG
+else
+MVPROG:=$(firstword $(MVPROG))
+endif
+endif
+export MVPROG
+ifndef MKDIRPROG
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG= __missing_command_MKDIRPROG
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+endif
+export MKDIRPROG
+ifndef ECHOREDIR
+ifndef inUnix
+ECHOREDIR=echo
+else
+ECHOREDIR=$(ECHO)
+endif
+endif
+ifndef COPY
+COPY:=$(CPPROG) -fp
+endif
+ifndef COPYTREE
+COPYTREE:=$(CPPROG) -Rfp
+endif
+ifndef MKDIRTREE
+MKDIRTREE:=$(MKDIRPROG) -p
+endif
+ifndef MOVE
+MOVE:=$(MVPROG) -f
+endif
+ifndef DEL
+DEL:=$(RMPROG) -f
+endif
+ifndef DELTREE
+DELTREE:=$(RMPROG) -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=$(GINSTALL) -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=$(GINSTALL) -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+MKDIR:=$(GINSTALL) -m 755 -d
+endif
+export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE= __missing_command_PPUMOVE
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef FPCMAKE
+FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(FPCMAKE),)
+FPCMAKE= __missing_command_FPCMAKE
+else
+FPCMAKE:=$(firstword $(FPCMAKE))
+endif
+endif
+export FPCMAKE
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG= __missing_command_ZIPPROG
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG= __missing_command_TARPROG
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ASNAME=$(BINUTILSPREFIX)as
+LDNAME=$(BINUTILSPREFIX)ld
+ARNAME=$(BINUTILSPREFIX)ar
+RCNAME=$(BINUTILSPREFIX)rc
+ifneq ($(findstring 1.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),win32)
+ifeq ($(CROSSBINDIR),)
+ASNAME=asw
+LDNAME=ldw
+ARNAME=arw
+endif
+endif
+endif
+ifndef ASPROG
+ifdef CROSSBINDIR
+ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
+else
+ASPROG=$(ASNAME)
+endif
+endif
+ifndef LDPROG
+ifdef CROSSBINDIR
+LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
+else
+LDPROG=$(LDNAME)
+endif
+endif
+ifndef RCPROG
+ifdef CROSSBINDIR
+RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
+else
+RCPROG=$(RCNAME)
+endif
+endif
+ifndef ARPROG
+ifdef CROSSBINDIR
+ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
+else
+ARPROG=$(ARNAME)
+endif
+endif
+AS=$(ASPROG)
+LD=$(LDPROG)
+RC=$(RCPROG)
+AR=$(ARPROG)
+PPAS=ppas$(SRCBATCHEXT)
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+ifndef UPXPROG
+ifeq ($(OS_TARGET),go32v2)
+UPXPROG:=1
+endif
+ifeq ($(OS_TARGET),win32)
+UPXPROG:=1
+endif
+ifdef UPXPROG
+UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(UPXPROG),)
+UPXPROG=
+else
+UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+export UPXPROG
+ZIPOPT=-9
+ZIPEXT=.zip
+ifeq ($(USETAR),bz2)
+TAROPT=vj
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+override REQUIRE_PACKAGES=libndsfpc
+ifeq ($(FULL_TARGET),i386-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifdef REQUIRE_PACKAGES_LIBNDSFPC
+PACKAGEDIR_LIBNDSFPC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /libndsfpc/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_LIBNDSFPC),)
+ifneq ($(wildcard $(PACKAGEDIR_LIBNDSFPC)/units/$(TARGETSUFFIX)),)
+UNITDIR_LIBNDSFPC=$(PACKAGEDIR_LIBNDSFPC)/units/$(TARGETSUFFIX)
+else
+UNITDIR_LIBNDSFPC=$(PACKAGEDIR_LIBNDSFPC)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_LIBNDSFPC)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_LIBNDSFPC) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_LIBNDSFPC)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_LIBNDSFPC=
+UNITDIR_LIBNDSFPC:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /libndsfpc/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_LIBNDSFPC),)
+UNITDIR_LIBNDSFPC:=$(firstword $(UNITDIR_LIBNDSFPC))
+else
+UNITDIR_LIBNDSFPC=
+endif
+endif
+ifdef UNITDIR_LIBNDSFPC
+override COMPILER_UNITDIR+=$(UNITDIR_LIBNDSFPC)
+endif
+endif
+ifndef NOCPUDEF
+override FPCOPTDEF=$(ARCH)
+endif
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+ifneq ($(CPU_TARGET),$(CPU_SOURCE))
+override FPCOPT+=-P$(ARCH)
+endif
+ifeq ($(OS_SOURCE),openbsd)
+override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
+endif
+ifndef CROSSBOOTSTRAP
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-XP$(BINUTILSPREFIX)
+endif
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-Xr$(RLINKPATH)
+endif
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+ifdef LINKSMART
+override FPCOPT+=-XX
+endif
+ifdef CREATESMART
+override FPCOPT+=-CX
+endif
+ifdef DEBUG
+override FPCOPT+=-gl
+override FPCOPTDEF+=DEBUG
+endif
+ifdef RELEASE
+ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifeq ($(CPU_TARGET),i386)
+FPCCPUOPT:=-OG2p3
+endif
+ifeq ($(CPU_TARGET),powerpc)
+FPCCPUOPT:=-O1r
+endif
+else
+FPCCPUOPT:=-O2
+endif
+override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+override FPCOPT+=-O2
+endif
+ifdef VERBOSE
+override FPCOPT+=-vwni
+endif
+ifdef COMPILER_OPTIONS
+override FPCOPT+=$(COMPILER_OPTIONS)
+endif
+ifdef COMPILER_UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
+endif
+ifdef COMPILER_LIBRARYDIR
+override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
+endif
+ifdef COMPILER_OBJECTDIR
+override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
+endif
+ifdef COMPILER_INCLUDEDIR
+override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
+endif
+ifdef CROSSBINDIR
+override FPCOPT+=-FD$(CROSSBINDIR)
+endif
+ifdef COMPILER_TARGETDIR
+override FPCOPT+=-FE$(COMPILER_TARGETDIR)
+ifeq ($(COMPILER_TARGETDIR),.)
+override TARGETDIRPREFIX=
+else
+override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
+endif
+endif
+ifdef COMPILER_UNITTARGETDIR
+override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
+ifeq ($(COMPILER_UNITTARGETDIR),.)
+override UNITTARGETDIRPREFIX=
+else
+override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifdef CREATESHARED
+override FPCOPT+=-Cg
+ifeq ($(CPU_TARGET),i386)
+override FPCOPT+=-Aas
+endif
+endif
+ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),linux)
+ifeq ($(CPU_TARGET),x86_64)
+override FPCOPT+=-Cg
+endif
+endif
+endif
+ifdef LINKSHARED
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifdef USEENV
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(AFULL_TARGET),$(AFULL_SOURCE))
+override ACROSSCOMPILE=1
+endif
+ifdef ACROSSCOMPILE
+override FPCOPT+=$(CROSSOPT)
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(FULL_SOURCE),$(FULL_TARGET))
+ifdef RUNBATCH
+EXECPPAS:=@$(RUNBATCH) $(PPAS)
+else
+EXECPPAS:=@$(PPAS)
+endif
+endif
+endif
+.PHONY: fpc_exes
+ifndef CROSSINSTALL
+ifneq ($(TARGET_PROGRAMS),)
+override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS))
+override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS)))
+override ALLTARGET+=fpc_exes
+override INSTALLEXEFILES+=$(EXEFILES)
+override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES)
+ifeq ($(OS_TARGET),os2)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS))
+endif
+ifeq ($(OS_TARGET),emx)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS))
+endif
+endif
+endif
+fpc_exes: $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(EXEFILES)
+ifdef TARGET_RSTS
+override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
+override CLEANRSTFILES+=$(RSTFILES)
+endif
+.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared
+$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
+	@$(ECHOREDIR) Compiled > $(FPCMADE)
+fpc_all: $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+fpc_release:
+	$(MAKE) all RELEASE=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res
+$(COMPILER_UNITTARGETDIR):
+	$(MKDIRTREE) $(COMPILER_UNITTARGETDIR)
+$(COMPILER_TARGETDIR):
+	$(MKDIRTREE) $(COMPILER_TARGETDIR)
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.lpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.dpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%.res: %.rc
+	windres -i $< -o $@
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.inc $(COMPILER_INCLUDEDIR)
+vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_shared
+override INSTALLTARGET+=fpc_shared_install
+ifndef SHARED_LIBVERSION
+SHARED_LIBVERSION=$(FPC_VERSION)
+endif
+ifndef SHARED_LIBNAME
+SHARED_LIBNAME=$(PACKAGE_NAME)
+endif
+ifndef SHARED_FULLNAME
+SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT)
+endif
+ifndef SHARED_LIBUNITS
+SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS)
+override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS))
+endif
+fpc_shared:
+ifdef HASSHAREDLIB
+	$(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
+ifneq ($(SHARED_BUILD),n)
+	$(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR)
+endif
+else
+	@$(ECHO) Shared Libraries not supported
+endif
+fpc_shared_install:
+ifneq ($(SHARED_BUILD),n)
+ifneq ($(SHARED_LIBUNITS),)
+ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),)
+	$(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR)
+endif
+endif
+endif
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALL_BUILDUNIT
+override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
+endif
+ifdef INSTALLPPUFILES
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+ifneq ($(UNITTARGETDIRPREFIX),)
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
+endif
+override INSTALL_CREATEPACKAGEFPC=1
+endif
+ifdef INSTALLEXEFILES
+ifneq ($(TARGETDIRPREFIX),)
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES)))
+endif
+endif
+fpc_install: all $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+ifdef UPXPROG
+	-$(UPXPROG) $(INSTALLEXEFILES)
+endif
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+endif
+ifdef INSTALL_CREATEPACKAGEFPC
+ifdef FPCMAKE
+ifdef PACKAGE_VERSION
+ifneq ($(wildcard Makefile.fpc),)
+	$(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
+endif
+endif
+endif
+endif
+ifdef INSTALLPPUFILES
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
+endif
+ifneq ($(wildcard $(LIB_FULLNAME)),)
+	$(MKDIR) $(INSTALL_LIBDIR)
+	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
+ifdef inUnix
+	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
+endif
+endif
+endif
+ifdef INSTALL_FILES
+	$(MKDIR) $(INSTALL_DATADIR)
+	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
+endif
+fpc_sourceinstall: distclean
+	$(MKDIR) $(INSTALL_SOURCEDIR)
+	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
+fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
+ifdef HASEXAMPLES
+	$(MKDIR) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef EXAMPLESOURCEFILES
+	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
+endif
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+endif
+ifdef CLEAN_PROGRAMS
+override CLEANEXEFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEEXT), $(CLEAN_PROGRAMS)))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+ifdef DEBUGSYMEXT
+override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
+endif
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+ifdef LIB_NAME
+	-$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
+endif
+	-$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef COMPILER_UNITTARGETDIR
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+	-$(DELTREE) units
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+ifneq ($(PPUEXT),.ppu)
+	-$(DEL) *.o *.ppu *.a
+endif
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *_ppas$(BATCHEXT)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+ifdef DEBUGSYMEXT
+	-$(DEL) *$(DEBUGSYMEXT)
+endif
+fpc_distclean: cleanall
+.PHONY: fpc_baseinfo
+override INFORULES+=fpc_baseinfo
+fpc_baseinfo:
+	@$(ECHO)
+	@$(ECHO)  == Package info ==
+	@$(ECHO)  Package Name..... $(PACKAGE_NAME)
+	@$(ECHO)  Package Version.. $(PACKAGE_VERSION)
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC.......... $(FPC)
+	@$(ECHO)  FPC Version.. $(FPC_VERSION)
+	@$(ECHO)  Source CPU... $(CPU_SOURCE)
+	@$(ECHO)  Target CPU... $(CPU_TARGET)
+	@$(ECHO)  Source OS.... $(OS_SOURCE)
+	@$(ECHO)  Target OS.... $(OS_TARGET)
+	@$(ECHO)  Full Source.. $(FULL_SOURCE)
+	@$(ECHO)  Full Target.. $(FULL_TARGET)
+	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
+	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Required pkgs... $(REQUIRE_PACKAGES)
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  CrossBinDir..... $(CROSSBINDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  As........ $(AS)
+	@$(ECHO)  Ld........ $(LD)
+	@$(ECHO)  Ar........ $(AR)
+	@$(ECHO)  Rc........ $(RC)
+	@$(ECHO)
+	@$(ECHO)  Mv........ $(MVPROG)
+	@$(ECHO)  Cp........ $(CPPROG)
+	@$(ECHO)  Rm........ $(RMPROG)
+	@$(ECHO)  GInstall.. $(GINSTALL)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  Shell..... $(SHELL)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  FPCMake... $(FPCMAKE)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  Upx....... $(UPXPROG)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders........ $(TARGET_LOADERS)
+	@$(ECHO)  Target Units.......... $(TARGET_UNITS)
+	@$(ECHO)  Target Implicit Units. $(TARGET_IMPLICITUNITS)
+	@$(ECHO)  Target Programs....... $(TARGET_PROGRAMS)
+	@$(ECHO)  Target Dirs........... $(TARGET_DIRS)
+	@$(ECHO)  Target Examples....... $(TARGET_EXAMPLES)
+	@$(ECHO)  Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
+	@$(ECHO)
+	@$(ECHO)  Clean Units......... $(CLEAN_UNITS)
+	@$(ECHO)  Clean Files......... $(CLEAN_FILES)
+	@$(ECHO)
+	@$(ECHO)  Install Units....... $(INSTALL_UNITS)
+	@$(ECHO)  Install Files....... $(INSTALL_FILES)
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+	@$(ECHO)  DateStr.............. $(DATESTR)
+	@$(ECHO)  ZipName.............. $(ZIPNAME)
+	@$(ECHO)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipCrossPrefix....... $(ZIPCROSSPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)  FullZipName.......... $(FULLZIPNAME)
+	@$(ECHO)  Install FPC Package.. $(INSTALL_FPCPACKAGE)
+	@$(ECHO)
+	@$(ECHO)  Install base dir..... $(INSTALL_BASEDIR)
+	@$(ECHO)  Install binary dir... $(INSTALL_BINDIR)
+	@$(ECHO)  Install library dir.. $(INSTALL_LIBDIR)
+	@$(ECHO)  Install units dir.... $(INSTALL_UNITDIR)
+	@$(ECHO)  Install source dir... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  Install doc dir...... $(INSTALL_DOCDIR)
+	@$(ECHO)  Install example dir.. $(INSTALL_EXAMPLEDIR)
+	@$(ECHO)  Install data dir..... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  Dist destination dir. $(DIST_DESTDIR)
+	@$(ECHO)  Dist zip name........ $(DIST_ZIPNAME)
+	@$(ECHO)
+.PHONY: fpc_info
+fpc_info: $(INFORULES)
+.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
+	fpc_makefile_dirs
+fpc_makefile:
+	$(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
+fpc_makefile_sub1:
+ifdef TARGET_DIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
+endif
+fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
+fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
+fpc_makefiles: fpc_makefile fpc_makefile_dirs
+ifndef BIN2S
+BIN2S:=$(strip $(wildcard $(addsuffix /bin2s$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(BIN2S),)
+BIN2S= __missing_command_BIN2S
+else
+BIN2S:=$(firstword $(BIN2S))
+endif
+endif
+export BIN2S
+ifndef MMUTIL
+MMUTIL:=$(strip $(wildcard $(addsuffix /mmutil$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MMUTIL),)
+MMUTIL= __missing_command_MMUTIL
+else
+MMUTIL:=$(firstword $(MMUTIL))
+endif
+endif
+export MMUTIL
+ifndef GRIT
+GRIT:=$(strip $(wildcard $(addsuffix /grit$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GRIT),)
+GRIT= __missing_command_GRIT
+else
+GRIT:=$(firstword $(GRIT))
+endif
+endif
+export GRIT
+debug: fpc_debug
+smart: fpc_smart
+release: fpc_release
+units: fpc_units
+examples:
+shared: fpc_shared
+install: fpc_install
+sourceinstall: fpc_sourceinstall
+exampleinstall: fpc_exampleinstall
+distinstall:
+zipinstall:
+zipsourceinstall:
+zipexampleinstall:
+zipdistinstall:
+clean: fpc_clean
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+makefiles: fpc_makefiles
+.PHONY: debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
+.NOTPARALLEL:
+all: direc fpc_all 
+direc:
+ifneq ($(BUILD), $(CURDIR))
+	$(MKDIR) $(BUILD)
+endif
+soundbank.bin.o : $(AUDIO_FILES)
+	@$(MMUTIL) $^ -d -o$(BUILD)/soundbank.bin -h$(BUILD)/soundbank.h
+	$(BIN2S) $(BUILD)/soundbank.bin > $(BUILD)/soundbank.bin.s
+	$(AS) -o $(BUILD)/soundbank.bin.o $(BUILD)/soundbank.bin.s
+$(GFX_FILES).o: 
+	$(GRIT) gfx/$(GFX_FILES) -fts -ff gfx/$(basename $(GFX_FILES)).grit -o$(BUILD)/$(GFX_FILES)
+	$(AS) -o $(BUILD)/$(basename $(GFX_FILES)).o $(BUILD)/$(basename $(GFX_FILES)).s

+ 46 - 0
packages/libndsfpc/examples/time/stopwatch/Makefile.fpc

@@ -0,0 +1,46 @@
+#
+#   Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
+#
+
+[target]
+loaders=
+programs=stopwatch
+
+[require]
+packages=libndsfpc
+tools=bin2s mmutil grit
+nortl=y
+
+[install]
+fpcpackage=y
+
+[default]
+cpu=arm
+target=nds
+fpcdir=../../../../..
+
+[clean]
+files=*.elf *.o *.s *.nds *.nef *.h *.bin \
+       $(BUILD)/*
+units=*
+
+[prerules]
+BUILD = build
+AUDIO_FILES = $(foreach dir,$(notdir $(wildcard audio/*.*)),$(CURDIR)/audio/$(dir))
+GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png)))
+
+[rules]
+.NOTPARALLEL:
+all: direc fpc_all 
+direc:
+ifneq ($(BUILD), $(CURDIR))
+        $(MKDIR) $(BUILD)
+endif
+soundbank.bin.o : $(AUDIO_FILES)
+        @$(MMUTIL) $^ -d -o$(BUILD)/soundbank.bin -h$(BUILD)/soundbank.h
+        $(BIN2S) $(BUILD)/soundbank.bin > $(BUILD)/soundbank.bin.s
+        $(AS) -o $(BUILD)/soundbank.bin.o $(BUILD)/soundbank.bin.s
+
+$(GFX_FILES).o: 
+        $(GRIT) gfx/$(GFX_FILES) -fts -ff gfx/$(basename $(GFX_FILES)).grit -o$(BUILD)/$(GFX_FILES)
+        $(AS) -o $(BUILD)/$(basename $(GFX_FILES)).o $(BUILD)/$(basename $(GFX_FILES)).s

+ 68 - 0
packages/libndsfpc/examples/time/stopwatch/stopwatch.pp

@@ -0,0 +1,68 @@
+program stopwatch;
+
+{$mode objfpc}
+
+uses
+  ctypes, nds9;
+
+//the speed of the timer when using ClockDivider_1024
+const
+  TIMER_SPEED = (BUS_CLOCK div 1024);
+
+type
+  TTimerStates = (timerState_Stop, timerState_Pause, timerState_Running);
+
+var
+  ticks: cuint = 0;
+	state: TTimerStates = timerState_Stop;
+	down: cint;
+      
+begin
+  consoleDemoInit();
+
+  down := keysDown();
+
+  while (down and KEY_START) = 0 do
+  begin
+		swiWaitForVBlank();
+		consoleClear();
+		scanKeys();
+		down := keysDown();
+
+		if (state = timerState_Running) then
+			ticks := ticks + timerElapsed(0);
+
+		if (down and KEY_A) <> 0 then
+		begin
+			if (state = timerState_Stop) then
+			begin
+				timerStart(0, ClockDivider_1024, 0, nil);
+				state := timerState_Running;
+			end else 
+      if (state = timerState_Pause) then
+			begin
+				timerUnpause(0);
+				state := timerState_Running;
+			end else 
+      if (state = timerState_Running) then
+			begin
+				ticks := ticks + timerPause(0);
+				state := timerState_Pause;
+			end;
+		end else 
+    if (down and KEY_B) <> 0 then
+		begin
+			timerStop(0);
+			ticks := 0;
+			state := timerState_Stop;
+		end;
+
+		iprintf('Press A to start and pause the '#10'timer, B to clear the timer '#10'and start to quit the program.'#10#10);
+		iprintf('ticks:  %u'#10, ticks);
+		iprintf('second: %u:%u'#10, ticks div TIMER_SPEED, ((ticks mod TIMER_SPEED) * 1000) div TIMER_SPEED);
+	end;
+
+	if (state <> timerState_Stop) then
+		timerStop(0);
+
+end.

+ 2384 - 0
packages/libndsfpc/examples/time/timercallback/Makefile

@@ -0,0 +1,2384 @@
+#
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/11/11]
+#
+default: all
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-gamecube powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+BSDs = freebsd netbsd openbsd darwin
+UNIXs = linux $(BSDs) solaris qnx haiku
+LIMIT83fs = go32v2 os2 emx watcom
+OSNeedsComspecToRunBatch = go32v2 watcom
+FORCE:
+.PHONY: FORCE
+override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
+ifneq ($(findstring darwin,$(OSTYPE)),)
+inUnix=1 #darwin
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+SEARCHPATH:=$(subst ;, ,$(PATH))
+endif
+endif
+SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+$(error You need the GNU utils package to use this Makefile)
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=
+endif
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=.exe
+endif
+ifndef inUnix
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+else
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+else
+ifneq ($(findstring cygdrive,$(PATH)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+SRCBATCHEXT=.sh
+else
+ifdef inOS2
+SRCBATCHEXT=.cmd
+else
+SRCBATCHEXT=.bat
+endif
+endif
+ifdef COMSPEC
+ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),)
+ifndef RUNBATCH
+RUNBATCH=$(COMSPEC) /C
+endif
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP:=$(subst /,\,/)
+ifdef inCygWin
+PATHSEP=/
+endif
+endif
+ifdef PWD
+BASEDIR:=$(subst \,/,$(shell $(PWD)))
+ifdef inCygWin
+ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
+BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
+BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
+BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
+endif
+endif
+else
+BASEDIR=.
+endif
+ifdef inOS2
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO=echo
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+endif
+override OS_TARGET_DEFAULT=nds
+override CPU_TARGET_DEFAULT=arm
+override DEFAULT_FPCDIR=../../../../..
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+endif
+endif
+ifndef FPC
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+ifneq ($(CPU_TARGET),)
+FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
+else
+FPC:=$(shell $(FPCPROG) -PB)
+endif
+ifneq ($(findstring Error,$(FPC)),)
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+else
+ifeq ($(strip $(wildcard $(FPC))),)
+FPC:=$(firstword $(FPCPROG))
+endif
+endif
+else
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+FOUNDFPC:=$(strip $(wildcard $(FPC)))
+ifeq ($(FOUNDFPC),)
+FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))
+ifeq ($(FOUNDFPC),)
+$(error Compiler $(FPC) not found)
+endif
+endif
+ifndef FPC_COMPILERINFO
+FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)
+endif
+ifndef FPC_VERSION
+FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))
+endif
+export FPC FPC_VERSION FPC_COMPILERINFO
+unexport CHECKDEPEND ALLDEPENDENCIES
+ifndef CPU_TARGET
+ifdef CPU_TARGET_DEFAULT
+CPU_TARGET=$(CPU_TARGET_DEFAULT)
+endif
+endif
+ifndef OS_TARGET
+ifdef OS_TARGET_DEFAULT
+OS_TARGET=$(OS_TARGET_DEFAULT)
+endif
+endif
+ifneq ($(words $(FPC_COMPILERINFO)),5)
+FPC_COMPILERINFO+=$(shell $(FPC) -iSP)
+FPC_COMPILERINFO+=$(shell $(FPC) -iTP)
+FPC_COMPILERINFO+=$(shell $(FPC) -iSO)
+FPC_COMPILERINFO+=$(shell $(FPC) -iTO)
+endif
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))
+endif
+ifndef OS_TARGET
+OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
+endif
+FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifeq ($(CPU_TARGET),armeb)
+ARCH=arm
+override FPCOPT+=-Cb
+else
+ifeq ($(CPU_TARGET),armel)
+ARCH=arm
+override FPCOPT+=-CaEABI
+else
+ARCH=$(CPU_TARGET)
+endif
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+SOURCESUFFIX=$(OS_SOURCE)
+else
+TARGETSUFFIX=$(FULL_TARGET)
+SOURCESUFFIX=$(FULL_SOURCE)
+endif
+ifneq ($(FULL_TARGET),$(FULL_SOURCE))
+CROSSCOMPILE=1
+endif
+ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
+ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),)
+$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first)
+endif
+endif
+ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
+BSDhier=1
+endif
+ifeq ($(OS_TARGET),linux)
+linuxHier=1
+endif
+export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifdef DEFAULT_FPCDIR
+ifeq ($(FPCDIR),wrong)
+override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+endif
+endif
+ifeq ($(FPCDIR),wrong)
+ifdef inUnix
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(BASEDIR)
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
+endif
+ifeq ($(OS_TARGET),darwin)
+ifeq ($(OS_SOURCE),darwin)
+DARWIN2DARWIN=1
+endif
+endif
+ifndef BINUTILSPREFIX
+ifndef CROSSBINDIR
+ifdef CROSSCOMPILE
+ifndef DARWIN2DARWIN
+BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
+endif
+endif
+endif
+endif
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
+ifeq ($(UNITSDIR),)
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+endif
+PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+BUILD = build
+AUDIO_FILES = $(foreach dir,$(notdir $(wildcard audio/*.*)),$(CURDIR)/audio/$(dir))
+GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png)))
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override TARGET_PROGRAMS+=timercallback
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override CLEAN_UNITS+=*
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override CLEAN_FILES+=*.elf *.o *.s *.nds *.nef *.h *.bin $(BUILD)/*
+endif
+override INSTALL_FPCPACKAGE=y
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
+UNIXHier=1
+endif
+else
+ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
+UNIXHier=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef PREFIX
+INSTALL_PREFIX=$(PREFIX)
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXHier
+INSTALL_PREFIX=/usr/local
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=/pp
+else
+INSTALL_BASEDIR:=/$(PACKAGE_NAME)
+endif
+endif
+endif
+export INSTALL_PREFIX
+ifdef INSTALL_FPCSUBDIR
+export INSTALL_FPCSUBDIR
+endif
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef COMPILER_UNITTARGETDIR
+ifdef PACKAGEDIR_MAIN
+COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX)
+else
+COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX)
+endif
+endif
+ifndef COMPILER_TARGETDIR
+COMPILER_TARGETDIR=.
+endif
+ifndef INSTALL_BASEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
+endif
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXHier
+INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
+else
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
+ifdef INSTALL_FPCPACKAGE
+ifdef CROSSCOMPILE
+ifdef CROSSINSTALL
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX)
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+endif
+endif
+endif
+ifndef INSTALL_UNITDIR
+INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX)
+ifdef INSTALL_FPCPACKAGE
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXHier
+INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXHier
+ifdef BSDhier
+SRCPREFIXDIR=share/src
+else
+ifdef linuxHier
+SRCPREFIXDIR=share/src
+else
+SRCPREFIXDIR=src
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
+endif
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXHier
+ifdef BSDhier
+DOCPREFIXDIR=share/doc
+else
+ifdef linuxHier
+DOCPREFIXDIR=share/doc
+else
+DOCPREFIXDIR=doc
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
+endif
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
+endif
+endif
+else
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+endif
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
+endif
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifndef INSTALL_SHAREDDIR
+INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib
+endif
+ifdef CROSSCOMPILE
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
+ifeq ($(CROSSBINDIR),)
+CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE))
+endif
+endif
+else
+CROSSBINDIR=
+endif
+BATCHEXT=.bat
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+SHAREDLIBPREFIX=libfp
+STATICLIBPREFIX=libp
+IMPORTLIBPREFIX=libimp
+RSTEXT=.rst
+ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),go32v1)
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+OEXT=.obj
+ASMEXT=.asm
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=wat
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),emx)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=emx
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),morphos)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=mos
+endif
+ifeq ($(OS_TARGET),atari)
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),haiku)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=hai
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nw
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),netwlibc)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nwl
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),darwin)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=dwn
+endif
+ifeq ($(OS_TARGET),gba)
+EXEEXT=.gba
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gba
+endif
+ifeq ($(OS_TARGET),nds)
+EXEEXT=.nds
+SHAREDLIBEXT=.so
+SHORTSUFFIX=nds
+endif
+ifeq ($(OS_TARGET),symbian)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=symbian
+endif
+ifeq ($(OS_TARGET),gamecube)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gamecube
+endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
+endif
+else
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+SHORTSUFFIX=wat
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+AOUTEXT=.out
+SMARTEXT=.sl2
+STATICLIBPREFIX=
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),atari)
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+STATICLIBPREFIX=
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.nlm
+EXEEXT=.nlm
+SHORTSUFFIX=nw
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),netwlibc)
+STATICLIBPREFIX=
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.nlm
+EXEEXT=.nlm
+SHORTSUFFIX=nwl
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+IMPORTLIBPREFIX=imp
+endif
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+FPCMADE=fpcmade.$(SHORTSUFFIX)
+ZIPSUFFIX=$(SHORTSUFFIX)
+ZIPCROSSPREFIX=
+ZIPSOURCESUFFIX=src
+ZIPEXAMPLESUFFIX=exm
+else
+FPCMADE=fpcmade.$(TARGETSUFFIX)
+ZIPSOURCESUFFIX=.source
+ZIPEXAMPLESUFFIX=.examples
+ifdef CROSSCOMPILE
+ZIPSUFFIX=.$(SOURCESUFFIX)
+ZIPCROSSPREFIX=$(TARGETSUFFIX)-
+else
+ZIPSUFFIX=.$(TARGETSUFFIX)
+ZIPCROSSPREFIX=
+endif
+endif
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO= __missing_command_ECHO
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE= __missing_command_DATE
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifndef GINSTALL
+GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL= __missing_command_GINSTALL
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+endif
+export GINSTALL
+ifndef CPPROG
+CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(CPPROG),)
+CPPROG= __missing_command_CPPROG
+else
+CPPROG:=$(firstword $(CPPROG))
+endif
+endif
+export CPPROG
+ifndef RMPROG
+RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(RMPROG),)
+RMPROG= __missing_command_RMPROG
+else
+RMPROG:=$(firstword $(RMPROG))
+endif
+endif
+export RMPROG
+ifndef MVPROG
+MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MVPROG),)
+MVPROG= __missing_command_MVPROG
+else
+MVPROG:=$(firstword $(MVPROG))
+endif
+endif
+export MVPROG
+ifndef MKDIRPROG
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG= __missing_command_MKDIRPROG
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+endif
+export MKDIRPROG
+ifndef ECHOREDIR
+ifndef inUnix
+ECHOREDIR=echo
+else
+ECHOREDIR=$(ECHO)
+endif
+endif
+ifndef COPY
+COPY:=$(CPPROG) -fp
+endif
+ifndef COPYTREE
+COPYTREE:=$(CPPROG) -Rfp
+endif
+ifndef MKDIRTREE
+MKDIRTREE:=$(MKDIRPROG) -p
+endif
+ifndef MOVE
+MOVE:=$(MVPROG) -f
+endif
+ifndef DEL
+DEL:=$(RMPROG) -f
+endif
+ifndef DELTREE
+DELTREE:=$(RMPROG) -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=$(GINSTALL) -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=$(GINSTALL) -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+MKDIR:=$(GINSTALL) -m 755 -d
+endif
+export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE= __missing_command_PPUMOVE
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef FPCMAKE
+FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(FPCMAKE),)
+FPCMAKE= __missing_command_FPCMAKE
+else
+FPCMAKE:=$(firstword $(FPCMAKE))
+endif
+endif
+export FPCMAKE
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG= __missing_command_ZIPPROG
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG= __missing_command_TARPROG
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ASNAME=$(BINUTILSPREFIX)as
+LDNAME=$(BINUTILSPREFIX)ld
+ARNAME=$(BINUTILSPREFIX)ar
+RCNAME=$(BINUTILSPREFIX)rc
+ifneq ($(findstring 1.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),win32)
+ifeq ($(CROSSBINDIR),)
+ASNAME=asw
+LDNAME=ldw
+ARNAME=arw
+endif
+endif
+endif
+ifndef ASPROG
+ifdef CROSSBINDIR
+ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
+else
+ASPROG=$(ASNAME)
+endif
+endif
+ifndef LDPROG
+ifdef CROSSBINDIR
+LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
+else
+LDPROG=$(LDNAME)
+endif
+endif
+ifndef RCPROG
+ifdef CROSSBINDIR
+RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
+else
+RCPROG=$(RCNAME)
+endif
+endif
+ifndef ARPROG
+ifdef CROSSBINDIR
+ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
+else
+ARPROG=$(ARNAME)
+endif
+endif
+AS=$(ASPROG)
+LD=$(LDPROG)
+RC=$(RCPROG)
+AR=$(ARPROG)
+PPAS=ppas$(SRCBATCHEXT)
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+ifndef UPXPROG
+ifeq ($(OS_TARGET),go32v2)
+UPXPROG:=1
+endif
+ifeq ($(OS_TARGET),win32)
+UPXPROG:=1
+endif
+ifdef UPXPROG
+UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(UPXPROG),)
+UPXPROG=
+else
+UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+export UPXPROG
+ZIPOPT=-9
+ZIPEXT=.zip
+ifeq ($(USETAR),bz2)
+TAROPT=vj
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+override REQUIRE_PACKAGES=libndsfpc
+ifeq ($(FULL_TARGET),i386-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-gamecube)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+REQUIRE_PACKAGES_LIBNDSFPC=1
+endif
+ifdef REQUIRE_PACKAGES_LIBNDSFPC
+PACKAGEDIR_LIBNDSFPC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /libndsfpc/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_LIBNDSFPC),)
+ifneq ($(wildcard $(PACKAGEDIR_LIBNDSFPC)/units/$(TARGETSUFFIX)),)
+UNITDIR_LIBNDSFPC=$(PACKAGEDIR_LIBNDSFPC)/units/$(TARGETSUFFIX)
+else
+UNITDIR_LIBNDSFPC=$(PACKAGEDIR_LIBNDSFPC)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_LIBNDSFPC)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_LIBNDSFPC) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_LIBNDSFPC)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_LIBNDSFPC=
+UNITDIR_LIBNDSFPC:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /libndsfpc/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_LIBNDSFPC),)
+UNITDIR_LIBNDSFPC:=$(firstword $(UNITDIR_LIBNDSFPC))
+else
+UNITDIR_LIBNDSFPC=
+endif
+endif
+ifdef UNITDIR_LIBNDSFPC
+override COMPILER_UNITDIR+=$(UNITDIR_LIBNDSFPC)
+endif
+endif
+ifndef NOCPUDEF
+override FPCOPTDEF=$(ARCH)
+endif
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+ifneq ($(CPU_TARGET),$(CPU_SOURCE))
+override FPCOPT+=-P$(ARCH)
+endif
+ifeq ($(OS_SOURCE),openbsd)
+override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
+endif
+ifndef CROSSBOOTSTRAP
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-XP$(BINUTILSPREFIX)
+endif
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-Xr$(RLINKPATH)
+endif
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+ifdef LINKSMART
+override FPCOPT+=-XX
+endif
+ifdef CREATESMART
+override FPCOPT+=-CX
+endif
+ifdef DEBUG
+override FPCOPT+=-gl
+override FPCOPTDEF+=DEBUG
+endif
+ifdef RELEASE
+ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifeq ($(CPU_TARGET),i386)
+FPCCPUOPT:=-OG2p3
+endif
+ifeq ($(CPU_TARGET),powerpc)
+FPCCPUOPT:=-O1r
+endif
+else
+FPCCPUOPT:=-O2
+endif
+override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+override FPCOPT+=-O2
+endif
+ifdef VERBOSE
+override FPCOPT+=-vwni
+endif
+ifdef COMPILER_OPTIONS
+override FPCOPT+=$(COMPILER_OPTIONS)
+endif
+ifdef COMPILER_UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
+endif
+ifdef COMPILER_LIBRARYDIR
+override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
+endif
+ifdef COMPILER_OBJECTDIR
+override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
+endif
+ifdef COMPILER_INCLUDEDIR
+override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
+endif
+ifdef CROSSBINDIR
+override FPCOPT+=-FD$(CROSSBINDIR)
+endif
+ifdef COMPILER_TARGETDIR
+override FPCOPT+=-FE$(COMPILER_TARGETDIR)
+ifeq ($(COMPILER_TARGETDIR),.)
+override TARGETDIRPREFIX=
+else
+override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
+endif
+endif
+ifdef COMPILER_UNITTARGETDIR
+override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
+ifeq ($(COMPILER_UNITTARGETDIR),.)
+override UNITTARGETDIRPREFIX=
+else
+override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifdef CREATESHARED
+override FPCOPT+=-Cg
+ifeq ($(CPU_TARGET),i386)
+override FPCOPT+=-Aas
+endif
+endif
+ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),linux)
+ifeq ($(CPU_TARGET),x86_64)
+override FPCOPT+=-Cg
+endif
+endif
+endif
+ifdef LINKSHARED
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifdef USEENV
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(AFULL_TARGET),$(AFULL_SOURCE))
+override ACROSSCOMPILE=1
+endif
+ifdef ACROSSCOMPILE
+override FPCOPT+=$(CROSSOPT)
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(FULL_SOURCE),$(FULL_TARGET))
+ifdef RUNBATCH
+EXECPPAS:=@$(RUNBATCH) $(PPAS)
+else
+EXECPPAS:=@$(PPAS)
+endif
+endif
+endif
+.PHONY: fpc_exes
+ifndef CROSSINSTALL
+ifneq ($(TARGET_PROGRAMS),)
+override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS))
+override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS)))
+override ALLTARGET+=fpc_exes
+override INSTALLEXEFILES+=$(EXEFILES)
+override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES)
+ifeq ($(OS_TARGET),os2)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS))
+endif
+ifeq ($(OS_TARGET),emx)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS))
+endif
+endif
+endif
+fpc_exes: $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(EXEFILES)
+ifdef TARGET_RSTS
+override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
+override CLEANRSTFILES+=$(RSTFILES)
+endif
+.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared
+$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
+	@$(ECHOREDIR) Compiled > $(FPCMADE)
+fpc_all: $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+fpc_release:
+	$(MAKE) all RELEASE=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res
+$(COMPILER_UNITTARGETDIR):
+	$(MKDIRTREE) $(COMPILER_UNITTARGETDIR)
+$(COMPILER_TARGETDIR):
+	$(MKDIRTREE) $(COMPILER_TARGETDIR)
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.lpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.dpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%.res: %.rc
+	windres -i $< -o $@
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.inc $(COMPILER_INCLUDEDIR)
+vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_shared
+override INSTALLTARGET+=fpc_shared_install
+ifndef SHARED_LIBVERSION
+SHARED_LIBVERSION=$(FPC_VERSION)
+endif
+ifndef SHARED_LIBNAME
+SHARED_LIBNAME=$(PACKAGE_NAME)
+endif
+ifndef SHARED_FULLNAME
+SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT)
+endif
+ifndef SHARED_LIBUNITS
+SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS)
+override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS))
+endif
+fpc_shared:
+ifdef HASSHAREDLIB
+	$(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
+ifneq ($(SHARED_BUILD),n)
+	$(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR)
+endif
+else
+	@$(ECHO) Shared Libraries not supported
+endif
+fpc_shared_install:
+ifneq ($(SHARED_BUILD),n)
+ifneq ($(SHARED_LIBUNITS),)
+ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),)
+	$(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR)
+endif
+endif
+endif
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALL_BUILDUNIT
+override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
+endif
+ifdef INSTALLPPUFILES
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+ifneq ($(UNITTARGETDIRPREFIX),)
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
+endif
+override INSTALL_CREATEPACKAGEFPC=1
+endif
+ifdef INSTALLEXEFILES
+ifneq ($(TARGETDIRPREFIX),)
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES)))
+endif
+endif
+fpc_install: all $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+ifdef UPXPROG
+	-$(UPXPROG) $(INSTALLEXEFILES)
+endif
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+endif
+ifdef INSTALL_CREATEPACKAGEFPC
+ifdef FPCMAKE
+ifdef PACKAGE_VERSION
+ifneq ($(wildcard Makefile.fpc),)
+	$(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
+endif
+endif
+endif
+endif
+ifdef INSTALLPPUFILES
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
+endif
+ifneq ($(wildcard $(LIB_FULLNAME)),)
+	$(MKDIR) $(INSTALL_LIBDIR)
+	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
+ifdef inUnix
+	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
+endif
+endif
+endif
+ifdef INSTALL_FILES
+	$(MKDIR) $(INSTALL_DATADIR)
+	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
+endif
+fpc_sourceinstall: distclean
+	$(MKDIR) $(INSTALL_SOURCEDIR)
+	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
+fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
+ifdef HASEXAMPLES
+	$(MKDIR) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef EXAMPLESOURCEFILES
+	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
+endif
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+endif
+ifdef CLEAN_PROGRAMS
+override CLEANEXEFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEEXT), $(CLEAN_PROGRAMS)))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+ifdef DEBUGSYMEXT
+override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
+endif
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+ifdef LIB_NAME
+	-$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
+endif
+	-$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef COMPILER_UNITTARGETDIR
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+	-$(DELTREE) units
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+ifneq ($(PPUEXT),.ppu)
+	-$(DEL) *.o *.ppu *.a
+endif
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *_ppas$(BATCHEXT)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+ifdef DEBUGSYMEXT
+	-$(DEL) *$(DEBUGSYMEXT)
+endif
+fpc_distclean: cleanall
+.PHONY: fpc_baseinfo
+override INFORULES+=fpc_baseinfo
+fpc_baseinfo:
+	@$(ECHO)
+	@$(ECHO)  == Package info ==
+	@$(ECHO)  Package Name..... $(PACKAGE_NAME)
+	@$(ECHO)  Package Version.. $(PACKAGE_VERSION)
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC.......... $(FPC)
+	@$(ECHO)  FPC Version.. $(FPC_VERSION)
+	@$(ECHO)  Source CPU... $(CPU_SOURCE)
+	@$(ECHO)  Target CPU... $(CPU_TARGET)
+	@$(ECHO)  Source OS.... $(OS_SOURCE)
+	@$(ECHO)  Target OS.... $(OS_TARGET)
+	@$(ECHO)  Full Source.. $(FULL_SOURCE)
+	@$(ECHO)  Full Target.. $(FULL_TARGET)
+	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
+	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Required pkgs... $(REQUIRE_PACKAGES)
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  CrossBinDir..... $(CROSSBINDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  As........ $(AS)
+	@$(ECHO)  Ld........ $(LD)
+	@$(ECHO)  Ar........ $(AR)
+	@$(ECHO)  Rc........ $(RC)
+	@$(ECHO)
+	@$(ECHO)  Mv........ $(MVPROG)
+	@$(ECHO)  Cp........ $(CPPROG)
+	@$(ECHO)  Rm........ $(RMPROG)
+	@$(ECHO)  GInstall.. $(GINSTALL)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  Shell..... $(SHELL)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  FPCMake... $(FPCMAKE)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  Upx....... $(UPXPROG)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders........ $(TARGET_LOADERS)
+	@$(ECHO)  Target Units.......... $(TARGET_UNITS)
+	@$(ECHO)  Target Implicit Units. $(TARGET_IMPLICITUNITS)
+	@$(ECHO)  Target Programs....... $(TARGET_PROGRAMS)
+	@$(ECHO)  Target Dirs........... $(TARGET_DIRS)
+	@$(ECHO)  Target Examples....... $(TARGET_EXAMPLES)
+	@$(ECHO)  Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
+	@$(ECHO)
+	@$(ECHO)  Clean Units......... $(CLEAN_UNITS)
+	@$(ECHO)  Clean Files......... $(CLEAN_FILES)
+	@$(ECHO)
+	@$(ECHO)  Install Units....... $(INSTALL_UNITS)
+	@$(ECHO)  Install Files....... $(INSTALL_FILES)
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+	@$(ECHO)  DateStr.............. $(DATESTR)
+	@$(ECHO)  ZipName.............. $(ZIPNAME)
+	@$(ECHO)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipCrossPrefix....... $(ZIPCROSSPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)  FullZipName.......... $(FULLZIPNAME)
+	@$(ECHO)  Install FPC Package.. $(INSTALL_FPCPACKAGE)
+	@$(ECHO)
+	@$(ECHO)  Install base dir..... $(INSTALL_BASEDIR)
+	@$(ECHO)  Install binary dir... $(INSTALL_BINDIR)
+	@$(ECHO)  Install library dir.. $(INSTALL_LIBDIR)
+	@$(ECHO)  Install units dir.... $(INSTALL_UNITDIR)
+	@$(ECHO)  Install source dir... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  Install doc dir...... $(INSTALL_DOCDIR)
+	@$(ECHO)  Install example dir.. $(INSTALL_EXAMPLEDIR)
+	@$(ECHO)  Install data dir..... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  Dist destination dir. $(DIST_DESTDIR)
+	@$(ECHO)  Dist zip name........ $(DIST_ZIPNAME)
+	@$(ECHO)
+.PHONY: fpc_info
+fpc_info: $(INFORULES)
+.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
+	fpc_makefile_dirs
+fpc_makefile:
+	$(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
+fpc_makefile_sub1:
+ifdef TARGET_DIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
+endif
+fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
+fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
+fpc_makefiles: fpc_makefile fpc_makefile_dirs
+ifndef BIN2S
+BIN2S:=$(strip $(wildcard $(addsuffix /bin2s$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(BIN2S),)
+BIN2S= __missing_command_BIN2S
+else
+BIN2S:=$(firstword $(BIN2S))
+endif
+endif
+export BIN2S
+ifndef MMUTIL
+MMUTIL:=$(strip $(wildcard $(addsuffix /mmutil$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MMUTIL),)
+MMUTIL= __missing_command_MMUTIL
+else
+MMUTIL:=$(firstword $(MMUTIL))
+endif
+endif
+export MMUTIL
+ifndef GRIT
+GRIT:=$(strip $(wildcard $(addsuffix /grit$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GRIT),)
+GRIT= __missing_command_GRIT
+else
+GRIT:=$(firstword $(GRIT))
+endif
+endif
+export GRIT
+debug: fpc_debug
+smart: fpc_smart
+release: fpc_release
+units: fpc_units
+examples:
+shared: fpc_shared
+install: fpc_install
+sourceinstall: fpc_sourceinstall
+exampleinstall: fpc_exampleinstall
+distinstall:
+zipinstall:
+zipsourceinstall:
+zipexampleinstall:
+zipdistinstall:
+clean: fpc_clean
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+makefiles: fpc_makefiles
+.PHONY: debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
+.NOTPARALLEL:
+all: direc fpc_all 
+direc:
+ifneq ($(BUILD), $(CURDIR))
+	$(MKDIR) $(BUILD)
+endif
+soundbank.bin.o : $(AUDIO_FILES)
+	@$(MMUTIL) $^ -d -o$(BUILD)/soundbank.bin -h$(BUILD)/soundbank.h
+	$(BIN2S) $(BUILD)/soundbank.bin > $(BUILD)/soundbank.bin.s
+	$(AS) -o $(BUILD)/soundbank.bin.o $(BUILD)/soundbank.bin.s
+$(GFX_FILES).o: 
+	$(GRIT) gfx/$(GFX_FILES) -fts -ff gfx/$(basename $(GFX_FILES)).grit -o$(BUILD)/$(GFX_FILES)
+	$(AS) -o $(BUILD)/$(basename $(GFX_FILES)).o $(BUILD)/$(basename $(GFX_FILES)).s

+ 46 - 0
packages/libndsfpc/examples/time/timercallback/Makefile.fpc

@@ -0,0 +1,46 @@
+#
+#   Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
+#
+
+[target]
+loaders=
+programs=timercallback
+
+[require]
+packages=libndsfpc
+tools=bin2s mmutil grit
+nortl=y
+
+[install]
+fpcpackage=y
+
+[default]
+cpu=arm
+target=nds
+fpcdir=../../../../..
+
+[clean]
+files=*.elf *.o *.s *.nds *.nef *.h *.bin \
+       $(BUILD)/*
+units=*
+
+[prerules]
+BUILD = build
+AUDIO_FILES = $(foreach dir,$(notdir $(wildcard audio/*.*)),$(CURDIR)/audio/$(dir))
+GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png)))
+
+[rules]
+.NOTPARALLEL:
+all: direc fpc_all 
+direc:
+ifneq ($(BUILD), $(CURDIR))
+        $(MKDIR) $(BUILD)
+endif
+soundbank.bin.o : $(AUDIO_FILES)
+        @$(MMUTIL) $^ -d -o$(BUILD)/soundbank.bin -h$(BUILD)/soundbank.h
+        $(BIN2S) $(BUILD)/soundbank.bin > $(BUILD)/soundbank.bin.s
+        $(AS) -o $(BUILD)/soundbank.bin.o $(BUILD)/soundbank.bin.s
+
+$(GFX_FILES).o: 
+        $(GRIT) gfx/$(GFX_FILES) -fts -ff gfx/$(basename $(GFX_FILES)).grit -o$(BUILD)/$(GFX_FILES)
+        $(AS) -o $(BUILD)/$(basename $(GFX_FILES)).o $(BUILD)/$(basename $(GFX_FILES)).s

+ 44 - 0
packages/libndsfpc/examples/time/timercallback/timercallback.pp

@@ -0,0 +1,44 @@
+program timercallback;
+
+
+{$mode objfpc}
+
+uses
+  ctypes, nds9;
+  
+  
+procedure waitfor(keys: cint);
+begin
+  scanKeys();
+  while ((keysDown() and keys) = 0) do
+  begin
+    swiWaitForVBlank();
+    scanKeys();
+  end;
+end;
+
+var
+  channel: cuint = 0;
+  play: boolean = true;
+
+//this function will be called by the timer.
+procedure timerCallBack();
+begin
+	if (play) then
+		soundPause(channel)
+	else
+		soundResume(channel);
+
+	play := not play;
+end;
+
+begin
+	soundEnable();
+	channel := soundPlayPSG(DutyCycle_50, 10000, 127, 64);
+
+	//calls the timerCallBack function 5 times per second.
+	timerStart(0, ClockDivider_1024, TIMER_FREQ_1024(5), @timerCallBack);
+
+	waitfor(KEY_A);
+
+end.

+ 1 - 41
packages/libndsfpc/src/nds/arm7/audio.inc

@@ -1,45 +1,5 @@
-(*
-  $Id: audio.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifndef ARM7}
-{$error Audio is only available on the ARM7}
+  {$error Audio is only available on the ARM7}
 {$endif ARM7}
 
 

+ 1 - 41
packages/libndsfpc/src/nds/arm7/clock.inc

@@ -1,45 +1,5 @@
-(*
-  $Id: clock.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifndef ARM7}
-{$error The clock is only available on the ARM7}
+  {$error The clock is only available on the ARM7}
 {$endif ARM7}
 
 {$ifdef NDS_INTERFACE}

+ 34 - 0
packages/libndsfpc/src/nds/arm7/i2c.inc

@@ -0,0 +1,34 @@
+{$ifndef ARM7}
+  {$error i2c header is for ARM7 only}
+{$endif}
+
+{$ifdef NDS_INTERFACE}
+const
+  REG_I2CDATA : pcuint8 = pointer($4004500);
+  REG_I2CCNT	: pcuint8 = pointer($4004501);
+
+procedure i2cWaitBusy(); inline;
+
+type
+  i2cDevices = integer;
+const
+	I2C_CAM0: i2cDevices = $7A;
+	I2C_CAM1: i2cDevices = $78;
+	I2C_UNK1: i2cDevices = $A0;
+	I2C_UNK2: i2cDevices = $E0;
+	I2C_PM  : i2cDevices = $4A;
+	I2C_UNK3: i2cDevices = $40;
+	I2C_UNK4: i2cDevices = $90;
+
+
+function i2cWriteRegister(device, reg, data: cuint8): cuint8; cdecl; external;
+function i2cReadRegister(device, reg: cuint8): cuint8; cdecl; external;
+
+{$endif NDS_INTERFACE}
+
+{$ifdef NDS_IMPLEMENTATION}
+procedure i2cWaitBusy(); inline;
+begin
+  while (REG_I2CCNT^ and $80) <> 0 do;
+end;
+{$endif NDS_IMPLEMENTATION}

+ 0 - 2
packages/libndsfpc/src/nds/arm7/input.inc

@@ -1,5 +1,3 @@
 {$ifdef NDS_INTERFACE}
-
 procedure inputGetAndSend(); cdecl; external;
-
 {$endif NDS_INTERFACE}

+ 94 - 0
packages/libndsfpc/src/nds/arm7/sdmmc.inc

@@ -0,0 +1,94 @@
+{$ifdef NDS_INTERFACE}
+const
+  SDMMC_BASE = $04004800;
+  DISPSTAT_CHK_VBLANK = (1 shl 0);
+
+  REG_SDSTATUS0	  = $1c;
+  REG_SDSTATUS1	  = $1e;
+  REG_SDRESET     = $e0;
+  REG_SDCLKCTL    = $24; 
+  REG_SDOPT       = $28;
+  REG_SDCMD       = $00;
+  REG_SDCMDARG    = $04;
+  REG_SDCMDARG0   = $04;
+  REG_SDCMDARG1  	= $06;
+  REG_SDSTOP      = $08;
+  REG_SDRESP      = $0c;
+  
+  REG_SDRESP0     = $0c;
+  REG_SDRESP1     = $0e;
+  REG_SDRESP2     = $10;
+  REG_SDRESP3     = $12;
+  REG_SDRESP4     = $14;
+  REG_SDRESP5     = $16;
+  REG_SDRESP6     = $18;
+  REG_SDRESP7     = $1a;
+  
+  REG_SDBLKLEN    = $26;
+  REG_SDBLKCOUNT  = $0a;
+  REG_SDFIFO      = $30;
+  
+  TMIO_STAT_CMDRESPEND    = $00000001;
+  TMIO_STAT_DATAEND       = $00000004;
+  TMIO_STAT_CARD_REMOVE   = $00000008;
+  TMIO_STAT_CARD_INSERT   = $00000010;
+  TMIO_STAT_SIGSTATE      = $00000020;
+  TMIO_STAT_WRPROTECT     = $00000080;
+  TMIO_STAT_CARD_REMOVE_A = $00000100;
+  TMIO_STAT_CARD_INSERT_A = $00000200;
+  TMIO_STAT_SIGSTATE_A    = $00000400;
+  TMIO_STAT_CMD_IDX_ERR   = $00010000;
+  TMIO_STAT_CRCFAIL       = $00020000;
+  TMIO_STAT_STOPBIT_ERR   = $00040000;
+  TMIO_STAT_DATATIMEOUT   = $00080000;
+  TMIO_STAT_RXOVERFLOW    = $00100000;
+  TMIO_STAT_TXUNDERRUN    = $00200000;
+  TMIO_STAT_CMDTIMEOUT    = $00400000;
+  TMIO_STAT_RXRDY         = $01000000;
+  TMIO_STAT_TXRQ          = $02000000;
+  TMIO_STAT_ILL_FUNC      = $20000000;
+  TMIO_STAT_CMD_BUSY      = $40000000;
+  TMIO_STAT_ILL_ACCESS    = $80000000;
+
+procedure sdmmc_controller_init(); cdecl; external;
+procedure sdmmc_initirq(); cdecl; external;
+function sdmmc_cardinserted(): cint; cdecl; external;
+
+function sdmmc_sdcard_init(): cint; cdecl; external;
+procedure sdmmc_sdcard_readsector(sector_no: cuint32; _out: pointer); cdecl; external;
+procedure sdmmc_sdcard_readsectors(sector_no: cuint32; int numsectors: cint; _out: pointer); cdecl; external;
+procedure sdmmc_sdcard_writesector(sector_no: cuint32; _in: pointer); cdecl; external;
+procedure sdmmc_sdcard_writesectors(sector_no: cuint32; int numsectors: cint; _in: pointer); cdecl; external;
+
+var
+  sdmmc_curdevice: cint; cvar; external;
+  sdmmc_cid: pcuint32; cvar; external;
+
+function sdmmc_read16(reg: cuint16): cuint16; inline;
+procedure sdmmc_write16(reg, val: cuint16); inline;
+procedure sdmmc_mask16(reg, clear, _set: cuint16); inline;
+
+{$endif NDS_INTERFACE}
+
+{$ifdef NDS_IMPLEMENTATION}
+function sdmmc_read16(reg: cuint16): cuint16; inline;
+begin
+  sdmmc_read16 := pcuint16(SDMMC_BASE + reg)^;
+end;
+
+procedure sdmmc_write16(reg, val: cuint16); inline;
+begin
+	pcuint16(SDMMC_BASE + reg)^ := val;
+end;
+
+procedure sdmmc_mask16(reg, clear, _set: cuint16); inline;
+var
+  val: cuint16;
+begin
+	val := sdmmc_read16(reg);
+	val := val and not clear;
+	val := val or _set;
+	sdmmc_write16(reg, val);
+end;
+{$endif NDS_IMPLEMENTATION}
+

+ 1 - 41
packages/libndsfpc/src/nds/arm7/serial.inc

@@ -1,45 +1,5 @@
-(*
-  $Id: serial.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifndef ARM7}
-{$error Serial header is for ARM7 only}
+  {$error Serial header is for ARM7 only}
 {$endif ARM7}
 
 {$ifdef NDS_INTERFACE}

+ 1 - 41
packages/libndsfpc/src/nds/arm7/touch.inc

@@ -1,45 +1,5 @@
-(*
-  $Id: touch.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifndef ARM7}
-{$error Touch screen is only available on the ARM7}
+  {$error Touch screen is only available on the ARM7}
 {$endif ARM7}
 
 {$ifdef NDS_INTERFACE}

+ 0 - 40
packages/libndsfpc/src/nds/arm9/background.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: background.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 type
   bg_scroll = record

+ 0 - 41
packages/libndsfpc/src/nds/arm9/boxtest.inc

@@ -1,44 +1,3 @@
-(*
-  $Id: boxtest.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
-
 {$ifdef NDS_INTERFACE}
 function BoxTest(x, y, z, width, height, depth: v16): cint; cdecl; external;
 

+ 0 - 45
packages/libndsfpc/src/nds/arm9/cache.inc

@@ -1,53 +1,8 @@
-(*
-  $Id: cache.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 procedure IC_InvalidateAll(); cdecl; external;
-
 procedure IC_InvalidateRange(const base: pointer; size: cuint32); cdecl; external;
-
 procedure DC_FlushAll(); cdecl; external;
-
 procedure DC_FlushRange(const base: pointer; size: cuint32); cdecl; external;
-
 procedure DC_InvalidateAll(); cdecl; external;
-
 procedure DC_InvalidateRange(const base: pointer; size: cuint32); cdecl; external;
 {$endif NDS_INTERFACE}

+ 1 - 41
packages/libndsfpc/src/nds/arm9/console.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: console.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 //const
 //  CONSOLE_USE_COLOR255 = 16;
@@ -117,7 +77,7 @@ const
 procedure consoleSetFont(console: PPrintConsole; font: PConsoleFont); cdecl; external;
 procedure consoleSetWindow(console: PPrintConsole; x, y, width, height: cint); cdecl; external;
 function consoleGetDefault(): PPrintConsole; cdecl; external;
-procedure consoleSelect(console: PPrintConsole); cdecl; external;
+function consoleSelect(console: PPrintConsole): PPrintConsole; cdecl; external;
 function consoleInit(console: PPrintConsole; layer: cint; atype: BgType; size: BgSize; mapBase, 
   tileBase: cint; mainDisplay: cbool; loadGraphics: cbool): pPrintConsole; cdecl; external;
 function consoleDemoInit(): PPrintConsole; cdecl; external;

+ 0 - 40
packages/libndsfpc/src/nds/arm9/decompress.inc

@@ -1,43 +1,3 @@
-(*
-  $Id$
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 
 //type

+ 0 - 40
packages/libndsfpc/src/nds/arm9/dynamicArray.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: dynamicArray.inc 13585 2009-08-23 13:57:45Z Legolas $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 type
   DynamicArray = record 

+ 0 - 40
packages/libndsfpc/src/nds/arm9/exceptions.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: exceptions.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 const
   EXCEPTION_VECTOR : ^VoidFn = pointer($2FFFD9C);

+ 17 - 0
packages/libndsfpc/src/nds/arm9/guitarGrip.inc

@@ -0,0 +1,17 @@
+{$ifdef NDS_INTERFACE}
+
+
+const
+  GUITARGRIP_GREEN   = (1 shl 6);
+  GUITARGRIP_RED     = (1 shl 5);
+  GUITARGRIP_YELLOW  = (1 shl 4);
+  GUITARGRIP_BLUE    = (1 shl 3);
+
+function guitarGripIsInserted(): cbool; cdecl; external;
+procedure guitarGripScanKeys(); cdecl; external;
+
+function guitarGripKeysHeld(): cuint8; cdecl; external;
+function guitarGripKeysDown(): cuint8; cdecl; external;
+function guitarGripKeysUp(): cuint8; cdecl; external;
+
+{$endif NDS_INTERFACE}

+ 0 - 40
packages/libndsfpc/src/nds/arm9/image.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: image.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 type
 //holds a rgb triplet

+ 0 - 40
packages/libndsfpc/src/nds/arm9/input.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: input.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
   
 procedure scanKeys(); cdecl; external;

+ 0 - 27
packages/libndsfpc/src/nds/arm9/linkedlist.inc

@@ -1,30 +1,3 @@
-(*---------------------------------------------------------------------------------
-
-	A simple linked list data structure
-
-  Copyright (C) 2008
-			Jason Rogers (dovoto)
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any
-  damages arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any
-  purpose, including commercial applications, and to alter it and
-  redistribute it freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you
-     must not claim that you wrote the original software. If you use
-     this software in a product, an acknowledgment in the product
-     documentation would be appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and
-     must not be misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source
-     distribution.
-
-
----------------------------------------------------------------------------------*)
-
 {$ifdef NDS_INTERFACE}
 
 type

+ 0 - 40
packages/libndsfpc/src/nds/arm9/math.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: math.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 //  Math coprocessor register definitions
 const

+ 0 - 38
packages/libndsfpc/src/nds/arm9/ndsmotion.inc

@@ -1,41 +1,3 @@
-(*
-  $Id: ndsmotion.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2007
-  		Michael Noland (joat)
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-        
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2007  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 type
   MotionCalibration = record

+ 6 - 0
packages/libndsfpc/src/nds/arm9/paddle.inc

@@ -0,0 +1,6 @@
+{$ifdef NDS_INTERFACE}
+function paddleIsInserted(): cbool; cdecl; external;
+function paddleRead(): cuint16; cdecl; external;
+procedure paddleReset(); cdecl; external;
+
+{$endif NDS_INTERFACE}

+ 0 - 40
packages/libndsfpc/src/nds/arm9/pcx.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: pcx.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 type
   // short int = cint16???

+ 24 - 0
packages/libndsfpc/src/nds/arm9/piano.inc

@@ -0,0 +1,24 @@
+{$ifdef NDS_INTERFACE}
+const
+  PIANO_PAK: pcuint16 = pointer($09FFFFFE);
+  PIANO_C   = (1 shl 0);
+  PIANO_CS  = (1 shl 1);
+  PIANO_D   = (1 shl 2);
+  PIANO_DS  = (1 shl 3);
+  PIANO_E   = (1 shl 4);
+  PIANO_F   = (1 shl 5);
+  PIANO_FS  = (1 shl 6);
+  PIANO_G   = (1 shl 7);
+  PIANO_GS  = (1 shl 8);
+  PIANO_A   = (1 shl 9);
+  PIANO_AS  = (1 shl 10);
+  PIANO_B   = (1 shl 13);
+  PIANO_C2  = (1 shl 14);
+
+function pianoIsInserted(): cbool; cdecl; external;
+procedure pianoScanKeys(); cdecl; external;
+
+function pianoKeysHeld(): cuint16; cdecl; external;
+function pianoKeysDown(): cuint16; cdecl; external;
+function pianoKeysUp(): cuint16; cdecl; external;
+{$endif NDS_INTERFACE}

+ 0 - 38
packages/libndsfpc/src/nds/arm9/postest.inc

@@ -1,41 +1,3 @@
-(*
-  $Id: postest.inc 25 2007-12-10 21:06:46Z p4p3r0 $ 
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2007
-  		Michael Noland (joat)
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-        
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2007  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_IMPLEMENTATION}
 function PosTestBusy(): cbool; inline;
 begin

+ 0 - 40
packages/libndsfpc/src/nds/arm9/rumble.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: rumble.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 const
   RUMBLE_PAK: pcuint16 = pointer($08000000);

+ 0 - 41
packages/libndsfpc/src/nds/arm9/sassert.inc

@@ -1,44 +1,3 @@
-(*
-  $Id$
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
-
 {$ifdef NDS_INTERFACE}
 procedure __sassert(const fileName: pchar; lineNumber: cint; const conditionString: pchar; const amessage: pchar); cdecl; external;
 procedure sassert(e: boolean; msg: string); inline;

+ 0 - 40
packages/libndsfpc/src/nds/arm9/sound.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: sound.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 
 type

+ 0 - 42
packages/libndsfpc/src/nds/arm9/sprite.inc

@@ -1,45 +1,3 @@
-(*
-  $Id: sprite.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	sprite.h -- definitions for DS sprites
-  
-  	Copyright (C) 2007
-  		Liran Nuna	(LiraNuna)
-  		Dave Murphy (WinterMute)
-  
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  
-  	1.	The origin of this software must not be misrepresented; you
-  	must not claim that you wrote the original software. If you use
-  	this software in a product, an acknowledgment in the product
-  	documentation would be appreciated but is not required.
-  
-  	2.	Altered source versions must be plainly marked as such, and
-  	must not be misrepresented as being the original software.
-  
-  	3.	This notice may not be removed or altered from any source
-  	distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifndef ARM9}
   {$error Sprites are only available on the ARM9}
 {$endif ARM9}

+ 0 - 40
packages/libndsfpc/src/nds/arm9/trig_lut.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: trig_lut.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 const
   DEGREES_IN_CIRCLE = (1 shl 15);

+ 38 - 45
packages/libndsfpc/src/nds/arm9/video.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: video.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifndef ARM9}
   {$error Video is only available on the ARM9}
 {$endif ARM9}
@@ -89,6 +49,7 @@ const
   VRAM_B_CR		: pcuint8 = pointer($04000241);
   VRAM_C_CR		: pcuint8 = pointer($04000242);
   VRAM_D_CR		: pcuint8 = pointer($04000243);
+  VRAM_EFG_CR	: pcuint8 = pointer($04000244);
   VRAM_E_CR		: pcuint8 = pointer($04000244);
   VRAM_F_CR		: pcuint8 = pointer($04000245);
   VRAM_G_CR		: pcuint8 = pointer($04000246);
@@ -261,9 +222,12 @@ var
   VRAM_G_EXT_PALETTE : P_ext_palette absolute VRAM_G;
   VRAM_H_EXT_PALETTE : P_ext_palette absolute VRAM_H;
 
-function vramSetMainBanks(a: VRAM_A_TYPE; b: VRAM_B_TYPE; c: VRAM_C_TYPE; d: VRAM_D_TYPE): cuint32; cdecl; external;
+function vramSetPrimaryBanks(a: VRAM_A_TYPE; b: VRAM_B_TYPE; c: VRAM_C_TYPE; d: VRAM_D_TYPE): cuint32; cdecl; external; 
+function vramSetMainBanks(a: VRAM_A_TYPE; b: VRAM_B_TYPE; c: VRAM_C_TYPE; d: VRAM_D_TYPE): cuint32; cdecl; external; deprecated;
 function vramDefault(): cuint32; cdecl; external;
-procedure vramRestoreMainBanks(vramTemp: cuint32); cdecl; external;
+procedure vramRestorePrimaryBanks(vramTemp: cuint32); cdecl; external;
+procedure vramRestoreMainBanks(vramTemp: cuint32); cdecl; external; deprecated;
+procedure vramRestoreBanks_EFG(vramTemp: cuint32); cdecl; external;
 
 procedure vramSetBankA(a: VRAM_A_TYPE); inline;
 procedure vramSetBankB(b: VRAM_B_TYPE); inline;
@@ -426,14 +390,33 @@ const
   DCAP_ENABLE    = (1 shl 31);
 
 function DCAP_MODE(n: cint): cint; inline;   
-function DCAP_DST(n: cint): cint; inline;    
+function DCAP_SRC_ADDR(n: cint): cint; inline;    
 function DCAP_SRC(n: cint): cint; inline;    
+function DCAP_SRC_A(n: cint): cint;
+function DCAP_SRC_B(n: cint): cint;
 function DCAP_SIZE(n: cint): cint; inline;   
 function DCAP_OFFSET(n: cint): cint; inline; 
 function DCAP_BANK(n: cint): cint; inline;   
 function DCAP_B(n: cint): cint; inline;      
 function DCAP_A(n: cint): cint; inline;      
 
+const
+  DCAP_MODE_A           = 0;
+  DCAP_MODE_B           = 1;
+  DCAP_MODE_BLEND       = 2;
+  DCAP_SRC_A_COMPOSITED = 0;
+  DCAP_SRC_A_3DONLY     = 1;
+  DCAP_SRC_B_VRAM       = 0;
+  DCAP_SRC_B_DISPFIFO   = 1;
+  DCAP_SIZE_128x128     = 0;
+  DCAP_SIZE_256x64      = 1;
+  DCAP_SIZE_256x128     = 2;
+  DCAP_SIZE_256x192     = 3;
+  DCAP_BANK_VRAM_A      = 0;
+  DCAP_BANK_VRAM_B      = 1;
+  DCAP_BANK_VRAM_C      = 1;
+  DCAP_BANK_VRAM_D      = 2;
+
 const
   GFX_CONTROL           : pcuint16 = pointer($04000060);
 
@@ -599,9 +582,9 @@ begin
   DCAP_MODE := (((n) and 3) shl 29);
 end;
 
-function DCAP_DST(n: cint): cint; inline;    
+function DCAP_SRC_ADDR(n: cint): cint; inline;    
 begin
-  DCAP_DST := (((n) and 3) shl 26);
+  DCAP_SRC_ADDR := (((n) and 3) shl 26);
 end;
 
 function DCAP_SRC(n: cint): cint; inline;    
@@ -609,6 +592,16 @@ begin
   DCAP_SRC := (((n) and 3) shl 24);
 end;
 
+function DCAP_SRC_A(n: cint): cint;
+begin
+  DCAP_SRC_A := (((n) and 1) shl 24);
+end;
+
+function DCAP_SRC_B(n: cint): cint;
+begin
+  DCAP_SRC_B := (((n) and 1) shl 25);
+end;
+
 function DCAP_SIZE(n: cint): cint; inline;   
 begin
   DCAP_SIZE := (((n) and 3) shl 20);

+ 1 - 42
packages/libndsfpc/src/nds/arm9/videoGL.inc

@@ -1,44 +1,3 @@
-(*
-  $Id: videoGL.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
-
 {$ifndef ARM9}
   {$error 3D hardware is only available from the ARM9}
 {$endif}
@@ -741,7 +700,7 @@ end;
 procedure glVertex3v16(x, y, z: v16); inline;
 begin
 	GFX_VERTEX16^ := cuint32((y shl 16) or (x and $FFFF));
-	GFX_VERTEX16^ := cuint32(cuint16(z));
+	GFX_VERTEX16^ := z;
 end;
 
 procedure glTexCoord2t16(u, v: t16); inline; 

+ 0 - 40
packages/libndsfpc/src/nds/bios.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: bios.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 
 type

+ 1 - 34
packages/libndsfpc/src/nds/card.inc

@@ -1,36 +1,3 @@
-(*
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  ------------------------------------------------------------------------------
-*)
-
-
 {$ifdef NDS_INTERFACE}
 const  
   // Card bus
@@ -105,7 +72,7 @@ procedure cardParamCommand(command: cuint8; parameter, flags: cuint32; destinati
 
 procedure cardReadHeader(header: pcuint8); cdecl; external;
 function cardReadID(flags: cuint32): cuint32; cdecl; external;
-
+procedure cardReset(); cdecl; external;
 
 
 procedure cardReadEeprom(address: cuint32;  data: pcuint8;  length: cuint32;  addrtype: cuint32); cdecl; external; 

+ 0 - 40
packages/libndsfpc/src/nds/debug.inc

@@ -1,43 +1,3 @@
-(*
-  $Id$
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 
 procedure nocashWrite(const aMessage: pchar; len: cint); cdecl; external;

+ 10 - 40
packages/libndsfpc/src/nds/disc_io.inc

@@ -1,43 +1,3 @@
-(*
-  $Id$
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 
 const
@@ -46,6 +6,8 @@ const
   FEATURE_SLOT_GBA			= $00000010;
   FEATURE_SLOT_NDS			= $00000020;
 
+function DEVICE_TYPE_DSI_SD(): cuint32; inline;
+
 type
   FN_MEDIUM_STARTUP = function: cbool;
   FN_MEDIUM_ISINSERTED = function: cbool;
@@ -76,10 +38,18 @@ type
     PI_CUSTOM
   );
 *)
+
+var
+  __io_dsisd: DISC_INTERFACE; cvar; external;
+
 {$endif NDS_INTERFACE}
 
 {$ifdef NDS_IMPLEMENTATION}
 
+function DEVICE_TYPE_DSI_SD(): cuint32; inline; 
+begin
+  DEVICE_TYPE_DSI_SD := ord('i') or (ord('_') shl 8) or (ord('S') shl 16) or (ord('D') shl 24);
+end;
 
 
 {$endif NDS_IMPLEMENTATION}

+ 0 - 42
packages/libndsfpc/src/nds/dma.inc

@@ -1,45 +1,3 @@
-(*
-  $Id: dma.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
-
-
 {$ifdef NDS_INTERFACE}
 const
   DMA0_SRC       : pcuint32 = pointer($040000B0);

+ 8 - 44
packages/libndsfpc/src/nds/fifocommon.inc

@@ -1,43 +1,3 @@
-(*
-  $Id$
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 
 {$ifdef NDS_INTERFACE}
  
@@ -80,10 +40,14 @@ const
 type
   FifoSystemCommands = integer;
 const
-  SYS_REQ_TOUCH : FifoSystemCommands = 0;
-  SYS_REQ_KEYS  : FifoSystemCommands = 1;
-  SYS_REQ_TIME  : FifoSystemCommands = 2;
-  SYS_SET_TIME  : FifoSystemCommands = 3;
+  SYS_REQ_TOUCH      : FifoSystemCommands = 0;
+  SYS_REQ_KEYS       : FifoSystemCommands = 1;
+  SYS_REQ_TIME       : FifoSystemCommands = 2;
+  SYS_SET_TIME       : FifoSystemCommands = 3;
+  SYS_HAVE_SD        : FifoSystemCommands = 4;
+	SYS_SD_START       : FifoSystemCommands = 5;
+	SYS_SD_IS_INSERTED : FifoSystemCommands = 6;
+	SYS_SD_STOP        : FifoSystemCommands = 7;
 
 type
   FifoPMCommands = integer;

+ 9 - 29
packages/libndsfpc/src/nds/fifomessages.inc

@@ -1,32 +1,3 @@
-(*
-  $Id$
-  ---------------------------------------------------------------------------------
-
-	Sound Functions
-
-	Copyright (C) 2008
-		Jason Rogers (Dovoto)
-
-	This software is provided 'as-is', without any express or implied
-	warranty.  In no event will the authors be held liable for any
-	damages arising from the use of this software.
-
-	Permission is granted to anyone to use this software for any
-	purpose, including commercial applications, and to alter it and
-	redistribute it freely, subject to the following restrictions:
-
-	1.	The origin of this software must not be misrepresented; you
-		must not claim that you wrote the original software. If you use
-		this software in a product, an acknowledgment in the product
-		documentation would be appreciated but is not required.
-	2.	Altered source versions must be plainly marked as such, and
-		must not be misrepresented as being the original software.
-	3.	This notice may not be removed or altered from any source
-		distribution.
-
-
----------------------------------------------------------------------------------*)
-
 {$ifdef NDS_INTERFACE}
 
 type
@@ -38,6 +9,8 @@ const
   MIC_RECORD_MESSAGE      : FifoMessageType = $1237;
   MIC_BUFFER_FULL_MESSAGE : FifoMessageType = $1238;
   SYS_INPUT_MESSAGE       : FifoMessageType = $1239;
+	SYS_SD_READ_SECTORS     : FifoMessageType = $1240;
+	SYS_SD_WRITE_SECTORS    : FifoMessageType = $1241;
 
 type
 {$PACKRECORDS 4} 
@@ -86,6 +59,13 @@ type
           keys: cuint16;
         end;
       );
+      5: (
+        sdParams: record
+          buffer: pointer;
+			    startsector: cuint32;
+			    numsectors: cuint32;
+			  end;
+		  );
   end;
   TFifoMessage = FifoMessage;
   PFifoMessage = ^FifoMessage;

+ 0 - 37
packages/libndsfpc/src/nds/helper.inc

@@ -1,40 +1,3 @@
-(*
-  $Id: helper.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-    Copyright (C) 2007  Francesco Lombardi
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 type
   time_t = cint;

+ 0 - 40
packages/libndsfpc/src/nds/input.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: input.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 // Keyboard
 type

+ 1 - 42
packages/libndsfpc/src/nds/interrupts.inc

@@ -1,44 +1,3 @@
-(*
-  $Id: interrupts.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
-
 {$ifdef NDS_INTERFACE}
 type
   IRQ_MASK = cuint;
@@ -72,7 +31,7 @@ const
 type
   IRQ_MASKSAUX = cuint;
 const
-  IRQ_POWER: IRQ_MASKSAUX = (1 shl 6); (* Power Button interrupt mask (DSi ARM7) *)
+  IRQ_I2C: IRQ_MASKSAUX = (1 shl 6); (* Power Button interrupt mask (DSi ARM7) *)
 
 function IRQ_TIMER(n: cint): cint; inline;
 

+ 0 - 40
packages/libndsfpc/src/nds/jtypes.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: jtypes.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 //---------------------------------------------------------------------------------
 {
 //---------------------------------------------------------------------------------

+ 0 - 40
packages/libndsfpc/src/nds/memory.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: memory.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 
 const

+ 1 - 5
packages/libndsfpc/src/nds/nds.inc

@@ -1,5 +1,4 @@
 (* 
-  $Id: nds.inc 25 2007-12-10 21:06:46Z p4p3r0 $
   ------------------------------------------------------------------------------
   	Copyright (C) 2005
   		Jason Rogers (dovoto)
@@ -51,11 +50,8 @@
       end.
   ------------------------------------------------------------------------------
 
-  $Log$
-
 *)
-*
-*
+
 {$ifndef NDS_INC}
 {$define NDS_INC}
 

+ 4 - 0
packages/libndsfpc/src/nds/ndsinclude.inc

@@ -40,12 +40,16 @@
   {$include arm9/sprite.inc}
   {$include arm9/decompress.inc}
   {$include arm9/ndsmotion.inc}
+  {$include arm9/guitarGrip.inc}
+  {$include arm9/paddle.inc}
+  {$include arm9/piano.inc}
 {$endif ARM9}
 
 {$ifdef ARM7}
   {$include arm7/audio.inc}
   {$include arm7/clock.inc}
   {$include arm7/input.inc}
+  {$include arm7/i2c.inc}
   {$include arm7/serial.inc}
   {$include arm7/touch.inc}
 {$endif ARM7}

+ 0 - 40
packages/libndsfpc/src/nds/ndstypes.inc

@@ -1,43 +1,3 @@
-(*
-  $Id$
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 //---------------------------------------------------------------------------------
 {
 //---------------------------------------------------------------------------------

+ 0 - 40
packages/libndsfpc/src/nds/registers_alt.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: registers_alt.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 type 
   f32 = integer;

+ 0 - 40
packages/libndsfpc/src/nds/system.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: system.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 const
   REG_DISPSTAT	: pcuint16 = pointer($04000004);

+ 12 - 40
packages/libndsfpc/src/nds/timers.inc

@@ -1,43 +1,3 @@
-(*
-  $Id: timers.inc 25 2007-12-10 21:06:46Z p4p3r0 $
-  ------------------------------------------------------------------------------
-  	Copyright (C) 2005
-  		Jason Rogers (dovoto)
-  		Dave Murphy (WinterMute)
-  	
-  	This software is provided 'as-is', without any express or implied
-  	warranty.  In no event will the authors be held liable for any
-  	damages arising from the use of this software.
-  	
-  	Permission is granted to anyone to use this software for any
-  	purpose, including commercial applications, and to alter it and
-  	redistribute it freely, subject to the following restrictions:
-  	
-  	1.	The origin of this software must not be misrepresented; you
-  		must not claim that you wrote the original software. If you use
-  		this software in a product, an acknowledgment in the product
-  		documentation would be appreciated but is not required.
-  	
-  	2.	Altered source versions must be plainly marked as such, and
-  		must not be misrepresented as being the original software.
-  	
-  	3.	This notice may not be removed or altered from any source
-  		distribution.
-  ------------------------------------------------------------------------------
-    
-    
-  Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
-  (http://www.freepascal.org)
-   
-  Copyright (C) 2006  Francesco Lombardi
-  Check http://sourceforge.net/projects/libndsfpc for updates
-   
-  ------------------------------------------------------------------------------
-
-  $Log$
-
-*)
-
 {$ifdef NDS_INTERFACE}
 
 const
@@ -95,6 +55,8 @@ procedure cpuStartTiming(timer: cuint32); cdecl; external;
 function cpuGetTiming(): cuint32; cdecl; external;
 function cpuEndTiming(): cuint32; cdecl; external;
 
+function timerTicks2usec(ticks: cuint32): cuint32; inline;
+function timerTicks2msec(ticks: cuint32): cuint32; inline;
 
 function timerFreqToTicks_1(freq: cint): cuint16; inline;
 function timerFreqToTicks_64(freq: cint): cuint16; inline;
@@ -167,4 +129,14 @@ begin
   result := (-BUS_CLOCK shr 10) div freq;
 end;
 
+function timerTicks2usec(ticks: cuint32): cuint32; inline;
+begin
+  timerTicks2usec := (cuint64(ticks) * 1000000) div BUS_CLOCK;
+end;
+
+function timerTicks2msec(ticks: cuint32): cuint32; inline;
+begin
+  timerTicks2msec := (cuint64(ticks)*1000) div BUS_CLOCK;
+end;
+
 {$endif NDS_IMPLEMENTATION}

+ 32 - 0
packages/libndsfpc/src/nds7.pp

@@ -1,3 +1,35 @@
+(*---------------------------------------------------------------------------------
+
+	libnds Copyright (C) 2005
+		Michael Noland (joat)
+		Jason Rogers (dovoto)
+		Dave Murphy (WinterMute)
+
+	This software is provided 'as-is', without any express or implied
+	warranty.  In no event will the authors be held liable for any
+	damages arising from the use of this software.
+
+	Permission is granted to anyone to use this software for any
+	purpose, including commercial applications, and to alter it and
+	redistribute it freely, subject to the following restrictions:
+
+
+	1.	The origin of this software must not be misrepresented; you
+		must not claim that you wrote the original software. If you use
+		this software in a product, an acknowledgment in the product
+		documentation would be appreciated but is not required.
+
+	2.	Altered source versions must be plainly marked as such, and
+		must not be misrepresented as being the original software.
+
+	3.	This notice may not be removed or altered from any source
+		distribution.
+
+  ----------------------------------------------------------------------------
+   Free Pascal porting by Francesco Lombardi.
+---------------------------------------------------------------------------------*)
+
+
 unit nds7;
 {$mode objfpc} 
 {$apptype arm7}

+ 31 - 0
packages/libndsfpc/src/nds9.pp

@@ -1,3 +1,34 @@
+(*---------------------------------------------------------------------------------
+
+	libnds Copyright (C) 2005
+		Michael Noland (joat)
+		Jason Rogers (dovoto)
+		Dave Murphy (WinterMute)
+
+	This software is provided 'as-is', without any express or implied
+	warranty.  In no event will the authors be held liable for any
+	damages arising from the use of this software.
+
+	Permission is granted to anyone to use this software for any
+	purpose, including commercial applications, and to alter it and
+	redistribute it freely, subject to the following restrictions:
+
+
+	1.	The origin of this software must not be misrepresented; you
+		must not claim that you wrote the original software. If you use
+		this software in a product, an acknowledgment in the product
+		documentation would be appreciated but is not required.
+
+	2.	Altered source versions must be plainly marked as such, and
+		must not be misrepresented as being the original software.
+
+	3.	This notice may not be removed or altered from any source
+		distribution.
+
+  ----------------------------------------------------------------------------
+   Free Pascal porting by Francesco Lombardi.
+---------------------------------------------------------------------------------*)
+
 unit nds9;
 {$mode objfpc} 
 {$apptype arm9}