我一直在观察this video(他在8:24开始创建Makefile),但由于他在Linux上,而我在Windows上(我猜这就是原因),“make”命令似乎对我不起作用。
所以我通过Chocolatey安装了GNU Make,根据this thread的说法,它应该“像在原生Linux环境中尝试Makefile一样运行”,但我得到了这个错误:
D:\assembly\OS>make
make: *** No rule to make target 'src/main.asm', needed by 'build/main.bin'. Stop.
字符串
Makefile位于'OS'目录中,仅称为'Makefile',没有文件扩展名。
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
型
然后我意识到GNU Makefile实际上看起来与视频中的不同。那么我是否缺少命令的部分,或者我需要将其转换为:
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
型
一个GNU Make可以使用的Makefile?
请记住,我以前从未使用过Makefile,谢谢。
1条答案
按热度按时间xiozqbni1#
问题是
src\main.asm
不存在,因为它是src\main\main.asm
。