old-DasOS/prototypes/base/Makefile

55 lines
1.3 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-06 18:04:25 +00:00
FLAGS = -DIDT_DISPATCH=$(IDT_DISPATCH) -ffreestanding -m32 -Werror -Wall -iquote include -iquote lists -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-04-30 13:10:28 +00:00
all: kernel-base.ker
kernel-base.ker: $(OBJS)
2016-05-04 15:19:40 +00:00
$(LD) -melf_i386 -Tlinker.ld -o kernel-base.ker $(addprefix obj/, $^) $(LIBGCC)
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:
2016-05-06 07:28:30 +00:00
qemu-system-i386 -kernel kernel-base.ker -m 64
bnr: kernel-base.ker run
deploy: kernel-base.ker
cp kernel-base.ker /srv/tftp/kernel-base.ker