Configurable "out" folder location
Posted: 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:
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:
And in the make file use:
I have only tested on Mac. Not sure it would also work on Windows.
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
So, if we rename sega.s to sega.S we can write:
Code: Select all
.incbin ROM_HEAD, 0x10, 0x100
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 $@