Configurable "out" folder location

SGDK only sub forum

Moderator: Stef

Post Reply
Joe Musashi
Interested
Posts: 17
Joined: Sat Oct 13, 2018 10:08 pm

Configurable "out" folder location

Post by Joe Musashi » Sat May 11, 2019 5:47 pm

Just in case anyone is interested in this...

I recently wanted the change the name of the "out" directory for my current project. When trying to introduce a variable "$(OUT)" for this in the makefile, I ran into the problem that the output location is hardcoded in boot/sega.s:

Code: Select all

	.incbin "out/rom_head.bin", 0x10, 0x100
After some googeling it turned out that the GCC assembler can run the pre-processor on assembly files if their extension is a capital ".S".

So, if we rename sega.s to sega.S we can write:

Code: Select all

        .incbin ROM_HEAD, 0x10, 0x100
And in the make file use:

Code: Select all

OUT=...

$(OUT)/sega.o: $(OUT)/rom_head.bin $(SRC)/boot/sega.S 
	$(CC) $(DEFAULT_FLAGS) -DROM_HEAD="\"$<\"" -c $(SRC)/boot/sega.S -o $@
I have only tested on Mac. Not sure it would also work on Windows.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Configurable "out" folder location

Post by Stef » Mon May 13, 2019 8:35 am

Interesting finding :) i think i got issue as well with the romhead inclusion, it's why i had to hardcode like this...
I need to verify it also work in windows / linux system as well as i know OSX as some weird behavior concerning case sensitiveness.

Post Reply