Simple I know, but could use some help compiling with make
Nick Sabalausky
a at a.a
Thu Sep 29 14:15:15 PDT 2011
"Nick Sabalausky" <a at a.a> wrote in message
news:j62msu$205t$1 at digitalmars.com...
> "Roderick Gibson" <kniteli at gmail.com> wrote in message
> news:j62d4i$1d8l$1 at digitalmars.com...
>> It's my first foray into the arcana of makefiles and command line
>> compiling.
>>
>> My makefile looks like this:
>>
>> IMPORT = -IC:\Dlang\dmd2\src\ext\Derelict2\import
>> LIB_PATHS = -LC:\Dlang\dmd2\src\ext\Derelict2\lib
>> LIB_INCLUDES = DerelictSDL.lib DerelictGL.lib DerelictUtil.lib
>>
>> all:
>> dmd src/main.d src/display.d src/renderdata.d src/vector2d.d\
>> $(IMPORT) $(LIB_PATHS) $(LIB_INCLUDES)
>>
>> I think I just don't know how to give the compiler what it wants. I can
>> build it manually by simply including the full paths to each of those
>> libraries, but I'd rather avoid having to do that unless necessary. Is
>> there something I'm just missing?
>
> build.bat:
> @echo off
> rdmd --build-only -ofmyApp -IC:\Dlang\dmd2\src\ext\Derelict2\import -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\
> DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib src/main.d
>
> Note:
>
> 1. After the "@echo off", that's supposed to be one line.
>
> 2. "rdmd" instead of "dmd"
>
> 3. Only one ".d" file is given: The one with main()
>
> 4. The ".d" file is the *last* param.
>
Or to make it a little cleaner:
@echo off
IMPORT = -IC:\Dlang\dmd2\src\ext\Derelict2\import
LIB_PATHS = -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\
LIB_INCLUDES = DerelictSDL.lib DerelictGL.lib DerelictUtil.lib
DerelictGLU.lib
EXE_NAME = myApp
rdmd --build-only -of%EXE_NAME% %IMPORT% %LIB_PATHS% %LIB_INCLUDES%
src/main.d
Of course, you can use rdmd with make too, but I've never really liked
dealing with make.
More information about the Digitalmars-d-learn
mailing list