old-trainOS/Makefile

192 lines
8.9 KiB
Makefile
Raw Normal View History

2015-08-14 11:34:14 +00:00
# Makefile generated by makedep.
# Tools
RM = rm
AS = gcc
CC = gcc
CXX = g++
LD = g++
LEX = flex
YACC = bison
# File Lists
SRCS_AS = asm/dynamic.S asm/intr_common_handler.S asm/multiboot.S asm/start.S
SRCS_CC = src/console.c src/init.c src/interrupts.c src/malloc.c src/pmm.c src/serial.c src/stdlib.c src/timer.c src/vmm.c
SRCS_CXX = trainscript/tsvm.cpp trainscript/variable.cpp src/cplusplus.cpp src/vm.cpp obj/trainscript.yy.cpp obj/trainscript.tab.cpp
OBJS = obj/tsvm.o obj/variable.o obj/dynamic.o obj/intr_common_handler.o obj/multiboot.o obj/start.o obj/console.o obj/init.o obj/interrupts.o obj/malloc.o obj/pmm.o obj/serial.o obj/stdlib.o obj/timer.o obj/vmm.o obj/cplusplus.o obj/vm.o obj/trainscript.yy.o obj/trainscript.tab.o obj/main.o
2015-08-14 11:34:14 +00:00
# Flags
FLAGS = -m32 -Dnullptr=0 -D__cdecl="__attribute__((cdecl))" -mno-sse -mno-sse2 -mno-mmx
ASFLAGS = -masm=intel
2015-08-14 11:34:14 +00:00
CCFLAGS = -g -std=c11 -Dnullptr=0 -Wall -g -fno-stack-protector -ffreestanding -Iinclude
2015-08-13 15:23:11 +00:00
CXXFLAGS = -g -std=c++11 -Wall -g -fno-stack-protector -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -Wall -Wextra -ffreestanding -Wno-unused-function -Iinclude
2015-08-14 11:34:14 +00:00
LDFLAGS = -g -m32 -nostdlib -fno-builtin -Tkernel.ld
2015-08-09 00:42:56 +00:00
2015-08-14 11:34:14 +00:00
# Targets
all: kernel
2015-08-09 00:42:56 +00:00
.PHONY: clean
2015-08-14 11:34:14 +00:00
clean:
$(RM) obj/trainscript.yy.cpp obj/trainscript.tab.cpp obj/tsvm.o obj/variable.o obj/dynamic.o obj/intr_common_handler.o obj/multiboot.o obj/start.o obj/console.o obj/init.o obj/interrupts.o obj/malloc.o obj/pmm.o obj/serial.o obj/stdlib.o obj/timer.o obj/vmm.o obj/cplusplus.o obj/vm.o obj/trainscript.yy.o obj/trainscript.tab.o obj/main.o
2015-08-14 11:34:14 +00:00
kernel: obj/tsvm.o obj/variable.o obj/dynamic.o obj/intr_common_handler.o obj/multiboot.o obj/start.o obj/console.o obj/init.o obj/interrupts.o obj/malloc.o obj/pmm.o obj/serial.o obj/stdlib.o obj/timer.o obj/vmm.o obj/cplusplus.o obj/vm.o obj/trainscript.yy.o obj/trainscript.tab.o obj/main.o
$(LD) $(FLAGS) $(LDFLAGS) -o $@ obj/tsvm.o obj/variable.o obj/dynamic.o obj/intr_common_handler.o obj/multiboot.o obj/start.o obj/console.o obj/init.o obj/interrupts.o obj/malloc.o obj/pmm.o obj/serial.o obj/stdlib.o obj/timer.o obj/vmm.o obj/cplusplus.o obj/vm.o obj/trainscript.yy.o obj/trainscript.tab.o obj/main.o
2015-08-14 11:34:14 +00:00
# src/console.c
obj/console.o: src/console.c include/console.h include/stdlib.h \
include/varargs.h include/config.h include/malloc.h
$(CC) -iquoteobj $(FLAGS) $(CCFLAGS) -o $@ -c src/console.c
2015-08-14 11:34:14 +00:00
# src/init.c
obj/init.o: src/init.c include/kernel.h include/stdlib.h include/varargs.h \
include/config.h include/malloc.h include/console.h include/interrupts.h \
include/cpustate.h include/pmm.h include/multiboot.h include/vmm.h \
include/timer.h include/serial.h
$(CC) -iquoteobj $(FLAGS) $(CCFLAGS) -o $@ -c src/init.c
2015-08-14 11:34:14 +00:00
# src/interrupts.c
obj/interrupts.o: src/interrupts.c include/interrupts.h include/cpustate.h \
include/console.h include/stdlib.h include/varargs.h include/config.h \
include/malloc.h include/io.h src/intr_stubs.h
$(CC) -iquoteobj $(FLAGS) $(CCFLAGS) -o $@ -c src/interrupts.c
2015-08-14 11:34:14 +00:00
# src/malloc.c
obj/malloc.o: src/malloc.c include/kernel.h include/stdlib.h \
include/varargs.h include/config.h include/malloc.h include/console.h \
include/serial.h
$(CC) -iquoteobj $(FLAGS) $(CCFLAGS) -o $@ -c src/malloc.c
2015-08-14 11:34:14 +00:00
# src/pmm.c
obj/pmm.o: src/pmm.c include/pmm.h include/multiboot.h include/kernel.h \
include/stdlib.h include/varargs.h include/config.h include/malloc.h \
include/console.h
$(CC) -iquoteobj $(FLAGS) $(CCFLAGS) -o $@ -c src/pmm.c
2015-08-14 11:34:14 +00:00
# src/serial.c
obj/serial.o: src/serial.c include/io.h include/serial.h include/stdlib.h \
include/varargs.h include/config.h include/malloc.h
$(CC) -iquoteobj $(FLAGS) $(CCFLAGS) -o $@ -c src/serial.c
2015-08-14 11:34:14 +00:00
# src/stdlib.c
obj/stdlib.o: src/stdlib.c include/stdlib.h include/varargs.h \
include/config.h include/malloc.h include/kernel.h
$(CC) -iquoteobj $(FLAGS) $(CCFLAGS) -o $@ -c src/stdlib.c
2015-08-14 11:34:14 +00:00
# src/timer.c
2015-08-15 22:45:12 +00:00
obj/timer.o: src/timer.c include/timer.h include/kernel.h \
include/interrupts.h include/cpustate.h
$(CC) -iquoteobj $(FLAGS) $(CCFLAGS) -o $@ -c src/timer.c
2015-08-14 11:34:14 +00:00
# src/vmm.c
obj/vmm.o: src/vmm.c include/config.h include/vmm.h include/pmm.h \
include/multiboot.h include/stdlib.h include/varargs.h include/malloc.h \
include/console.h include/kernel.h
$(CC) -iquoteobj $(FLAGS) $(CCFLAGS) -o $@ -c src/vmm.c
2015-08-14 11:34:14 +00:00
# trainscript/tsvm.cpp
obj/tsvm.o: trainscript/tsvm.cpp include/stdlib.h include/varargs.h \
include/config.h include/malloc.h include/console.h trainscript/common.h \
trainscript/tsvm.hpp trainscript/vm.hpp trainscript/module.hpp \
include/ker/string.hpp include/ker/dictionary.hpp include/kernel.h \
include/ker/pair.hpp include/ker/vector.hpp include/ker/new.hpp \
trainscript/variable.hpp trainscript/type.hpp trainscript/types.hpp \
trainscript/typeid.hpp trainscript/method.hpp \
trainscript/instructions.hpp trainscript/instruction.hpp \
trainscript/executioncontext.hpp trainscript/scriptmethod.hpp \
obj/trainscript.tab.hpp trainscript/trainscript.l.h include/string.h
$(CXX) -iquoteobj $(FLAGS) $(CXXFLAGS) -o $@ -c trainscript/tsvm.cpp
2015-08-14 11:34:14 +00:00
# trainscript/variable.cpp
obj/variable.o: trainscript/variable.cpp include/kernel.h \
trainscript/variable.hpp trainscript/type.hpp trainscript/types.hpp \
include/ker/string.hpp include/stdlib.h include/varargs.h \
include/config.h include/malloc.h trainscript/typeid.hpp
$(CXX) -iquoteobj $(FLAGS) $(CXXFLAGS) -o $@ -c trainscript/variable.cpp
2015-08-14 11:34:14 +00:00
# src/cplusplus.cpp
obj/cplusplus.o: src/cplusplus.cpp include/stdlib.h include/varargs.h \
include/config.h include/malloc.h include/console.h include/ker/new.hpp
$(CXX) -iquoteobj $(FLAGS) $(CXXFLAGS) -o $@ -c src/cplusplus.cpp
2015-08-14 11:34:14 +00:00
# src/vm.cpp
obj/vm.o: src/vm.cpp include/stdlib.h include/varargs.h include/config.h \
include/malloc.h include/timer.h include/dynamic.h include/console.h \
src/../trainscript/tsvm.hpp src/../trainscript/vm.hpp \
src/../trainscript/module.hpp include/ker/string.hpp \
include/ker/dictionary.hpp include/kernel.h include/ker/pair.hpp \
include/ker/vector.hpp include/ker/new.hpp \
src/../trainscript/variable.hpp src/../trainscript/type.hpp \
src/../trainscript/types.hpp src/../trainscript/typeid.hpp \
src/../trainscript/method.hpp src/../trainscript/instructions.hpp \
src/../trainscript/instruction.hpp \
src/../trainscript/executioncontext.hpp \
src/../trainscript/scriptmethod.hpp
$(CXX) -iquoteobj $(FLAGS) $(CXXFLAGS) -o $@ -c src/vm.cpp
2015-08-14 11:34:14 +00:00
# obj/trainscript.yy.cpp
obj/trainscript.yy.o: obj/trainscript.yy.cpp include/string.h \
include/stdlib.h include/varargs.h include/config.h include/malloc.h \
trainscript/common.h trainscript/tsvm.hpp trainscript/vm.hpp \
trainscript/module.hpp include/ker/string.hpp include/ker/dictionary.hpp \
include/kernel.h include/ker/pair.hpp include/ker/vector.hpp \
include/ker/new.hpp trainscript/variable.hpp trainscript/type.hpp \
trainscript/types.hpp trainscript/typeid.hpp trainscript/method.hpp \
trainscript/instructions.hpp trainscript/instruction.hpp \
trainscript/executioncontext.hpp trainscript/scriptmethod.hpp \
obj/trainscript.tab.hpp
$(CXX) -iquotetrainscript -iquoteobj $(FLAGS) $(CXXFLAGS) -o $@ -c obj/trainscript.yy.cpp
2015-08-14 11:34:14 +00:00
# obj/trainscript.tab.cpp
obj/trainscript.tab.o: obj/trainscript.tab.cpp include/stdlib.h \
include/varargs.h include/config.h include/malloc.h include/console.h \
trainscript/common.h trainscript/tsvm.hpp trainscript/vm.hpp \
trainscript/module.hpp include/ker/string.hpp include/ker/dictionary.hpp \
include/kernel.h include/ker/pair.hpp include/ker/vector.hpp \
include/ker/new.hpp trainscript/variable.hpp trainscript/type.hpp \
trainscript/types.hpp trainscript/typeid.hpp trainscript/method.hpp \
trainscript/instructions.hpp trainscript/instruction.hpp \
trainscript/executioncontext.hpp trainscript/scriptmethod.hpp \
trainscript/trainscript.l.h include/string.h
$(CXX) -iquotetrainscript -iquoteobj $(FLAGS) $(CXXFLAGS) -o $@ -c obj/trainscript.tab.cpp
2015-08-14 11:34:14 +00:00
# asm/dynamic.S
obj/dynamic.o: asm/dynamic.S
$(AS) $(FLAGS) $(ASFLAGS) -o $@ -c asm/dynamic.S
2015-08-14 11:34:14 +00:00
# asm/intr_common_handler.S
obj/intr_common_handler.o: asm/intr_common_handler.S
$(AS) $(FLAGS) $(ASFLAGS) -o $@ -c asm/intr_common_handler.S
# asm/multiboot.S
obj/multiboot.o: asm/multiboot.S
$(AS) $(FLAGS) $(ASFLAGS) -o $@ -c asm/multiboot.S
# asm/start.S
obj/start.o: asm/start.S
$(AS) $(FLAGS) $(ASFLAGS) -o $@ -c asm/start.S
obj/trainscript.yy.cpp: trainscript/trainscript.l
$(LEX) --header-file=trainscript/trainscript.l.h -o obj/trainscript.yy.cpp -d trainscript/trainscript.l
obj/trainscript.tab.cpp: trainscript/trainscript.y
$(YACC) -o obj/trainscript.tab.cpp -d trainscript/trainscript.y
# Custom Targets
obj/main.o: scripts/main.ts
objcopy -B i386 -I binary -O elf32-i386 \
scripts/main.ts obj/main.o
objcopy \
--redefine-sym _binary_scripts_main_ts_start=mainscript_start \
--redefine-sym _binary_scripts_main_ts_end=mainscript_end \
--redefine-sym _binary_scripts_main_ts_size=mainscript_size \
obj/main.o
2015-08-09 00:42:56 +00:00
.PHONY: run
2015-08-14 11:34:14 +00:00
run:
qemu-system-i386 -serial stdio -kernel kernel
.PHONY: debug
debug:
qemu-system-i386 -s -S -serial stdio -kernel kernel