Meaty Skeleton - No rule to make target

Programming, for all ages and all languages.
Post Reply
bilsch01
Member
Member
Posts: 42
Joined: Sat Dec 19, 2015 10:48 am

Meaty Skeleton - No rule to make target

Post by bilsch01 »

I'm adding a GAS assembler file named kb1.S in Meaty Skeleton that gets keyboard input. There is already a GAS file in the build named boot.S and the only rule for that one is:

Code: Select all

%.o: %.S
	$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
When I run Make I get the message: No rule to make target (ARCHDIR)/kb1.o.
Why isn't the existing rule sufficient for the added GAS file kb1.S ? What can I do?

A variable in an included makefile (make.config) has the object files from both GAS files:

Code: Select all

KERNEL_ARCH_OBJS:=\
$(ARCHDIR)/boot.o \
$(ARCHDIR)/tty.o \
(ARCHDIR)/kb1.o \
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Meaty Skeleton - No rule to make target

Post by Combuster »

Have you looked carefully? What's the letter-by-letter difference between the boot.o line and the kb1.o line in your make.config?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
bilsch01
Member
Member
Posts: 42
Joined: Sat Dec 19, 2015 10:48 am

Re: Meaty Skeleton - No rule to make target

Post by bilsch01 »

Combuster wrote:Have you looked carefully? What's the letter-by-letter difference between the boot.o line and the kb1.o line in your make.config?
Okay. Got it. Thanks. Bill S.
glauxosdever
Member
Member
Posts: 501
Joined: Wed Jun 17, 2015 9:40 am
Libera.chat IRC: glauxosdever
Location: Athens, Greece

Re: Meaty Skeleton - No rule to make target

Post by glauxosdever »

Hi,

bilsch01 wrote:There is already a GAS file in the build named boot.S and the only rule for that one is:

Code: Select all

%.o: %.S
	$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
This seems suspiciously wrong. Are you really trying to assemble an assembly file with GCC?

Hint: $(CC) stands for C Compiler, what you want is $(AS).


Regards,
glauxosdever
mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

Re: Meaty Skeleton - No rule to make target

Post by mikegonta »

glauxosdever wrote:
bilsch01 wrote:There is already a GAS file in the build named boot.S and the only rule for that one is:

Code: Select all

%.o: %.S
	$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
This seems suspiciously wrong. Are you really trying to assemble an assembly file with GCC?
Hint: $(CC) stands for C Compiler, what you want is $(AS).
GCC will be more then happy to assemble the .S file to an object file (.o).
In fact it will first pass it to cpp the C preprocessor and then pass it along to AS.

PS. Bill has been keeping us entertained here and here.
Mike Gonta
look and see - many look but few see

https://mikegonta.com
glauxosdever
Member
Member
Posts: 501
Joined: Wed Jun 17, 2015 9:40 am
Libera.chat IRC: glauxosdever
Location: Athens, Greece

Re: Meaty Skeleton - No rule to make target

Post by glauxosdever »

Hi,

mikegonta wrote:GCC will be more then happy to assemble the .S file to an object file (.o).
In fact it will first pass it to cpp the C preprocessor and then pass it along to AS.
I'm not sure it is a portable solution. You can't assume every C compiler will actually assemble assembly code.
mikegonta wrote:PS. Bill has been keeping us entertained here and here.
I don't see the point of this statement.


Regards,
glauxosdever
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Meaty Skeleton - No rule to make target

Post by Solar »

glauxosdever wrote:I'm not sure it is a portable solution. You can't assume every C compiler will actually assemble assembly code.
Err... can you assumbe that any two assemblers would actually assemble your source code?

Anyway, GNU make implicit rules actually use $(CC) to turn .s into object code if you link directly (i.e. omit the -c), so it's not as if using $(CC) for assembly is something the OP came up with... but yes, on the other hand GNU make uses $(AS) for implicitly turning .s to intermediate .o, so both of you have a point.
Every good solution is obvious once you've found it.
Post Reply