Devkitpro Compilation Crisis! Please help!

Discussion in 'General Off-Topic Chat' started by Voxel, Aug 30, 2015.

  1. Voxel
    OP

    Voxel Clumsy Coder

    Member
    GBAtemp Patron
    Voxel is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    5,144
    5,775
    Jun 27, 2015
    United Kingdom
    England, UK
    I've been baffled by this for months, now...

    How do you set values in a makefile before you build the project? For example, you have to do a custom "make" command which states the values.

    Example: "make EXECHAX={2} FWVER={0x25}"

    I type the above statement into Devkitpro's output window, but nothing happens! Is there a hidden input window that I don't know about?

    It's a bit hard to explain, but I'm sure some people will understand what I'm saying.

    Thanks in advance! :D
     
  2. mattycfp

    mattycfp Advanced Member

    Newcomer
    61
    17
    Jul 8, 2015
    United States
    25.0000° N, 71.0000° W
    2off-topic4me

    Just go to the 3DS homebrew forums...
     
  3. Voxel
    OP

    Voxel Clumsy Coder

    Member
    GBAtemp Patron
    Voxel is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    5,144
    5,775
    Jun 27, 2015
    United Kingdom
    England, UK
    Not off topic. Just thought someone could help me out, that's all.

    Edit:
    It's not off-topic because this could apply to any type of console homebrew that requires 'make' values.
    Also, this is the off-topic forum, you silly billy! :lol:
     
  4. The Real Jdbye

    The Real Jdbye Always Remember 30/07/08

    Member
    GBAtemp Patron
    The Real Jdbye is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    11,396
    4,730
    Mar 17, 2010
    Norway
    Alola
    I believe you just have to set an environment variable, with the "set" command on Windows or "export" on Linux.
     
  5. tj_cool

    tj_cool Site dev

    Supervisor
    9,987
    -1
    Jan 7, 2009
    Belgium
    This planet
    What exactly do you mean by "devkitPro's output window"?
     
  6. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    17,616
    8,195
    Oct 27, 2002
    France
    Engine room, learning
    I'm using simple windows command line to run make.

    to use
    make variable=value
    you need to use the -D command in the CFLAGS of your makefile. (or CXXFLAGS for c++)
    -DVariable=value

    the -D flag adds preprocessor values before compiling the sources.

    Here some example:
    when I compile USBLoaderGX, I can specify if I want to enable "fullchannel" mode, and a different IOS.
    maybe you could check that makefile to see how it's working?

    example typing :
    make IOS=222
    or
    make BUILDMODE=channel IOS=250

    the makefile for USBLoaderGX contains this:
    Code:
    ifndef $(IOS)
    IOS = 249
    endif
    
    CFLAG -DBUILD_IOS=$(IOS)
    
    ifeq ($(BUILDMODE),channel)
    CFLAGS += -DFULLCHANNEL
    CXXFLAGS += -DFULLCHANNEL
    endif
    
    ifneq ($(IOS),249)
    	@rm -f $(BUILD)/CSettings.o
    endif
    It checks if the "make" command line contains any text you want, (variables are of this form $(variable_name) ) then creates or passes the value to the CFLAG to be a global variable available to the sourcecode.
    you can use it to enable debug mode for example.

    in the code above, it checks if there's no variable named IOS defined then it creates it to 249.
    then it defines the preprocessor variable named "BUILD_IOS" set as the value specified in the command line.
    BUILD_IOS is used as preprocessor variable, just like if you added this to your .c file : #define BUILD_IOS 249

    Same for the second part, it checks if BUILDMODE variable is present and is set to "channel". if it is, it adds it to CFLAGS (and C++ flag too)

    last, if the IOS is different than 249, then it deletes a file to let the compiler rebuild it with the new IOS's preprocessor value. This way, there's no need to type "make clean", it can just delete a single file and rebuild this only one before linking the elf/dol file again.


    I hope it helped you.
     
  7. Voxel
    OP

    Voxel Clumsy Coder

    Member
    GBAtemp Patron
    Voxel is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    5,144
    5,775
    Jun 27, 2015
    United Kingdom
    England, UK
    You're a legend! Cheers! :bow:

    — Posts automatically merged - Please don't double post! —

    Oh, wait! It didn't work! (I'm trying to compile the oot3dhax source, but it just slaps some stupid errors back into my face.)

    If anybody does have the full compiled version, then it'd be very much appreciated! :)
     
  8. tj_cool

    tj_cool Site dev

    Supervisor
    9,987
    -1
    Jan 7, 2009
    Belgium
    This planet
    You should probably post your errors so we can have a look.
    Or otherwise a link to the source so someone can compile it. I'm sure there is already a compiled version somewhere, though. Try looking in the 3DS homebrew section.