I am currently learning assembly. I write simple test programs so I put together a simple makefile :
AS = nasm
CC = ld
ASFLAGS = -f elf64
all: hello_name put_digit
hello_name: hello_name.o
put_digit: put_digit.o
clean:
${RM} *.o
fclean: clean
${RM} hello_name put_digit
.PHONY: all clean fclean
I have always thought that implicit rules were not really useful since you end up rewriting the rules in any substantial project. But trying to put up a makefile quickly when experimenting seems like a good use case for them instead of writing a build script. So here I am using them.
How frustrating it is to discover that there is not a LD variable so I have to hack CC
to get ld
.
Implicit rules also do not take into account .asm
files so I have to disguise them as .s
files although I am using the intel
/nasm
syntax.
Is there any good/historical reason for this or are implicit rules a half-baked thing ?