No rule to make target

Hi there.

I am trying to make my own makefile and I start easy but I don’t get it to work.

What is wrong with this code?

#**************************

CC = arm-elf-gcc

all: main.o

.PHONY: all

main.o: .src\main.c

$(CC) .src\main.c

#**************************

The error:

make -k all

make: *** No rule to make target .src\main.c', needed by main.o’.

make: Target `all’ not remade because of errors.

I am using eclipse as a platform.

Raymond

I think it complains because it cannot find src\main.c, therefore it looks for a rule to create it, but it cannot find such a rule.

Most likely is that make is confused by the backslash, try src/main.c instead of src\main.c

make -k all

make: *** No rule to make target .src/main.c', needed by main.o’.

make: Target `all’ not remade because of errors.

Raymond

Are you sure that the make can find your compiler? Check to make sure that the directory that arm-elf-gcc is in is in your environmnent varables somewhere.

If I open a commandprompt and goes to that directory and type:

arm-elf-gcc src\main.c

A file a.out is created in my directory.

I guess that since that works it is in my environment variable.

Raymond

Hi

main.o: .src\main.c

$(CC) .src\main.c

Should probably be

main.o: src\main.c

$(CC) src\main.c

or

main.o: .\src\main.c

$(CC) .\src\main.c

Regards,

Magnus

D’oh!

Obviously the dot. What was the intention of that anyway?

I am a new user of the opensource and ARM, so mostly I try to copy and modify things that works.

One eye on the project and one on the manuals. :slight_smile:

The reason the dot was copied (the intention) was that “yagarto” had it in his makefile in a small project called STR7Test.

STR7Test->makefile

List C source files here

SRC = ./src/main.c

######################

I don’t know why it works with that project and not with mine yet, but I will find out.

Thanks for your help

Raymond

./ means the current directory, while .src\ means a file with the name ".src", i.e. you missed the slash after the dot.

Regards,

Dominic