Add changes related to c implementation, printf
This commit is contained in:
68
Makefile
Normal file
68
Makefile
Normal file
@ -0,0 +1,68 @@
|
||||
ASM=nasm
|
||||
CC=gcc
|
||||
CC16=/opt/watcom/binl/wcc
|
||||
LD16=/opt/watcom/binl/wlink
|
||||
|
||||
BUILD_DIR=build
|
||||
SRC_DIR=src
|
||||
TOOLS_DIR=tools
|
||||
|
||||
.PHONY: all floppy_image kernel bootloader clean always tools_fat
|
||||
|
||||
all: floppy_image tools_fat
|
||||
|
||||
#
|
||||
# Floppy Image
|
||||
#
|
||||
floppy_image: $(BUILD_DIR)/main_floppy.img
|
||||
|
||||
$(BUILD_DIR)/main_floppy.img: bootloader kernel
|
||||
dd if=/dev/zero of=$(BUILD_DIR)/main_floppy.img bs=512 count=2880
|
||||
mkfs.fat -F 12 -n "chaOS" $(BUILD_DIR)/main_floppy.img
|
||||
dd if=${BUILD_DIR}/stage1.bin of=${BUILD_DIR}/main_floppy.img conv=notrunc
|
||||
mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/stage2.bin "::stage2.bin"
|
||||
mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/kernel.bin "::kernel.bin"
|
||||
mcopy -i $(BUILD_DIR)/main_floppy.img test.txt "::test.txt"
|
||||
|
||||
#
|
||||
# Bootloader
|
||||
#
|
||||
bootloader: stage1 stage2
|
||||
|
||||
stage1: $(BUILD_DIR)/stage1.bin
|
||||
|
||||
|
||||
$(BUILD_DIR)/stage1.bin: always
|
||||
$(MAKE) -C $(SRC_DIR)/bootloader/stage1 BUILD_DIR=$(abspath $(BUILD_DIR))
|
||||
|
||||
stage2: $(BUILD_DIR)/stage2.bin
|
||||
|
||||
$(BUILD_DIR)/stage2.bin: always
|
||||
$(MAKE) -C $(SRC_DIR)/bootloader/stage2 BUILD_DIR=$(abspath $(BUILD_DIR))
|
||||
|
||||
#
|
||||
# Kernel
|
||||
#
|
||||
kernel: $(BUILD_DIR)/kernel.bin
|
||||
$(BUILD_DIR)/kernel.bin: always
|
||||
$(MAKE) -C $(SRC_DIR)/kernel BUILD_DIR=$(abspath $(BUILD_DIR))
|
||||
|
||||
#
|
||||
# Tools
|
||||
#
|
||||
tools_fat: $(BUILD_DIR)/tools/fat
|
||||
$(BUILD_DIR)/tools/fat: always $(TOOLS_DIR)/fat/fat.c
|
||||
mkdir -p $(BUILD_DIR)/tools
|
||||
$(CC) $(TOOLS_DIR)/fat/fat.c -g -o $(BUILD_DIR)/tools/fat
|
||||
|
||||
always:
|
||||
mkdir -p $(BUILD_DIR)
|
||||
|
||||
#
|
||||
# Clean
|
||||
#
|
||||
clean:
|
||||
$(MAKE) -C $(SRC_DIR)/bootloader/stage1 BUILD_DIR=$(abspath $(BUILD_DIR)) clean
|
||||
$(MAKE) -C $(SRC_DIR)/bootloader/stage2 BUILD_DIR=$(abspath $(BUILD_DIR)) clean
|
||||
$(MAKE) -C $(SRC_DIR)/kernel BUILD_DIR=$(abspath $(BUILD_DIR)) clean
|
||||
rm -rf $(BUILD_DIR)/*
|
Reference in New Issue
Block a user