This repository has been archived on 2020-02-06. You can view files and clone it, but cannot push or open issues or pull requests.
Legacy-Sync/makefile
Jenny Curle f6ba6aa117 Legacy OS files. Have an i686-elf-gcc & -ld in your PATH,
and the Makefile will take care of the rest.
2019-04-01 01:38:50 +01:00

53 lines
1.3 KiB
Makefile

C_SOURCES = $(wildcard *.c)
ASM_SOURCES = $(wildcard *.s)
HEADERS = $(wildcard headers/*.h)
#OBJECTS = loader.o ${C_SOURCES:.c=.o}
#OBJECTS = ${C_SOURCES:.c=.o ASM_SOURCES:.s=.o}
OBJECTS = ${ASM_SOURCES:.s=.o} ${C_SOURCES:.c=.o}
#OBJECTS = ${wildcard *.o}
CC = i686-elf-gcc
CFLAGS = -masm=intel -m32 -ffreestanding -fno-builtin -fno-stack-protector \
-isystem=/usr/include -Wall -Wextra -Werror -c
LDFLAGS = -T link.ld -melf_i386
AS = nasm
ASFLAGS = -f elf32
everything: all
rm -f os.iso
cp kernel.elf iso/boot/kernel.elf
genisoimage -R \
-b boot/grub/stage2_eltorito \
-no-emul-boot \
-A os \
-input-charset utf8 \
-quiet \
-boot-info-table \
-o os.iso \
iso
all: kernel.elf
kernel.elf: $(OBJECTS)
i686-elf-ld $(LDFLAGS) $(OBJECTS) -o kernel.elf
os.iso: kernel.elf
cp kernel.elf iso/boot/kernel.elf
genisoimage -R \
-b boot/grub/stage2_eltorito \
-no-emul-boot \
-A os \
-input-charset utf8 \
-quiet \
-boot-info-table \
-o os.iso \
iso
%.o: %.c ${HEADERS}
$(CC) $(CFLAGS) $< -o $@
%.o: %.s
$(AS) $(ASFLAGS) $< -o $@
clean:
rm *.o