I have been watching this video (he starts creating the Makefile at 8:24), but since he is on Linux and I am on Windows (I'm guessing that is the reason anyway), the 'make' command does not seem to work for me.

So I installed GNU Make through Chocolatey, which according to this thread is supposed to "Run as if trying the Makefile on a native Linux environment", but I got this error:

D:\assembly\OS>make
make: *** No rule to make target 'src/main.asm', needed by 'build/main.bin'.  Stop.

The Makefile is in the 'OS' directory, and is called just that 'Makefile', with no file name extensions.

D:\assembly\OS>dir
 Volume in drive D has no label.
 Volume Serial Number is C14D-581B

 Directory of D:\assembly\OS

07/01/2024  04:32 PM    <DIR>          .
06/01/2024  11:00 PM    <DIR>          ..
07/01/2024  02:07 PM    <DIR>          build
07/01/2024  11:48 AM               307 Makefile
07/01/2024  04:32 PM    <DIR>          src
               1 File(s)            307 bytes
               4 Dir(s)  174,669,336,576 bytes free

I then realised that a GNU Makefile actually looks different to what was in the video. So am I missing parts of the command, or do I need to turn this:

ASM=nasm

SRC_DIR=src
BUILD_DIR=build

$(BUILD_DIR)/main_floppy.img: $(BUILD_DIR)/main.bin
    cp $(BUILD_DIR)/main.bin $(BUILD_DIR)/main_floppy.img
    truncate -s 1440k $(BUILD_DIR)/main_floppy.img

$(BUILD_DIR)/main.bin: $(SRC_DIR)/main.asm
    $(ASM) $(SRC_DIR)/main.asm -f bin -o $(BUILD_DIR)/main.bin

into a Makefile that GNU Make can use?

Please keep in mind that I have never used a Makefile before, and thank you.

1

There are 1 best solutions below

0
Ls16 On

Nevermind, problem was that src\main.asm does not exist, because it is src\main\main.asm.