Skip to content

Commit

Permalink
move headers to separate directories
Browse files Browse the repository at this point in the history
also update makefiles to reflect the change
  • Loading branch information
viren-nadkarni committed Jun 15, 2016
1 parent cb3f107 commit aab0953
Show file tree
Hide file tree
Showing 20 changed files with 19 additions and 11 deletions.
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ export CCFLAGS = -fno-builtin -m32 -Wall -nostartfiles -nostdlib -nostdinc -std=
export ASFLAGS = -f elf32
export LDFLAGS = -melf_i386 -Ttext 0x1000 --oformat binary # -T linker.ld

.PHONY: all run debug qemu bochs clean libc zbos kernel bootloader
export KERNEL_INCDIR = $(shell pwd)/kernel/include
export LIBC_INCDIR = $(shell pwd)/libc/include

.PHONY: all run debug qemu bochs clean libc zbos kernel bootloader prereq

all: libc zbos

Expand All @@ -19,18 +22,19 @@ bochs: all
clean:
find . -iname "*.img" -o -iname "*.bin" -o -iname "*.o" -o -iname "*.a" | xargs rm -v

libc:
prereq:
mkdir -p build

libc: prereq
cd libc; make

zbos: kernel bootloader
mkdir -p build
zbos: kernel bootloader prereq
dd if=/dev/zero of=build/zero.img bs=64K count=1
cat boot/boot.img kernel/kernel.bin build/zero.img > build/zbos.img
rm build/zero.img
cat build/boot.img build/kernel.bin build/zero.img > build/zbos.img

kernel:
kernel: prereq
cd kernel; make

bootloader:
bootloader: prereq
cd boot; make

1 change: 1 addition & 0 deletions boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ all: boot.img

boot.img: ${SOURCES}
nasm -f bin -o $@ main.asm
cp $@ ../build

6 changes: 4 additions & 2 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ entry.o: entry.asm
nasm $(ASFLAGS) -o entry.o entry.asm

%.o: %.c ${HEADERS}
gcc $(CCFLAGS) -o $@ $< -I../libc
gcc $(CCFLAGS) -o $@ $< -I$(KERNEL_INCDIR) -I$(LIBC_INCDIR)

kernel.bin: entry.o kernel.o ${OBJ}
ld $(LDFLAGS) -o $@ $^ -L../libc -lc
ld $(LDFLAGS) -o $@ $^ -L../build -lc
cp $@ ../build

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion libc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ clean:

libc.a: $(OBJ)
ar rcs $@ $(OBJ)
cp $@ ../build

%.o: %.c ${HEADERS}
gcc $(CCFLAGS) -o $@ $< -I../kernel/
gcc $(CCFLAGS) -o $@ $< -I$(KERNEL_INCDIR) -I$(LIBC_INCDIR)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit aab0953

Please sign in to comment.