Devkitpro Compilation Crisis! Please help!

  • Thread starter Deleted User
  • Start date
  • Views 1,400
  • Replies 7
D

Deleted User

Guest
OP
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
 
D

Deleted User

Guest
OP
2off-topic4me
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:
 

The Real Jdbye

*is birb*
Member
Joined
Mar 17, 2010
Messages
23,271
Trophies
4
Location
Space
XP
13,826
Country
Norway
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
I believe you just have to set an environment variable, with the "set" command on Windows or "export" on Linux.
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,649
Country
France
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.
 
D

Deleted User

Guest
OP
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.
You're a legend! Cheers! :bow:

--------------------- MERGED ---------------------------

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! :)
 

tj_cool

Site dev
Supervisor
Joined
Jan 7, 2009
Messages
10,064
Trophies
2
Location
This planet
XP
3,102
Country
Belgium
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.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: Also nice. Never really watched Fallout on Prime, but sounds like a good show. +1