Diff markup
001 <<
002 <<
003 <<
004 <<
005 <<
006 <<
007 <<
008 <<
009 <<
010 <<
011 <<
012 <<
013 <<
014 <<
015 <<
016 <<
017 <<
018 CC=gcc 001 CC=gcc
019 LD=ld !! 002 CFLAGS = -Wall -nostdlib -nostdinc -ffreestanding -DKERNEL_SOS
020 CP=cp !! 003 LDFLAGS = --warn-common
021 STRIP=strip !! 004 OBJECTS = bootstrap/multiboot.o \
022 CFLAGS = -Wall -nostdinc -ffreestanding -DKER !! 005 drivers/x86_videomem.o drivers/bochs.o \
023 LIBGCC = $(shell $(CC) -print-libgcc-file-nam !! 006 sos/klibc.o sos/main.o
024 LDFLAGS = --warn-common -nostdlib <<
025 OBJECTS = bootstrap/multiboot.o <<
026 hwcore/idt.o hwcore/gdt.o <<
027 hwcore/swintr.o hwcore/swintr_wrappe <<
028 hwcore/exception.o hwcore/exception_ <<
029 hwcore/irq.o hwcore/irq_wrappers.o h <<
030 hwcore/paging.o hwcore/i8254.o <<
031 hwcore/cpu_context.o hwcore/cpu_cont <<
032 hwcore/mm_context.o <<
033 sos/kmem_vmm.o sos/kmem_slab.o sos/k <<
034 sos/physmem.o sos/klibc.o <<
035 sos/thread.o sos/kwaitq.o <<
036 sos/time.o sos/sched.o sos/ksynch.o <<
037 sos/process.o sos/syscall.o <<
038 sos/assert.o sos/main.o sos/mouse_si <<
039 sos/uaccess.o sos/calcload.o <<
040 sos/umem_vmm.o sos/binfmt_elf32.o <<
041 drivers/x86_videomem.o drivers/bochs <<
042 drivers/zero.o drivers/mem.o <<
043 drivers/ide.o drivers/kbd.o drivers/ <<
044 drivers/serial.o drivers/tty.o drive <<
045 drivers/console.o <<
046 sos/hash.o sos/fs.o sos/fs_nscache.o <<
047 drivers/fs_virtfs.o sos/chardev.o so <<
048 sos/blkcache.o sos/fs_pagecache.o <<
049 userland/userprogs.kimg <<
050 007
051 KERNEL_OBJ = sos.elf 008 KERNEL_OBJ = sos.elf
052 KERNEL_LOAD = sos.gz <<
053 MULTIBOOT_IMAGE = fd.img 009 MULTIBOOT_IMAGE = fd.img
054 PWD := $(shell pwd | sed 's/"/\\\"/g;s/\$$/\\\ !! 010 PWD := $(shell pwd)
055 011
056 012
057 all: $(MULTIBOOT_IMAGE) 013 all: $(MULTIBOOT_IMAGE)
058 014
059 $(MULTIBOOT_IMAGE): $(KERNEL_LOAD) !! 015 $(MULTIBOOT_IMAGE): $(KERNEL_OBJ)
060 ./support/build_image.sh $@ $< 016 ./support/build_image.sh $@ $<
061 017
062 $(KERNEL_LOAD): $(KERNEL_OBJ) !! 018 $(KERNEL_OBJ): $(OBJECTS)
063 $(CP) $< $<.strip && $(STRIP) -sx -R . !! 019 $(LD) $(LDFLAGS) -T ./support/sos.lds -o $@ $^
064 gzip < $<.strip > $@ <<
065 <<
066 $(KERNEL_OBJ): $(OBJECTS) ./support/sos.lds <<
067 $(LD) $(LDFLAGS) -T ./support/sos.lds <<
068 -nm -C $@ | cut -d ' ' -f 1,3 > sos.ma 020 -nm -C $@ | cut -d ' ' -f 1,3 > sos.map
069 size $@ <<
070 021
071 -include .mkvars 022 -include .mkvars
072 023
073 # Create the userland programs to include in t <<
074 userland/userprogs.kimg: FORCE <<
075 $(MAKE) -C userland <<
076 <<
077 024 # Create objects from C source code
078 %.o: %.c 025 %.o: %.c
079 $(CC) "-I$(PWD)" -c "$<" $(CFLAGS) -o !! 026 $(CC) -I$(PWD) -c $< $(CFLAGS) -o $@
080 027
081 028
082 %.o: %.S 029 %.o: %.S
083 $(CC) "-I$(PWD)" -c "$<" $(CFLAGS) -DA !! 030 $(CC) -I$(PWD) -c $< $(CFLAGS) -DASM_SOURCE=1 -o $@
084 <<
085 FORCE: <<
086 @ <<
087 031
088 032
089 clean: 033 clean:
090 $(RM) fd*.img *.o mtoolsrc *~ menu.txt !! 034 $(RM) *.img *.o mtoolsrc *~ menu.txt *.img *.elf *.bin *.map
091 $(RM) *.log *.out bochs* sos.gz !! 035 $(RM) *.log *.out bochs*
092 $(RM) bootstrap/*.o bootstrap/*~ 036 $(RM) bootstrap/*.o bootstrap/*~
093 $(RM) drivers/*.o drivers/*~ 037 $(RM) drivers/*.o drivers/*~
094 $(RM) hwcore/*.o hwcore/*~ 038 $(RM) hwcore/*.o hwcore/*~
095 $(RM) sos/*.o sos/*~ 039 $(RM) sos/*.o sos/*~
096 $(RM) support/*~ 040 $(RM) support/*~
097 $(RM) extra/*~ 041 $(RM) extra/*~
098 $(MAKE) -C extra clean <<
099 $(MAKE) -C userland clean <<