On 9/29/2011 2:15 PM, Nick Sabalausky wrote:
"Nick Sabalausky"<a@a.a>  wrote in message
news:j62msu$205t$1...@digitalmars.com...
"Roderick Gibson"<knit...@gmail.com>  wrote in message
news:j62d4i$1d8l$1...@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.



Very cool, thanks for going to all the trouble. It only takes the one souce file, does rdmd build out other files automatically?

Reply via email to