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:
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:
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 ]
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.
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.
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.