blob: cf144452b637a2301cbe0f13bd0f770eb2249d59 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
CC=i586-elf-gcc
LD=i586-elf-ld
CFLAGS = -Wall -nostdlib -nostdinc -ffreestanding -DKERNEL_SOS
LDFLAGS = --warn-common
OBJECTS = bootstrap/multiboot.o \
drivers/x86_videomem.o drivers/bochs.o \
sos/klibc.o sos/main.o
KERNEL_OBJ = sos.elf
MULTIBOOT_IMAGE = cdrom.iso
PWD := $(shell pwd)
# Main target
all: $(MULTIBOOT_IMAGE)
$(MULTIBOOT_IMAGE): $(KERNEL_OBJ)
# ./support/build_image.sh $@ $<
if [ ! -e cdrom/boot/grub/stage2_eltorito ]; then \
echo "Please copy grub's stage2_eltorito to cdrom/boot/grub."; \
exit -1; \
fi
cp $(KERNEL_OBJ) cdrom
echo timeout 10 > cdrom/boot/grub/menu.lst
echo title Simple OS >> cdrom/boot/grub/menu.lst
echo kernel /$(KERNEL_OBJ) >> cdrom/boot/grub/menu.lst
genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 \
-boot-info-table -input-charset ascii -A SOS -o $(MULTIBOOT_IMAGE) cdrom
$(KERNEL_OBJ): $(OBJECTS)
$(LD) $(LDFLAGS) -T ./support/sos.lds -o $@ $^
-nm -C $@ | cut -d ' ' -f 1,3 > sos.map
-include .mkvars
# Create objects from C source code
%.o: %.c
$(CC) -I$(PWD) -c $< $(CFLAGS) -o $@
# Create objects from assembler (.S) source code
%.o: %.S
$(CC) -I$(PWD) -c $< $(CFLAGS) -DASM_SOURCE=1 -o $@
# Clean directory
clean:
$(RM) *.iso *.img *.o mtoolsrc *~ menu.txt *.img *.elf *.bin *.map
$(RM) *.log *.out bochs*
$(RM) bootstrap/*.o bootstrap/*~
$(RM) drivers/*.o drivers/*~
$(RM) hwcore/*.o hwcore/*~
$(RM) sos/*.o sos/*~
$(RM) support/*~
$(RM) extra/*~
|