Devkitpro Compilation Crisis! Please help!

  • Thread starter Deleted User
  • Start date
  • Views 1,418
  • 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,335
Trophies
4
Location
Space
XP
13,911
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
46
Location
Engine room, learning
XP
15,662
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,106
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
  • Psionic Roshambo @ Psionic Roshambo:
    Also a food allergy study would be a good idea
  • K3Nv2 @ K3Nv2:
    Turns out you can't sprinkle methamphetamine on McDonald's French fries
    +1
  • ZeroT21 @ ZeroT21:
    they wouldn't be called french fries at that point
    +1
  • ZeroT21 @ ZeroT21:
    Probably just meth fries
    +1
  • K3Nv2 @ K3Nv2:
    White fries hold up
    +1
  • The Real Jdbye @ The Real Jdbye:
    @K3Nv2 sure you can
  • BakerMan @ BakerMan:
    why tf do people hate android users? is it the video quality? just because "AnDrOiD = pOoR" bc they don't cost an arm and a leg like iphones do?
    +1
  • BakerMan @ BakerMan:
    i won't be turned off by an iphone, but don't pick on me for having an android, that's just how this shit should work
  • ZeroT21 @ ZeroT21:
    Should say more what these kind of android users say bout nokia 3310 users
  • BigOnYa @ BigOnYa:
    I've owned both iPhone and Androids over the years. Both are just as good, other than Apples higher price. I'm currently on Android, Samsung S21 I think, and very happy with it.
  • K3Nv2 @ K3Nv2:
    Got my 60 minute steps in whew
    +2
  • BigOnYa @ BigOnYa:
    I get mine in everyday, going back n forth to the fridge for a beer.
    +1
  • K3Nv2 @ K3Nv2:
    6,000 steps in so far legs almost broke getting off
    +1
  • K3Nv2 @ K3Nv2:
    Your mind gets in a werid pattern of just finishing then when you're done you're like I need a soda
  • BigOnYa @ BigOnYa:
    You get a "walkers" high?
  • K3Nv2 @ K3Nv2:
    Not really I just use to love building up a sweat
  • BigOnYa @ BigOnYa:
    Funny, that's what uremum always says
  • K3Nv2 @ K3Nv2:
    Yeah and people that take viagra think they have a big dick
    +1
  • K3Nv2 @ K3Nv2:
    You cant fix one insult edit for another edit you pog
  • BigOnYa @ BigOnYa:
    Nuh I'm on my tablet n it always auto corrects me
  • K3Nv2 @ K3Nv2:
    Heorin and uremum do have close quarters
  • Sonic Angel Knight @ Sonic Angel Knight:
    BIG CHICKEN :P
    K3Nv2 @ K3Nv2: https://youtu.be/q855tNpvDoQ?si=Tl57KMjiVjyBherB