cosmopolitan/test/libc/xed/test.mk
Justine Tunney f4f4caab0e Add x86_64-linux-gnu emulator
I wanted a tiny scriptable meltdown proof way to run userspace programs
and visualize how program execution impacts memory. It helps to explain
how things like Actually Portable Executable works. It can show you how
the GCC generated code is going about manipulating matrices and more. I
didn't feel fully comfortable with Qemu and Bochs because I'm not smart
enough to understand them. I wanted something like gVisor but with much
stronger levels of assurances. I wanted a single binary that'll run, on
all major operating systems with an embedded GPL barrier ZIP filesystem
that is tiny enough to transpile to JavaScript and run in browsers too.

https://justine.storage.googleapis.com/emulator625.mp4
2020-08-25 04:43:42 -07:00

104 lines
3.3 KiB
Makefile

#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
TEST_LIBC_XED_FILES := $(wildcard test/libc/xed/*)
TEST_LIBC_XED_HDRS = $(filter %.h,$(TEST_LIBC_XED_FILES))
#───────────────────────────────────────────────────────────────────────────────
PKGS += TEST_LIBC_XED_TESTLIB
TEST_LIBC_XED_TESTLIB_SRCS = \
$(TEST_LIBC_XED_TESTLIB_A_SRCS)
TEST_LIBC_XED_TESTLIB_OBJS = \
$(TEST_LIBC_XED_TESTLIB_A_OBJS)
TEST_LIBC_XED_TESTLIB = \
$(TEST_LIBC_XED_TESTLIB_A_DEPS) \
$(TEST_LIBC_XED_TESTLIB_A)
TEST_LIBC_XED_TESTLIB_A = o/$(MODE)/test/libc/xed/testlib.a
TEST_LIBC_XED_TESTLIB_A_SRCS = $(filter %_lib.c,$(TEST_LIBC_XED_FILES))
TEST_LIBC_XED_TESTLIB_A_OBJS = \
$(TEST_LIBC_XED_TESTLIB_A_SRCS:%=o/$(MODE)/%.zip.o) \
$(TEST_LIBC_XED_TESTLIB_A_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_XED_TESTLIB_A_DIRECTDEPS = \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_STUBS \
LIBC_TESTLIB \
LIBC_X \
THIRD_PARTY_XED
TEST_LIBC_XED_TESTLIB_A_DEPS := \
$(call uniq,$(foreach x,$(TEST_LIBC_XED_TESTLIB_A_DIRECTDEPS),$($(x))))
$(TEST_LIBC_XED_TESTLIB_A).pkg: \
$(TEST_LIBC_XED_TESTLIB_A_OBJS) \
$(foreach x,$(TEST_LIBC_XED_TESTLIB_A_DIRECTDEPS),$($(x)_A).pkg)
$(TEST_LIBC_XED_TESTLIB_A): \
test/libc/xed/ \
$(TEST_LIBC_XED_TESTLIB_A).pkg \
$(TEST_LIBC_XED_TESTLIB_A_OBJS)
#───────────────────────────────────────────────────────────────────────────────
PKGS += TEST_LIBC_XED
TEST_LIBC_XED_SRCS = $(filter %_test.c,$(TEST_LIBC_XED_FILES))
TEST_LIBC_XED_OBJS = \
$(TEST_LIBC_XED_SRCS:%=o/$(MODE)/%.zip.o) \
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_XED_COMS = \
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.com)
TEST_LIBC_XED_BINS = \
$(TEST_LIBC_XED_COMS) \
$(TEST_LIBC_XED_COMS:%=%.dbg)
TEST_LIBC_XED_TESTS = \
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.com.ok)
TEST_LIBC_XED_CHECKS = \
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.com.runs)
TEST_LIBC_XED_DIRECTDEPS = \
LIBC_CALLS_HEFTY \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_RUNTIME \
LIBC_STUBS \
LIBC_TESTLIB \
TEST_LIBC_XED_TESTLIB \
THIRD_PARTY_XED
TEST_LIBC_XED_DEPS := \
$(call uniq,$(foreach x,$(TEST_LIBC_XED_DIRECTDEPS),$($(x))))
o/$(MODE)/test/libc/xed/xed.pkg: \
$(TEST_LIBC_XED_OBJS) \
$(foreach x,$(TEST_LIBC_XED_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/xed/%.com.dbg: \
$(TEST_LIBC_XED_DEPS) \
o/$(MODE)/test/libc/xed/%.o \
o/$(MODE)/test/libc/xed/xed.pkg \
$(LIBC_TESTMAIN) \
$(CRT) \
$(APE)
@$(APELINK)
#───────────────────────────────────────────────────────────────────────────────
.PHONY: o/$(MODE)/test/libc/xed
o/$(MODE)/test/libc/xed: \
$(TEST_LIBC_XED_BINS) \
$(TEST_LIBC_XED_CHECKS)