# Part of the A-A-P recipe executive: Module for the D Programming Language. # Copyright (c) 2002 - 2005 Lars Ivar Igesund and stichting NLnet Labs # Permission to copy and use this file is specified in the file COPYING. # If this file is missing you can find it here: http://www.a-a-p.org/COPYING # # Last Change: 2005 Jan 22 # See also dmd.py in the tools directory for compiler specific info. # (1) Filetype recognition # This is included in Filetype.py # (2) Default values DCOMP = dmd SUPPORTED_TOOLS = "dmd" # (3) Object file suffixes # dll and lib objects are equal to normal objects. _top.D_LIBOBJSUF = $OBJSUF _top.D_DLLOBJSUF = $OBJSUF # (4) Search for tools # Actions are installed for every toolchain that exists. # The first one found sets $D_COMPILE_ACTION and friends. :toolsearch dmd # If not downloaded, build it from local copy. :progsearch _top.DDEPCHECK ddepcheck _top.DDEPCHECK ?= @if not _top.DDEPCHECK: bindir = "`Global.aap_bindir`" toolsdir = "`Global.aap_toolsdir`" :mkdir {force} $bindir :print ddepcheck not found, building from: $toolsdir/ddepcheck.d :progsearch dc dmd @if not os.access(Global.aap_bindir, os.W_OK): :print ----------- :print The "ddepcheck" program cannot be found :print Aap can build and install it for you, but you don't have write :print access to the Aap binaries directory. @r = " " @while not r == '1' and not r == '2': :print 1. Become root/administrator and install in the Aap binaries directory. :print 2. Specify another location to install ddepcheck. :print q. Quit @r = raw_input("Select an option: ") @if r == '1': :asroot $dc -O -release -of$bindir`os.sep`ddepcheck$EXESUF $toolsdir`os.sep`ddepcheck.d @elif r == '2': :print The path entered must be writable from your user. @bindir = raw_input("Enter install path for ddepcheck ") :sys $dc -O -release -of$bindir`os.sep`ddepcheck$EXESUF $toolsdir`os.sep`ddepcheck.d :print NOTE: It might be necessary to add $bindir to your PATH before the next execution of Aap. _top.DDEPCHECK = $bindir`os.sep`ddepcheck$EXESUF @elif r == 'q': :quit @else: :sys $dc -O -release -of$bindir`os.sep`ddepcheck$EXESUF $toolsdir`os.sep`ddepcheck.d :del {q} {f} ddepcheck$OBJSUF ddepcheck.map @if not _top.DDEPCHECK: :progsearch _top.DDEPCHECK ddepcheck @if not _top.DDEPCHECK: :print Building ddepcheck failed or the program cannot be found. # (5) Actions, Rules and Routes # :do depend # :action depend {recursive} {buildcheck = $DCOMP $?DFLAGS $?DVERSION $?DDEBUG $?DIMPORT } d :sys $_top.DDEPCHECK -m $?DIMPORT $?DVERSION $?DDEBUG $source > $target # :do compile :python define_action("compile", 1, """ @if not _no.get("target"): target = `src2obj(fname)` @if _no.targettype == "object": :attr {buildaction = d_build} $target @elif _no.targettype == "libobject": :attr {buildlibaction = d_buildlib} $target @elif _no.targettype == "dllobject": :attr {builddllaction = d_builddll} $target @if DEFER_ACTION_NAME: :do $DEFER_ACTION_NAME {target = $target} $source @else: :print "No default compile action for D. Install one of the" :print "supported tool chains(" + $SUPPORTED_TOOLS + ")" """, outtypes = ["object", "libobject", "dllobject"], intypes = ["d"], defer_var_names = ["D_COMPILE_ACTION"]) :rule {global}{default} %$OBJSUF : {buildcheck = $DCOMP $?DFLAGS $?DVERSION $?DDEBUG $?DIMPORT } %.d :do compile {target = $target} $source # :do build for object files resulting from "d" source files. :python define_action("d_build", 0, """ @if DEFER_ACTION_NAME: :do $DEFER_ACTION_NAME {target = $target} $source @else: :print "No default build action for D. Install one of the" :print "supported tool chains (" + $SUPPORTED_TOOLS + ")" """, outtypes = ["default"], intypes = ["object"], defer_var_names = ["D_BUILD_ACTION"]) define_action("d_builddll", 0, """ @if DEFER_ACTION_NAME: :do $DEFER_ACTION_NAME {target = $target} $source @else: :print "No default builddll action for D. Install one of the" :print "supported tool chains (" + $SUPPORTED_TOOLS + ")" """, outtypes = ["default"], intypes = ["object"], defer_var_names = ["D_BUILDDLL_ACTION"]) define_action("d_buildlib", 0, """ @if DEFER_ACTION_NAME: :do $DEFER_ACTION_NAME {target = $target} $source @else: :print "No default buildlib action for D. Install one of the" :print "supported tool chains (" + $SUPPORTED_TOOLS + ")" """, outtypes = ["default"], intypes = ["object"], defer_var_names = ["D_BUILDLIB_ACTION"]) # :do buildonestep to build targets directly from "d" source :python define_action("buildonestep", 1, """ @if DEFER_ACTION_NAME: :do $DEFER_ACTION_NAME {target = $target} $source @else: :print "No default buildonestep action for D. Install on of the" :print "supported tool chains (" + $SUPPORTED_TOOLS +")" """, outtypes = ["default"], intypes = ["d"], defer_var_names = ["D_BUILDONESTEP_ACTION"]) define_action("buildlibonestep", 1, """ @if DEFER_ACTION_NAME: :do $DEFER_ACTION_NAME {target = $target} $source @else: :print "No default buildlibonestep action for D. Install on of the" :print "supported tool chains (" + $SUPPORTED_TOOLS +")" """, outtypes = ["default"], intypes = ["d"], defer_var_names = ["D_BUILDLIBONESTEP_ACTION"]) define_action("builddllonestep", 1, """ @if DEFER_ACTION_NAME: :do $DEFER_ACTION_NAME {target = $target} $source @else: :print "No default builddllonestep action for D. Install on of the" :print "supported tool chains (" + $SUPPORTED_TOOLS +")" """, outtypes = ["default"], intypes = ["d"], defer_var_names = ["D_BUILDDLLONESTEP_ACTION"]) # vim: set sw=4 sts=4 tw=79 :