aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
l---------[-rw-r--r--]Makefile53
-rw-r--r--Unix.mk52
-rw-r--r--Win.mk52
3 files changed, 105 insertions, 52 deletions
diff --git a/Makefile b/Makefile
index 0252b36..022c7ce 100644..120000
--- a/Makefile
+++ b/Makefile
@@ -1,52 +1 @@
-C_SOURCES = $(wildcard src/*.c)
-C_HEADERS = $(wildcard src/*.h)
-C_OBJECTS = ${C_SOURCES:.c=.o}
-C_OBJECTD = ${subst src,obj,${C_OBJECTS}}
-A_SOURCES = $(wildcard src/*.S)
-A_OBJECTS = ${A_SOURCES:.S=.o}
-A_OBJECTD = ${subst src,obj,${A_OBJECTS}}
-
-CROSS = arm-none-eabi
-CC = ${CROSS}-gcc
-AS = ${CROSS}-as
-OBJCOPY = ${CROSS}-objcopy
-OBJDUMP = ${CROSS}-objdump
-QEMU = qemu-system-arm
-GDB = gdb-multiarch
-CFLAGS = -mcpu=cortex-a7 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -nostdlib -g
-AFLAGS = -mcpu=cortex-a7
-QFLAGS = -M raspi2 -cpu arm1176 -m 1G -serial mon:stdio -nographic
-
-.PHONY: clean run run-debug debug export
-
-default: clean build/kernel7.img
-
-build/kernel7.img: build/kernel.elf
- ${OBJCOPY} $< -O binary $@
-
-build/kernel.list: build/kernel-g.elf
- ${OBJDUMP} -D $< > $@
-
-build/kernel-g.elf: ${A_OBJECTD} ${C_OBJECTD}
- ${CC} -T linker.ld -o $@ ${CFLAGS} $^ -lgcc
-
-build/kernel.elf: ${A_OBJECTD} ${C_OBJECTD}
- ${CC} -T linker.ld -o $@ -ffreestanding -O2 -nostdlib $^ -lgcc
-
-export: build/kernel.list
- cp build/kernel-g.elf /mnt/c/Local/
-
-obj/%.o: src/%.S
- ${AS} ${AFLAGS} -g -c $< -o $@
-
-run: build/kernel.elf
- ${QEMU} -kernel $< ${QFLAGS}
-
-run-debug: build/kernel-g.elf
- ${QEMU} -kernel $< -s -S ${QFLAGS}
-
-debug: build/kernel-g.elf build/kernel.list
- ${GDB} $< -command=gdbinit
-
-clean:
- rm -f obj/*.o build/*.elf build/*.list build/*.img
+Unix.mk \ No newline at end of file
diff --git a/Unix.mk b/Unix.mk
new file mode 100644
index 0000000..0252b36
--- /dev/null
+++ b/Unix.mk
@@ -0,0 +1,52 @@
+C_SOURCES = $(wildcard src/*.c)
+C_HEADERS = $(wildcard src/*.h)
+C_OBJECTS = ${C_SOURCES:.c=.o}
+C_OBJECTD = ${subst src,obj,${C_OBJECTS}}
+A_SOURCES = $(wildcard src/*.S)
+A_OBJECTS = ${A_SOURCES:.S=.o}
+A_OBJECTD = ${subst src,obj,${A_OBJECTS}}
+
+CROSS = arm-none-eabi
+CC = ${CROSS}-gcc
+AS = ${CROSS}-as
+OBJCOPY = ${CROSS}-objcopy
+OBJDUMP = ${CROSS}-objdump
+QEMU = qemu-system-arm
+GDB = gdb-multiarch
+CFLAGS = -mcpu=cortex-a7 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -nostdlib -g
+AFLAGS = -mcpu=cortex-a7
+QFLAGS = -M raspi2 -cpu arm1176 -m 1G -serial mon:stdio -nographic
+
+.PHONY: clean run run-debug debug export
+
+default: clean build/kernel7.img
+
+build/kernel7.img: build/kernel.elf
+ ${OBJCOPY} $< -O binary $@
+
+build/kernel.list: build/kernel-g.elf
+ ${OBJDUMP} -D $< > $@
+
+build/kernel-g.elf: ${A_OBJECTD} ${C_OBJECTD}
+ ${CC} -T linker.ld -o $@ ${CFLAGS} $^ -lgcc
+
+build/kernel.elf: ${A_OBJECTD} ${C_OBJECTD}
+ ${CC} -T linker.ld -o $@ -ffreestanding -O2 -nostdlib $^ -lgcc
+
+export: build/kernel.list
+ cp build/kernel-g.elf /mnt/c/Local/
+
+obj/%.o: src/%.S
+ ${AS} ${AFLAGS} -g -c $< -o $@
+
+run: build/kernel.elf
+ ${QEMU} -kernel $< ${QFLAGS}
+
+run-debug: build/kernel-g.elf
+ ${QEMU} -kernel $< -s -S ${QFLAGS}
+
+debug: build/kernel-g.elf build/kernel.list
+ ${GDB} $< -command=gdbinit
+
+clean:
+ rm -f obj/*.o build/*.elf build/*.list build/*.img
diff --git a/Win.mk b/Win.mk
new file mode 100644
index 0000000..d2a3683
--- /dev/null
+++ b/Win.mk
@@ -0,0 +1,52 @@
+C_SOURCES = $(wildcard src/*.c)
+C_HEADERS = $(wildcard src/*.h)
+C_OBJECTS = ${C_SOURCES:.c=.o}
+C_OBJECTD = ${subst src,obj,${C_OBJECTS}}
+A_SOURCES = $(wildcard src/*.S)
+A_OBJECTS = ${A_SOURCES:.S=.o}
+A_OBJECTD = ${subst src,obj,${A_OBJECTS}}
+
+CROSS = arm-none-eabi
+CC = ${CROSS}-gcc
+AS = ${CROSS}-as
+OBJCOPY = ${CROSS}-objcopy
+OBJDUMP = ${CROSS}-objdump
+QEMU = /mnt/c/qemu/qemu-system-arm.exe
+GDB = gdb-multiarch
+CFLAGS = -mcpu=cortex-a7 -fpic -ffreestanding -std=gnu99 -O2 -Wall -Wextra -nostdlib -g
+AFLAGS = -mcpu=cortex-a7
+QFLAGS = -M raspi2 -cpu arm1176 -m 1G -serial mon:stdio -nographic
+
+.PHONY: clean run run-debug debug export
+
+default: clean build/kernel7.img
+
+build/kernel7.img: build/kernel.elf
+ ${OBJCOPY} $< -O binary $@
+
+build/kernel.list: build/kernel-g.elf
+ ${OBJDUMP} -D $< > $@
+
+build/kernel-g.elf: ${A_OBJECTD} ${C_OBJECTD}
+ ${CC} -T linker.ld -o $@ ${CFLAGS} $^ -lgcc
+
+build/kernel.elf: ${A_OBJECTD} ${C_OBJECTD}
+ ${CC} -T linker.ld -o $@ -ffreestanding -O2 -nostdlib $^ -lgcc
+
+export: build/kernel.list
+ cp build/kernel-g.elf /mnt/c/Local/
+
+obj/%.o: src/%.S
+ ${AS} ${AFLAGS} -g -c $< -o $@
+
+run: build/kernel.elf
+ ${QEMU} -kernel $< ${QFLAGS}
+
+run-debug: build/kernel-g.elf
+ ${QEMU} -kernel $< -s -S ${QFLAGS}
+
+debug: build/kernel-g.elf build/kernel.list
+ ${GDB} $< -command=gdbinit
+
+clean:
+ rm -f obj/*.o build/*.elf build/*.list build/*.img