Help compiling a .dol using makefile

Discussion in 'Wii - Hacking' started by SpaceJump, Oct 28, 2008.

  1. SpaceJump
    OP

    SpaceJump Where's my new 2D-Metroid?

    Member
    3,673
    214
    Aug 18, 2005
    Gambia, The
    Zebes
    I want to add a Wii reboot function to the MPlayerWii app so I looked up how to code it (I'm a medium Java developer...). So I wrote a little test app using devkitpro and the test app works, so that I can choose if I want to go to the HBC or to the Wii menu. I compiled the .dol file with the editor of devkitpro using the "make" option. No problem here.
    Now I think I added the necessary code to the MPlayerWii source, but this app has to be compiled using a Makefile. I downloaded make.exe but I cannot get it to build the .dol file.

    Can anyone tell me how to do it or link me to a good point of information?
     
  2. Screemer

    Screemer GBAtemp Maniac

    Member
    1,248
    1
    Sep 21, 2008
    Gambia, The
    makefile should be found here: http://code.google.com/p/mplayerwii/source/browse/#svn/trunk

    edit: and maybe you should consider bringing your patch into the actual svn.

    edit2: just came to my mind. you should although use the latest version of devkitpro (has to be compiled by your self) to add sdhc support.
     
  3. SpaceJump
    OP

    SpaceJump Where's my new 2D-Metroid?

    Member
    3,673
    214
    Aug 18, 2005
    Gambia, The
    Zebes
    You misunderstood me. I already checked the project out with TortoiseSVN (spelling?) using the URL "http://mplayerwii.googlecode.com/svn/trunk" for the checkout. So I have the Makefile. I now want to know how to compile the build using this Makefile to test if my code works.
     
  4. Jacobeian

    Jacobeian GBAtemp Advanced Maniac

    Member
    1,882
    122
    May 15, 2008
    Cuba
    considering DevkitPPC is well installed (ie environment variable properly set),:

    1/open a command window
    2/go into the directory where the Makefile is
    3/type make
    4/wait until compilation is done... tadaaa

    if you got errors message, then copy them here, just telling "I downloaded make.exe but I cannot get it to build the .dol file" doesn't help
    btw, you don't need to download make.exe (from where ?), it's already in devkitppc
     
  5. SpaceJump
    OP

    SpaceJump Where's my new 2D-Metroid?

    Member
    3,673
    214
    Aug 18, 2005
    Gambia, The
    Zebes
    Ok, when typing make in the project directory I get the error message, that the file "wii_rules" cannot be found. What environment variable do I have to set?
     
  6. Jacobeian

    Jacobeian GBAtemp Advanced Maniac

    Member
    1,882
    122
    May 15, 2008
    Cuba
    Use devkitpro AutoInstaller and install devkitPPC, it will set everything for you
     
  7. SpaceJump
    OP

    SpaceJump Where's my new 2D-Metroid?

    Member
    3,673
    214
    Aug 18, 2005
    Gambia, The
    Zebes
    I already used the devkitpro auto updater (I asume you mean this) and I think it installed correctly (unsure)...
     
  8. hartleyshc

    hartleyshc GBAtemp Regular

    Member
    184
    0
    Oct 2, 2008
    United States
    Gainesville, FL
    1) open up programmers notepad *included in devkitpro*
    2) open the makefile with programmers notepad.
    3) go to tools>make (or press alt+1)
    4) wait.
    5) enjoy.
     
  9. djdynamite123

    djdynamite123 Master Of Hardcore!

    Banned
    3,791
    1
    Sep 21, 2008
    Redcar, England UK
    I wanted to do that with DMP but he hasn't included the full source and it would take ages getting all the binaries [​IMG] i contacted him and no reply.

    I wouldn't mind that if you mange to edit the return to loader with restart wii [​IMG] obviously you'll know the command from developers tips on wiibrew [​IMG]
     
  10. SpaceJump
    OP

    SpaceJump Where's my new 2D-Metroid?

    Member
    3,673
    214
    Aug 18, 2005
    Gambia, The
    Zebes
    EDIT: I checked the directory c:/devkitPro/devkitPPC and there's is a file called wii_rules in it.

    Any ideas?
     
  11. fennec

    fennec Advanced Member

    Newcomer
    95
    0
    Oct 14, 2008
    France
    edit: missread your problem.
     
  12. hartleyshc

    hartleyshc GBAtemp Regular

    Member
    184
    0
    Oct 2, 2008
    United States
    Gainesville, FL
    sounds like you've changed the makefile.

    mind posting yours?
     
  13. SpaceJump
    OP

    SpaceJump Where's my new 2D-Metroid?

    Member
    3,673
    214
    Aug 18, 2005
    Gambia, The
    Zebes
    No, I didn't change the Makefile that came with the checkout. Here is its contents:

    CODE#---------------------------------------------------------------------------------
    # Clear the implicit built in rules
    #---------------------------------------------------------------------------------
    .SUFFIXES:
    #---------------------------------------------------------------------------------
    ifeq ($(strip $(DEVKITPPC)),)
    $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
    endif

    include $(DEVKITPPC)/wii_rules

    #---------------------------------------------------------------------------------
    # TARGET is the name of the output
    # BUILD is the directory where object files & intermediate files will be placed
    # SOURCES is a list of directories containing source code
    # INCLUDES is a list of directories containing extra header files
    #---------------------------------------------------------------------------------
    TARGETÂÂÂÂÂÂÂÂ:=ÂÂÂÂ$(notdir $(CURDIR))
    BUILDÂÂÂÂÂÂÂÂ:=ÂÂÂÂbuild
    SOURCESÂÂÂÂÂÂÂÂ:=ÂÂÂÂsource
    DATAÂÂÂÂÂÂÂÂ:=ÂÂÂÂdataÂÂ
    INCLUDESÂÂÂÂ:=

    MPLAYER := $(CURDIR)/../mplayer

    #---------------------------------------------------------------------------------
    # options for code generation
    #---------------------------------------------------------------------------------

    CFLAGSÂÂÂÂ= -g -O2 -Wall $(MACHDEP) $(INCLUDE)
    CXXFLAGSÂÂÂÂ=ÂÂÂÂ$(CFLAGS)

    LDFLAGSÂÂÂÂ=ÂÂÂÂ-g $(MACHDEP) -Wl,-Map,$(notdir $@).map -L$(MPLAYER) \
    ÂÂÂÂÂÂÂÂÂÂÂÂ$(wildcard $(MPLAYER)/*.o)
    ÂÂÂÂÂÂÂÂÂÂÂÂ
    #ÂÂÂÂÂÂÂÂÂÂÂÂ$(wildcard $(MPLAYER)/*.a)
    ÂÂÂÂÂÂÂÂÂÂÂÂ

    #---------------------------------------------------------------------------------
    # any extra libraries we wish to link with the project
    #---------------------------------------------------------------------------------
    LIBSÂÂÂÂ:=ÂÂÂÂ-ltinysmb -lwiiuse -lbte -lfat -logc -lm

    LIBS := -lvo -lao2 -linput -lmpcodecs -laf -lmpdemux -lstream \
    ÂÂÂÂÂÂÂÂ-lswscale -losd -lavformat -lavcodec -lavutil -lpostproc -lmp3 \
    ÂÂÂÂÂÂÂÂ-la52 -lmpeg2 -lfaad2 -lvorbisidec -losdep $(LIBS)

    #---------------------------------------------------------------------------------
    # list of directories containing libraries, this must be the top level containing
    # include and lib
    #---------------------------------------------------------------------------------
    LIBDIRSÂÂÂÂ:=

    #---------------------------------------------------------------------------------
    # no real need to edit anything past this point unless you need to add additional
    # rules for different file extensions
    #---------------------------------------------------------------------------------
    ifneq ($(BUILD),$(notdir $(CURDIR)))
    #---------------------------------------------------------------------------------

    export OUTPUTÂÂÂÂ:=ÂÂÂÂ$(CURDIR)/$(TARGET)

    export VPATHÂÂÂÂ:=ÂÂÂÂ$(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ$(foreach dir,$(DATA),$(CURDIR)/$(dir))

    export DEPSDIRÂÂÂÂ:=ÂÂÂÂ$(CURDIR)/$(BUILD)

    #---------------------------------------------------------------------------------
    # automatically build a list of object files for our project
    #---------------------------------------------------------------------------------
    CFILESÂÂÂÂÂÂÂÂ:=ÂÂÂÂ$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
    CPPFILESÂÂÂÂ:=ÂÂÂÂ$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
    sFILESÂÂÂÂÂÂÂÂ:=ÂÂÂÂ$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
    SFILESÂÂÂÂÂÂÂÂ:=ÂÂÂÂ$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
    BINFILESÂÂÂÂ:=ÂÂÂÂ$(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

    #---------------------------------------------------------------------------------
    # use CXX for linking C++ projects, CC for standard C
    #---------------------------------------------------------------------------------
    ifeq ($(strip $(CPPFILES)),)
    ÂÂÂÂexport LDÂÂÂÂ:=ÂÂÂÂ$(CC)
    else
    ÂÂÂÂexport LDÂÂÂÂ:=ÂÂÂÂ$(CXX)
    endif

    export OFILESÂÂÂÂ:=ÂÂÂÂ$(addsuffix .o,$(BINFILES)) \
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ$(sFILES:.s=.o) $(SFILES:.S=.o)

    #---------------------------------------------------------------------------------
    # build a list of include paths
    #---------------------------------------------------------------------------------
    export INCLUDEÂÂÂÂ:=ÂÂÂÂ$(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ-I$(CURDIR)/$(BUILD) \
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ-I$(LIBOGC_INC)

    #---------------------------------------------------------------------------------
    # build a list of library paths
    #---------------------------------------------------------------------------------
    export LIBPATHSÂÂÂÂ:=ÂÂÂÂ$(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ-L$(LIBOGC_LIB)

    export OUTPUTÂÂÂÂ:=ÂÂÂÂ$(CURDIR)/$(TARGET)
    .PHONY: $(BUILD) clean

    #---------------------------------------------------------------------------------
    $(BUILD):
    ÂÂÂÂ@[ -d $@ ] || mkdir -p $@
    ÂÂÂÂ@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

    #---------------------------------------------------------------------------------
    clean:
    ÂÂÂÂ@echo clean ...
    ÂÂÂÂ@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol

    #---------------------------------------------------------------------------------
    run:
    ÂÂÂÂwiiload $(TARGET).dol


    #---------------------------------------------------------------------------------
    else

    DEPENDSÂÂÂÂ:=ÂÂÂÂ$(OFILES:.o=.d)

    #---------------------------------------------------------------------------------
    # main targets
    #---------------------------------------------------------------------------------
    $(OUTPUT).dol: $(OUTPUT).elf
    $(OUTPUT).elf: $(OFILES)

    #---------------------------------------------------------------------------------
    # This rule links in binary data with the .jpg extension
    #---------------------------------------------------------------------------------
    %.jpg.oÂÂÂÂ:ÂÂÂÂ%.jpg
    #---------------------------------------------------------------------------------
    ÂÂÂÂ@echo $(notdir $
     
  14. hartleyshc

    hartleyshc GBAtemp Regular

    Member
    184
    0
    Oct 2, 2008
    United States
    Gainesville, FL
    hmm if you haven't change the makefile, im at a bit of a loss.
    it seems its getting the wrong info on the drive location of wii_rules.
    even though it says /c/devkitPro, the output should still be c:\ even if you have to type it c:/

    since ive spent a good part of the evening trying to do what your doing *set mplayer to reset instead of boot to launcher.*
    mind posting your source?
     
  15. SpaceJump
    OP

    SpaceJump Where's my new 2D-Metroid?

    Member
    3,673
    214
    Aug 18, 2005
    Gambia, The
    Zebes
    After changing the environment variables (it seems the installer set them wrong without a ":"), I'm now getting this error when compiling with Makefile:

    Code:
    > "make" 
    make[1]: /Makefile: No such file or directory
    make[1]: *** No rule to make target `/Makefile'.ÂÂStop.
    make: *** [build] Error 2
    
    > Process Exit Code: 2