forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help With Makefile For Pad.h

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
jgrimm



Joined: 29 Nov 2009
Posts: 27

PostPosted: Mon Nov 30, 2009 10:37 am    Post subject: Help With Makefile For Pad.h Reply with quote

i have a library called Pad.h wich is a highlevel interface for libpad when i compile a program w/makefile it says "no rule to make pad.o needed by pad.elf stop." Here is Pad.h:
Code:
 #include <tamtypes.h>
#include <kernel.h>
#include <libpad.h>

namespace Ito
{
   class Pad;
}

/** Wrapper class for libpad.

   \par About
   This is a highlevel interface for libpad. This has been created
   to make it alot easier to work with pads on a simple level.

   If no other irx's are specificed on creation of the first Pad object,
   the Pad class loads the rom0:SIO2MAN and rom0:PADMAN modules and therefor
   its required to link with libpad.a (not libpadx.a!)

   \par Usage

   Create the Pad object, use Open(..) to open a pad on a specific
   port/slot. Then use ReadButtons() to read pad buttons/directional buttons.
   
   Please see samples in misc/pad directory for further usage.

*/
class Ito::Pad
{
   private:
      padButtonStatus   m_ButtonStatus ALIGNED(64);
      u8* m_PadBuffer;
   public:
      s32 m_Port;
      s32 m_Slot;
   public:
      
      /** Constructor. */
      Pad(char* sio2manIrx = 0, char* padmanIrx = 0);
      
      /** Destructor. */
      ~Pad();
      
      /** Open pad.
         \par port port to which the pad is connected (0 or 1)
         \par slot slot to which the pad is connected in a multitap, always 0 when not using multitap.
      */
      
      s32 Open(s32 port, s32 slot);
      /** Close pad. */
      s32 Close();

      /** Get pad state. Please see libpad.h for pad states.*/
      u32 GetState();
      /** Read buttons. Can be used after opening the pad with Open(..)
      
      \par You can use the following libpad defines to read the pad
      PAD_LEFT, PAD_DOWN, PAD_RIGHT, PAD_UP, PAD_START
      PAD_R3, PAD_L3, PAD_SELECT, PAD_SQUARE, PAD_CROSS     
      PAD_CIRCLE, PAD_TRIANGLE, PAD_R1, PAD_L1, PAD_R2, PAD_L2

      \par Example of usage
      
      u32 buttons = pad.ReadButtons();

      if(buttons & PAD_CROSS)
      {   
         .. // Code to execute when cross on the pad was pressed.
      }


      */
      u16 ReadButtons();
};
And Here Is Makefile:
Code:
 EE_BIN = pad.elf
EE_OBJS = Pad.o paddemo.o libpad.a
EE_LIBS = -ldebug

all: $(EE_BIN)
   ee-strip --strip-all $(EE_BIN)

clean:
   rm -f *.elf *.o *.a

run: $(EE_BIN)
   ps2client execee host:$(EE_BIN)

reset:
   ps2client reset


include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal
I think i am linking libpad.a correctly. what do i need to add to the makefile to make a rule for compiling Pad.h ? plz help -jsngrimm
Back to top
View user's profile Send private message MSN Messenger
aries2k



Joined: 13 Jan 2008
Posts: 11
Location: Portugal

PostPosted: Mon Nov 30, 2009 11:26 am    Post subject: Reply with quote

Well, I´m a newbie at this but I think you need

EE_LIBS = -ldebug -lpad

as far as I know you shouldn´t have it in th EE_OBJS
Back to top
View user's profile Send private message
ragnarok2040



Joined: 09 Aug 2006
Posts: 230

PostPosted: Mon Nov 30, 2009 11:49 pm    Post subject: Reply with quote

There isn't a rule for compiling headers in the current ps2sdk makefile system. You can add a custom rule to do it, though.
Code:
EE_H_FLAGS = -D_EE -O2 -G0 -Wall
EE_H_INCS = -I$(PS2SDK)/ee/include -I$(PS2SDK)/common/include -I.

%.gch : %.h
<tab>ee-g++ $(EE_H_FLAGS) $(EE_H_INCS) -c $< -o $@

I've never actually done it before, thinking gcc-3.2.2 didn't have support for it, lol. I'm not sure if that's the proper way to do it, you might need to fiddle around with it a bit.

You should also link in -lstdc++ in EE_LIBS, since you're using Makefile.eeglobal.
Back to top
View user's profile Send private message
jgrimm



Joined: 29 Nov 2009
Posts: 27

PostPosted: Tue Dec 01, 2009 10:22 am    Post subject: Reply with quote

ok thx guys and i hav gcc 3.4.4 so that shouldnt be a problem
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group