Compiling with gdc vs. gdmd

Andrew Wiley wiley.andrew.j at gmail.com
Mon Apr 2 19:35:58 PDT 2012


On Mon, Apr 2, 2012 at 9:04 PM, Alex Rønne Petersen <xtzgzorex at gmail.com> wrote:
> On 03-04-2012 01:19, Joseph Rushton Wakeling wrote:
>>
>> On 03/04/12 00:48, Alex Rønne Petersen wrote:
>>>
>>> The Waf meta build system has good support for both GDC and LDC.
>>
>>
>> I'm reluctant to use Waf due to the issues described here ... :-(
>> http://lists.debian.org/debian-devel/2010/02/msg00714.html
>>
>
> Which ones in particular? Debian lacking a system-level Waf doesn't seem
> like a huge issue to me.
>

Unless you want someone else to build your software.
My biggest frustration with open source software and specifically with
meta build systems is that I don't want to learn a scripting language
or a scripting language's package manager just to build and use a
piece of software in a completely unrelated language, and if there's
no pre-packaged version of a build system, I'm not going to take the
time to figure out how to use whatever package manager language X uses
to install that build system and all dependencies. Most likely the
dependencies and build system will wind up in my home directory, which
is hackish at best, and it'll all sit there forever and clutter up my
home directory because I'll never touch that package manager again.
For a build that will be set up exactly once and modified extremely
rarely after the first month or so, how is this an improvement over
this Makefile that can already do perfect incremental builds:

TARGET  := someexecutable
SRCS    := $(shell find -type f -name '*.d')
OBJS    := ${SRCS:.d=.o}
DEPS    := ${SRCS:.d=.dep}
XDEPS   := $(wildcard ${DEPS})
DC      := gdc

DFLAGS = -Wall -Werror -g -O2
LDFLAGS =
LIBS    = -lpthread

.PHONY: all clean distclean
all:: ${TARGET}

ifneq (${XDEPS},)
include ${XDEPS}
endif

${TARGET}: ${OBJS}
    ${DC} ${LDFLAGS} ${DFLAGS} -o $@ $^ ${LIBS}

${OBJS}: %.o: %.d %.dep
    ${DC} ${DFLAGS} -o $@ -c $<

${DEPS}: %.dep: %.d
    ${DC} ${DFLAGS} -fsyntax-only -fmake-mdeps=$@ $<
    sed -i 's:$(notdir ${<:.d=.o}):${<:.d=.o}:g' $@

clean::
    -rm -f ${OBJS} ${DEPS} ${TARGET}

distclean:: clean


More information about the D.gnu mailing list