Under masm I can define a value on the command line and pass it to the assembler.

for example


ml /c /Cp /DDEBUG myasm.asm


Thus when I have a conditional directive like this:



ifdef DEBUG
; do some debug things
else
; do some release things
endif


Could it be possible to add the ability to define equates on the command line of fasm? something like:



fasm source.asm target.exe -DDEBUG=0

for release

and



fasm source.asm target.exe -DDEBUG=1


for debug

so we can have directives like



if DEBUG > 0
; do debug stuff
else
; do release stuff
endif


without need to mantain 2 separate sources or edit the source every time one needs to change between debug and release versions
Posted on 2002-09-16 14:31:38 by dxantos
I wont like a compiler switch because on of the main advantages of FASM is the avability to set such options in the source file itself :)

But IIRC there is a conditional assembly function, isnt it? (you read the docs? )
Posted on 2002-09-16 14:57:51 by bazik
I agree with dxantos that such a feature would be useful. Bazik, it wouldn't be compulsory to use it, if you don't find it useful. ;)
Posted on 2002-09-16 16:49:42 by Maverick
bazik yes I have read the docs, and the conditional assembly exist like this:



DEBUG=0

if DEBUG > 0
; do debug stuff
else
; do release stuff
endif


Problem is that you must edit the file every time you change from one mode to another. But if one can define it as a command line option if will improve FASM usability for make files. (since you will not need to edit the sourcecode for conditional compilation).
Posted on 2002-09-16 17:24:55 by dxantos
Is it possible to use Env Vars? %DEBUG%
Posted on 2002-09-16 23:17:36 by eet_1024
or include a file in your source which is generated by a batch file that takes the parameters your want and calls the real fasm after...



@Echo DEBUG=0 > DbgConf.inc
@Echo if DEBUG == 0 >> DbgConf.inc


It may not be the most elegant solution and it is a bit tricky, but it actually works...

Note: the use of '>' or '<' or '>>' and '<<' characters in the line to be outputed may be problematic here (maybe there is a workaround using some features of batch files I don't remember...)
Posted on 2002-09-17 00:57:29 by JCP