Compiling with gdc vs. gdmd

Alex Rønne Petersen xtzgzorex at gmail.com
Mon Apr 2 23:37:34 PDT 2012


On 03-04-2012 04:35, Andrew Wiley wrote:
> 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.

Include the Waf binary with your software. It's designed to be small so 
that you can do this.

> 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

I understand your frustration about having to learn another language. 
Learning a language is always an expensive task. But people don't 
necessarily know Make syntax, just as they don't necessarily know 
Python, or whatever (and I might add that Make can get very frustrating 
- the requirement to use hard tabs is extremely annoying and unintuitive).

A problem with systems like Make is that it is hard to keep Makefiles 
portable. It doesn't take much to accidentally introduce some sort of 
platform/shell/compiler dependency. Python, as a programming language, 
at least helps abstract most of these things away (for instance, shell 
syntax).

Anyway, as for what 'language' to use, it all comes down to your 
personal situation. If you know Python, using something like Waf is 
completely inexpensive, just as using Make is inexpensive if you know 
the Make syntax.

-- 
- Alex


More information about the D.gnu mailing list