old-DasOS/prototypes/base/Makefile

66 lines
1.5 KiB
Makefile
Raw Normal View History

2016-04-30 13:10:28 +00:00
AS=gcc
CC=gcc
CXX=g++
2016-04-30 13:10:28 +00:00
LD=ld
2016-05-05 15:06:11 +00:00
IDT_DISPATCH = _ZN3IDT8dispatchEP8CpuState
2016-05-07 17:55:59 +00:00
FLAGS = -mno-sse -DIDT_DISPATCH=$(IDT_DISPATCH) -ffreestanding -m32 -Werror -Wall -iquote include -iquote lists -I../stdlib/include -O3 -g
2016-04-30 13:10:28 +00:00
ASFLAGS = $(FLAGS)
CFLAGS = $(FLAGS)
CXXFLAGS = $(FLAGS) -std=c++14 -fno-rtti -fno-exceptions -fno-leading-underscore -fno-use-cxa-atexit -nostdlib -fno-builtin
2016-04-30 13:10:28 +00:00
SRCS = $(shell find -regextype egrep -regex '.*/.*\.(cpp|S|c)')
2016-04-30 13:10:28 +00:00
OBJS = $(addsuffix .o, $(notdir $(basename $(SRCS))))
2016-05-04 15:19:40 +00:00
LIBGCC = $(shell gcc -m32 -print-libgcc-file-name)
2016-05-07 17:55:59 +00:00
LIBSTD = ../stdlib/libstd.a
2016-05-04 15:19:40 +00:00
2016-04-30 13:10:28 +00:00
all: kernel-base.ker
kernel-base.ker: $(OBJS)
2016-05-07 17:55:59 +00:00
$(LD) -melf_i386 -Tlinker.ld -o kernel-base.ker $(addprefix obj/, $^) $(LIBGCC) $(LIBSTD)
2016-04-30 13:10:28 +00:00
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o obj/$@ $<
2016-04-30 13:10:28 +00:00
%.o: %.c
$(CC) $(ASFLAGS) -c -o obj/$@ $<
%.o: %.S
$(AS) $(CFLAGS) -c -o obj/$@ $<
%.o: src/%.cpp
$(CXX) $(CXXFLAGS) -c -o obj/$@ $<
2016-04-30 13:10:28 +00:00
%.o: src/%.c
$(CC) $(ASFLAGS) -c -o obj/$@ $<
%.o: src/%.S
$(AS) $(CFLAGS) -c -o obj/$@ $<
# Linux/Multiboot boot specific:
# -kernel bzImage use 'bzImage' as kernel image
# -append cmdline use 'cmdline' as kernel command line
# -initrd file use 'file' as initial ram disk
# -dtb file use 'file' as device tree image
run:
qemu-system-i386 \
-kernel kernel-base.ker \
-m 64 \
-d cpu_reset,int \
-no-reboot \
-no-shutdown \
-serial stdio \
2016-05-07 17:55:59 +00:00
-initrd ../program0/program
insight:
objdump -d kernel-base.ker | c++filt | less
bnr: kernel-base.ker run
deploy: kernel-base.ker
cp kernel-base.ker /srv/tftp/kernel-base.ker