I am trying to compile a program using this makefile:
GCCPARAMS = -m32 -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscoreASPARAMS = --32objects = src/loader.o src/kernel.o%.o: src/%.cpp gcc $(GCCPARAMS) -c -o $@ $<%.o: src/%.s echo $(ASPARAMS) as $(ASPARAMS) -o $@ $<kernel.bin: linker.ld $(objects) ld $(LDPARAMS) -T $< -o $@ $(objects)install: kernel.bin sudo cp $< boot/mykernel.bin
The problem comes when doing make
which prints the following:
as -o src/loader.o src/loader.ssrc/loader.s: Assembler messages:src/loader.s: Warning: end of file not at end of a line; newline insertedsrc/loader.s:18: Error: operand type mismatch for `push'src/loader.s:19: Error: operand type mismatch for `push'make: *** [<builtin>: src/loader.o] Error 1
As you can se the variable is not properly set, instead, make
puts a space where the variable should be. That causes the assembler compiler to think it's a 64 bit architecture and giving some errors.
Any idea of what is going on? I am doing this using WSL2 by the way.