Das Problem ist, dass wenn ich mein Projekt erstellen, macht make nervige Nachrichten über zirkuläre Abhängigkeiten mit ASM-Dateien. Was seltsam ist, die Nachricht wird nicht für C-Dateien angezeigt, die auf die gleiche Weise kompiliert werden. Hier ist das Makefile:'Kreisabhängigkeit fallen gelassen' mit ASM-Dateien beim Erstellen mit make
# VV4OS Makefile. Here are the main targets:
# I. all (can be called without specifying the target) - builds everything
# II. install - copies the kernel to a disk image.
# III. clean - removes the files that are created by this build system
# and thus can be recovered.
# You can set up the build system by changing the build constants.
# Here come build constants.
# If you can't build VV4OS consider changing them.
# Used tools.
MAKE=make
MOUNT=mount
UMOUNT=umount
SUDO=sudo
# I don't know if there are systems where RM, CP or MKDIR command isn't standard.
# I've added them just in case.
RM=rm
RMFLAGS=-f
CP=cp
CPFLAGS=
MKDIR=mkdir
MKDIRFLAGS=-p
# Compilers (and the linker) and their flags.
ASM=nasm
ASMFLAGS=-felf32
CC=/home/alexander/opt/cross/bin/i686-elf-gcc
CFLAGS=-Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude
LINKER=/home/alexander/opt/cross/bin/i686-elf-gcc
LFLAGS=-ffreestanding -nostdlib -lgcc -T linker.ld
# Files.
SOURCES=$(wildcard *.c) $(wildcard */*.c) $(wildcard */*/*.c) \
$(wildcard *.asm) $(wildcard */*.asm) $(wildcard */*/*.asm)
OBJECTS=$(SOURCES:=.o)
KERNEL=kernel.elf
DISK_IMG=disk.img
IMG_OFFSET=1048576 # Where the partition starts in bytes (NOT in sectors)
IMG_MNTDIR=/mnt/
# Destination paths.
KERNEL_DEST_PATH=/sys/vv4os/
KERNEL_DEST_NAME=kernel.elf
# These targets are executed whenever they called even if there are ready files with their names.
.PHONY: all install clean
# Here comes the build system code.
# Do not modify it unless your IQ level is higher than 110.
# Build everything (currently only the kernel).
# You can simply call make if you want to do it.
all:
$(MAKE) $(KERNEL)
# Installs the kernel to a disk image.
install: $(KERNEL) $(DISK_IMG)
$(MOUNT) -o loop,offset=$(IMG_OFFSET) $(DISK_IMG) $(IMG_MNTDIR)
$(MKDIR) $(MKDIRFLAGS) $(IMG_MNTDIR)/$(KERNEL_DEST_PATH)
$(CP) $(KERNEL) $(IMG_MNTDIR)/$(KERNEL_DEST_PATH)/$(KERNEL_DEST_NAME)
$(UMOUNT) $(IMG_MNTDIR)
# Only builds the kernel.
$(KERNEL): $(OBJECTS)
$(LINKER) $(LFLAGS) -o [email protected] $^
# Assemblies assembly files with assembler.
%.asm.o: %.asm
$(ASM) $(ASMFLAGS) $< -o [email protected]
# Compiles C files with compiler.
%.c.o: %.c
$(CC) $(CFLAGS) $< -o [email protected]
# Removes all the files that are created by make (and thus can be recovered).
clean:
$(RM) $(RMFLAGS) $(OBJECTS) $(KERNEL)
Und hier ist das Buildprotokoll:
$ make
make kernel.elf
make[1]: Entering directory '/home/alexander/Documents/vv4os'
/home/alexander/opt/cross/bin/i686-elf-gcc -Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude io/term.c -o io/term.c.o
/home/alexander/opt/cross/bin/i686-elf-gcc -Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude io/keyboard.c -o io/keyboard.c.o
/home/alexander/opt/cross/bin/i686-elf-gcc -Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude hdd/hdd.c -o hdd/hdd.c.o
/home/alexander/opt/cross/bin/i686-elf-gcc -Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude hdd/mbr.c -o hdd/mbr.c.o
/home/alexander/opt/cross/bin/i686-elf-gcc -Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude libc/stdlib.c -o libc/stdlib.c.o
/home/alexander/opt/cross/bin/i686-elf-gcc -Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude libc/string.c -o libc/string.c.o
/home/alexander/opt/cross/bin/i686-elf-gcc -Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude libc/stdio.c -o libc/stdio.c.o
/home/alexander/opt/cross/bin/i686-elf-gcc -Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude isr/isr.c -o isr/isr.c.o
/home/alexander/opt/cross/bin/i686-elf-gcc -Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude isr/descriptor_tables.c -o isr/descriptor_tables.c.o
/home/alexander/opt/cross/bin/i686-elf-gcc -Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude isr/timer.c -o isr/timer.c.o
/home/alexander/opt/cross/bin/i686-elf-gcc -Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude general/system.c -o general/system.c.o
/home/alexander/opt/cross/bin/i686-elf-gcc -Wall -Wextra -Werror -ffreestanding -std=c11 -c -Iinclude general/kernel.c -o general/kernel.c.o
make[1]: Circular boot/boot.asm <- boot/boot.asm.o dependency dropped.
nasm -felf32 boot/boot.asm -o boot/boot.asm.o
make[1]: Circular isr/interrupts.asm <- isr/interrupts.asm.o dependency dropped.
nasm -felf32 isr/interrupts.asm -o isr/interrupts.asm.o
/home/alexander/opt/cross/bin/i686-elf-gcc -ffreestanding -nostdlib -lgcc -T linker.ld -o kernel.elf io/term.c.o io/keyboard.c.o hdd/hdd.c.o hdd/mbr.c.o libc/stdlib.c.o libc/string.c.o libc/stdio.c.o isr/isr.c.o isr/descriptor_tables.c.o isr/timer.c.o general/system.c.o general/kernel.c.o boot/boot.asm.o isr/interrupts.asm.o
make[1]: Leaving directory '/home/alexander/Documents/vv4os'
Was könnte das Problem sein?
UPD:
Es gibt immer eine solche Nachricht, wenn ein Ziel wie
file.asm.o: file.asm
nasm file.asm -o file.asm.o
ausgeführt wird, wo file.asm jede Assembly-Datei (es arbeitet mit einem leeren).
Warum verwenden Sie '.asm.o' und' .co' statt nur '.o' für die Objektdateien? – starblue
@Starblue Ich bin einfach zu faul, die Dateien umzubenennen. – velikiyv4
Führen Sie 'make -qp' aus und prüfen Sie, ob Sie die Regel finden, über die sich die Benutzer beschweren. Es könnte/sollte Ihnen sagen, woher es im Makefile kommt. Wenn Sie dafür eine [MCVE] (https://stackoverflow.com/help/mcve) erstellen können (Liste der Quelldateien usw.), die uns ebenfalls helfen kann. –