Jump to page: 1 2
Thread overview
Simple makefile problem - implicit rule
Jan 09, 2013
deed
Jan 09, 2013
Ali Çehreli
Jan 09, 2013
deed
Jan 09, 2013
deed
Jan 09, 2013
Matthew Caron
Jan 09, 2013
deed
Jan 09, 2013
Ali Çehreli
Jan 09, 2013
deed
Jan 09, 2013
Ali Çehreli
Jan 09, 2013
deed
Jan 09, 2013
deed
January 09, 2013
# makefile -----------

OBJS    = main.obj othermodule.obj
DC      = dmd
DCFLAGS = -c

all : $(OBJS)

%.obj : %.d
      $(DC) $< $(DCFLAGS)

# --------------------

Error on line 9: expecting target : dependencies

* main.d, othermodule.d and makefile are in the same folder.
* make is executed in this folder from the command line

Anyone cares to explain what's wrong/missing?
January 09, 2013
On 01/09/2013 09:51 AM, deed wrote:

> $(DC) $< $(DCFLAGS)

Your post has spaces at the beginning on that line. (Thunderbird removes those when I reply. Curse!)

Target rules must start with a tab character.

Ali
January 09, 2013
On Wednesday, 9 January 2013 at 17:57:28 UTC, Ali Çehreli wrote:
> On 01/09/2013 09:51 AM, deed wrote:
>
>> $(DC) $< $(DCFLAGS)
>
> Your post has spaces at the beginning on that line. (Thunderbird removes those when I reply. Curse!)
>
> Target rules must start with a tab character.
>
> Ali


Yeah, that's not the problem. Replacing %.obj and %.d with main.obj and main.d works.

January 09, 2013
> Yeah, that's not the problem. Replacing %.obj and %.d with main.obj and main.d works.

And $< with main.d
January 09, 2013
On 01/09/2013 09:51 AM, deed wrote:
> # makefile -----------
>
> OBJS = main.obj othermodule.obj
> DC = dmd
> DCFLAGS = -c
>
> all : $(OBJS)
>
> %.obj : %.d
> $(DC) $< $(DCFLAGS)
>
> # --------------------
>
> Error on line 9: expecting target : dependencies
>
> * main.d, othermodule.d and makefile are in the same folder.
> * make is executed in this folder from the command line
>
> Anyone cares to explain what's wrong/missing?

Assuming that this is for GNU make, ensuring that the rule starts with a tab characters, that file works with GNU Make 3.81.

Ali
January 09, 2013
> Assuming that this is for GNU make, ensuring that the rule starts with a tab characters, that file works with GNU Make 3.81.
>
> Ali

It is Digital Mars Make Version 5.06 and it's on Windows 7.
January 09, 2013
On 01/09/2013 01:13 PM, deed wrote:
>> Yeah, that's not the problem. Replacing %.obj and %.d with main.obj
>> and main.d works.
>
> And $< with main.d

 don't know what make you're using, but this works for me:

OBJS    = hello.obj hello_loop.obj
DC      = gdc
DCFLAGS =

all : $(OBJS)

%.obj : %.d
	$(DC) $< $(DCFLAGS) -o $@

Output:
gdc hello.d  -o hello.obj
gdc hello_loop.d  -o hello_loop.obj

and hello.obj and hello_loop.obj both exist

Note that there is a tab before $(DC).

make --version says:
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu

-- 
Matthew Caron, Software Build Engineer
Sixnet, a Red Lion business | www.sixnet.com
+1 (518) 877-5173 x138 office
January 09, 2013
On 01/09/2013 10:19 AM, deed wrote:
>> Assuming that this is for GNU make, ensuring that the rule starts with
>> a tab characters, that file works with GNU Make 3.81.
>>
>> Ali
>
> It is Digital Mars Make Version 5.06 and it's on Windows 7.

That's why you didn't mark the subject with [OT]. ;) It looks like the syntax is different:

.d.obj:
   $(DC) $(DFLAGS) -c $<

I got that by clicking "makefile example" here:

http://www.prowiki.org/wiki4d/wiki.cgi?DigitalMarsTools#DigitalMarsLinkerandUtilities

Ali
January 09, 2013
>  don't know what make you're using, [...]

I'am using the make.exe coming with the DMD 2.061 distro in D/dmd2/windows/bin/
Thought/hoped the GNU spec was applicable, but if it works with GNU make and not Digital Mars make, well..

make -man leads to http://digitalmars.com/ctg/make.html, which says:

Implicit Definition lines
.targ_ext.dep_ext : [; rule] [# ... ]

Does this give a clue?
January 09, 2013
> .d.obj:
>    $(DC) $(DFLAGS) -c $<

> Ali


Works like a charm! Case solved.
Thank you very much!
« First   ‹ Prev
1 2