OS X Installer

Anders F Björklund afb at algonet.se
Sat Aug 1 01:33:25 PDT 2009


Walter Bright wrote:

> I don't know what build tools you're using, but consider make:
> 
> ------ win32.mak ---------
> 
> DMD=\dmd\windows\bin\dmd
> 
> target : foo.obj
> 
> foo.obj : foo.d
>     $(DMD) -c foo
> --------------------------

And for GNU make, it uses the variables $(DC) and $(DMD)
where DC is the D compiler (like CC) and DMD the wrapper.

The annoying part is changing the DFLAGS for the compiler,
and/or translating any needed linker flags for the wrapper...

ifeq ("$(COMPILER)","DMD")
DC ?= dmd
DMD ?= dmd
DFLAGS = -O -g
version=-version
output=-of$@
endif
ifeq ("$(COMPILER)","LDC")
DC ?= ldc
DMD ?= ldmd
DFLAGS = -O
version=-d-version
output=-of=$@
endif
ifeq ("$(COMPILER)","GDC")
DC ?= gdc
DMD ?= gdmd
DFLAGS = -O2 -g
version=-fversion
output=-o $@
endif

%.o:%.d
	$(DC) $(DFLAGS) -c $(output) $<

--anders



More information about the Digitalmars-d mailing list