NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: ReturnInfinity on November 26, 2024, 01:10:16 AM
-
Hello everyone,
I'm starting to make use of the Conditional Assembly to check for environmental variables at build time. Currently I have some boot code that contains functions for BIOS and UEFI systems and am building two separate binaries with the same source:
export BIOS=1
nasm pure64.asm -o ../bin/pure64-bios.sys -l ../bin/pure64-bios-debug.txt
unset BIOS
export UEFI=1
nasm pure64.asm -o ../bin/pure64-uefi.sys -l ../bin/pure64-uefi-debug.txt
unset UEFI
This works but is it the expected method for using environmental variables? Not sure if there is a cleaner way to accomplish this.
Thanks,
-Ian
-
Try this:
$ nasm -DBIOS=1 pure64.asm -o ../bin/pure64-bios.sys -l ../bin/pure64-bios-debug.txt
$ nasm -DUEFI=1 pure64.asm -o ../bin/pure64-uefi.sys -l ../bin/pure64-uefi-debug.txt
-
That works! I just had to change all instances of %ifenv to %ifdef in my code.
Thank you!