Response files

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Mar 23 11:02:30 PDT 2009


Leandro Lucarella wrote:
> Walter Bright, el 21 de marzo a las 20:07 me escribiste:
>> Andrei Alexandrescu wrote:
>>>> .o on Linux, .obj on Windows.
>>> OBJSUFFIX_win32 = .obj
>>> OBJSUFFIX_linux = .o
>>> ...
>>> OS = linux
>>> ...
>>> ... file$(OBJSUFFIX_$(OS)) ...
>> I hadn't thought of using macros to generate macros. It's a good idea.
> 
> I think it's easier and cleaner to use conditionals:
> 
> OS = linux
> 
> ifeq ($(OS),linux)
> OBJSUFFIX = .o
> else ifeq ($(OS),win32)
> OBJSUFFIX = .obj
> endif
> 
> ... file$(OBJSUFFIX) ...

Yah, yet it turns out it's easier and cleaner the other way around when 
you generate entries with define and eval:

################################################################################
define GENERATE
# $1 is OS, $2 is the build
...
endef

$(eval $(foreach B,debug release, $(foreach S,posix win32, $(call
	GENERATE,$S,$B))))

This way in one shot you generate debug and release versions for win32 
and posix. (Note that I compile for win32 on linux thwough wine).


Andrei



More information about the Digitalmars-d mailing list