ChrisOS Research ProjectOperating systems · language systems · graphics · machine emulation
DOCUMENTATION ARCHIVEMAIN BRANCH
ChrisOS/Source reference: chrisvm/Makefile

Source reference: chrisvm/Makefile

Deterministic source record. The complete textual file is reproduced below; this page does not replace architectural interpretation in the authored chapters.

File identity

Field Value
Path chrisvm/Makefile
Lines 67
Bytes 1985
SHA-256 0add3923d2f414ef8b36dbde56d592c5205a15245628ef9f07fd432afc7cb134
ChrisOS revision da3df29cb397932c43d32373871fb9380e688ade

Detected syntactic dependencies

Line Include
— No preprocessor include detected.

Detected symbols

Line Symbol
— No C-like function definition detected by the scanner.

Complete source

The following block is the complete textual file at the recorded revision. No lines are elided, abbreviated or paraphrased.

CC := gcc
CFLAGS := -std=c11 -Wall -Wextra -Werror -g -I.
BUILD := ../build/chrisvm

SRCS := \
    cpu/common/state.c \
    cpu/common/cpuid.c \
    cpu/common/exceptions.c \
    cpu/emulator/flags.c \
    cpu/emulator/decode.c \
    cpu/emulator/operands.c \
    cpu/emulator/execute.c \
    cpu/emulator/mmu.c \
    cpu/emulator/chriscpu.c \
    cpu/hv/chrishv.c \
    buses/io.c \
    buses/mmio.c \
    devices/serial/serial.c \
    devices/fb/fb.c \
    machine/machine.c \
    machine/boot.c \
    machine/config.c \
    debug/trace.c

OBJS := $(addprefix $(BUILD)/, $(SRCS:.c=.o))

.PHONY: all test clean

all: $(BUILD)/chrisvm $(BUILD)/arith.elf $(BUILD)/splash.elf

SDL_CFLAGS := $(shell sdl2-config --cflags 2>/dev/null)
SDL_LIBS := $(shell sdl2-config --libs 2>/dev/null)
ifneq ($(SDL_LIBS),)
CFLAGS += $(SDL_CFLAGS) -DCHRIS_HAVE_SDL
endif

$(BUILD)/chrisvm: $(OBJS) frontend/main.c frontend/view.c
    @mkdir -p $(BUILD)
    $(CC) $(CFLAGS) -o $@ frontend/main.c frontend/view.c $(OBJS) $(SDL_LIBS)

$(BUILD)/%.o: %.c
    @mkdir -p $(dir $@)
    $(CC) $(CFLAGS) -c $< -o $@

$(BUILD)/arith.elf: guests/arith.asm guests/link.ld
    @mkdir -p $(BUILD)
    nasm -f elf64 -o $(BUILD)/arith.o guests/arith.asm
    ld -nostdlib -T guests/link.ld -o $@ $(BUILD)/arith.o

$(BUILD)/splash.elf: guests/splash.asm guests/link.ld
    @mkdir -p $(BUILD)
    nasm -f elf64 -o $(BUILD)/splash.o guests/splash.asm
    ld -nostdlib -T guests/link.ld -o $@ $(BUILD)/splash.o

$(BUILD)/test_chrisvm: $(OBJS) tests/test_chrisvm.c $(BUILD)/arith.elf $(BUILD)/splash.elf
    $(CC) $(CFLAGS) -DCHRIS_GUEST=\"$(BUILD)/arith.elf\" -DCHRIS_SPLASH=\"$(BUILD)/splash.elf\" -o $@ tests/test_chrisvm.c $(OBJS)

test: $(BUILD)/test_chrisvm $(BUILD)/chrisvm $(BUILD)/arith.elf $(BUILD)/splash.elf
    $(BUILD)/test_chrisvm
    $(BUILD)/chrisvm --headless $(BUILD)/arith.elf > $(BUILD)/arith.out
    grep -q '^OK$$' $(BUILD)/arith.out
    $(BUILD)/chrisvm --headless --fb-dump=$(BUILD)/splash.png $(BUILD)/splash.elf > $(BUILD)/splash.out
    grep -q '^splash$$' $(BUILD)/splash.out

clean:
    rm -rf $(BUILD)

Role of this record

The atlas guarantees file-by-file traceability. Responsibility, invariants, ownership, concurrency, security, performance and subsystem interactions belong in authored chapters and must cite this file when applicable.

Document record ID: source-0add3923d2f414ef Reviewed source: da3df29cb397 Class: generated-source-reference