2020-06-15 14:18:57 +00:00
|
|
|
#-*-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───────────────────────┘
|
|
|
|
|
|
|
|
PKGS += TOOL_BUILD
|
|
|
|
|
|
|
|
TOOL_BUILD_FILES := $(wildcard tool/build/*)
|
|
|
|
TOOL_BUILD_SRCS = $(filter %.c,$(TOOL_BUILD_FILES))
|
|
|
|
TOOL_BUILD_HDRS = $(filter %.h,$(TOOL_BUILD_FILES))
|
2020-07-01 02:57:27 +00:00
|
|
|
TOOL_BUILD_CTESTS = $(filter %.ctest,$(TOOL_BUILD_FILES))
|
2022-08-11 01:00:45 +00:00
|
|
|
|
|
|
|
TOOL_BUILD_BINS = \
|
|
|
|
$(TOOL_BUILD_COMS) \
|
|
|
|
$(TOOL_BUILD_COMS:%=%.dbg) \
|
|
|
|
o/$(MODE)/tool/build/mkdir \
|
|
|
|
o/$(MODE)/tool/build/chmod \
|
|
|
|
o/$(MODE)/tool/build/cp \
|
|
|
|
o/$(MODE)/tool/build/mv \
|
|
|
|
o/$(MODE)/tool/build/echo \
|
|
|
|
o/$(MODE)/tool/build/gzip \
|
|
|
|
o/$(MODE)/tool/build/printf \
|
|
|
|
o/$(MODE)/tool/build/dd
|
|
|
|
|
2020-08-25 11:23:25 +00:00
|
|
|
TOOL_BUILD_CALCULATOR = o/$(MODE)/tool/build/calculator.com
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2020-07-01 02:57:27 +00:00
|
|
|
TOOL_BUILD_OBJS = \
|
2020-06-15 14:18:57 +00:00
|
|
|
$(TOOL_BUILD_SRCS:%.c=o/$(MODE)/%.o)
|
|
|
|
|
2020-08-25 11:23:25 +00:00
|
|
|
TOOL_BUILD_COMS = \
|
|
|
|
$(TOOL_BUILD_SRCS:%.c=o/$(MODE)/%.com)
|
|
|
|
|
2020-07-01 02:57:27 +00:00
|
|
|
TOOL_BUILD_CHECKS = \
|
|
|
|
$(TOOL_BUILD).pkg \
|
|
|
|
$(TOOL_BUILD_HDRS:%=o/$(MODE)/%.ok) \
|
|
|
|
$(TOOL_BUILD_CTESTS:%=o/$(MODE)/%.ok)
|
|
|
|
|
|
|
|
TOOL_BUILD_DIRECTDEPS = \
|
|
|
|
DSP_CORE \
|
|
|
|
DSP_SCALE \
|
|
|
|
DSP_TTY \
|
|
|
|
LIBC_CALLS \
|
|
|
|
LIBC_DNS \
|
|
|
|
LIBC_ELF \
|
|
|
|
LIBC_FMT \
|
2020-10-29 11:53:20 +00:00
|
|
|
LIBC_INTRIN \
|
2020-07-01 02:57:27 +00:00
|
|
|
LIBC_LOG \
|
|
|
|
LIBC_MEM \
|
|
|
|
LIBC_NEXGEN32E \
|
2021-01-25 21:08:05 +00:00
|
|
|
LIBC_NT_KERNEL32 \
|
2020-11-13 09:27:49 +00:00
|
|
|
LIBC_NT_USER32 \
|
2021-08-14 13:17:56 +00:00
|
|
|
LIBC_NT_WS2_32 \
|
2020-07-01 02:57:27 +00:00
|
|
|
LIBC_RUNTIME \
|
|
|
|
LIBC_SOCK \
|
|
|
|
LIBC_STDIO \
|
|
|
|
LIBC_STR \
|
|
|
|
LIBC_STUBS \
|
|
|
|
LIBC_SYSV \
|
|
|
|
LIBC_SYSV_CALLS \
|
2022-07-10 11:01:17 +00:00
|
|
|
LIBC_THREAD \
|
2022-07-14 03:55:27 +00:00
|
|
|
LIBC_TIME \
|
2020-12-09 23:04:54 +00:00
|
|
|
LIBC_TINYMATH \
|
2020-07-01 02:57:27 +00:00
|
|
|
LIBC_X \
|
2022-03-23 13:31:55 +00:00
|
|
|
LIBC_ZIPOS \
|
2021-08-14 13:17:56 +00:00
|
|
|
NET_HTTPS \
|
2020-07-01 02:57:27 +00:00
|
|
|
THIRD_PARTY_COMPILER_RT \
|
2020-12-05 20:20:41 +00:00
|
|
|
THIRD_PARTY_GDTOA \
|
2020-07-01 02:57:27 +00:00
|
|
|
THIRD_PARTY_GETOPT \
|
2021-08-14 13:17:56 +00:00
|
|
|
THIRD_PARTY_MBEDTLS \
|
2022-05-25 18:31:08 +00:00
|
|
|
THIRD_PARTY_MUSL \
|
2022-07-14 03:55:27 +00:00
|
|
|
THIRD_PARTY_REGEX \
|
2021-01-16 20:05:41 +00:00
|
|
|
THIRD_PARTY_STB \
|
2020-07-01 02:57:27 +00:00
|
|
|
THIRD_PARTY_XED \
|
|
|
|
THIRD_PARTY_ZLIB \
|
2022-05-25 18:31:08 +00:00
|
|
|
THIRD_PARTY_ZLIB_GZ \
|
2021-01-16 20:05:41 +00:00
|
|
|
TOOL_BUILD_LIB
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2020-07-01 02:57:27 +00:00
|
|
|
TOOL_BUILD_DEPS := \
|
2020-06-15 14:18:57 +00:00
|
|
|
$(call uniq,$(foreach x,$(TOOL_BUILD_DIRECTDEPS),$($(x))))
|
|
|
|
|
2020-07-01 02:57:27 +00:00
|
|
|
o/$(MODE)/tool/build/build.pkg: \
|
|
|
|
$(TOOL_BUILD_OBJS) \
|
2020-06-15 14:18:57 +00:00
|
|
|
$(foreach x,$(TOOL_BUILD_DIRECTDEPS),$($(x)_A).pkg)
|
|
|
|
|
2020-08-25 11:23:25 +00:00
|
|
|
o/$(MODE)/%.ctest.ok: \
|
|
|
|
%.ctest \
|
|
|
|
$(TOOL_BUILD_CALCULATOR)
|
2022-08-11 05:08:43 +00:00
|
|
|
@$(COMPILE) -AMKWIDES -wtT$@ $(TOOL_BUILD_CALCULATOR) $<
|
2020-08-25 11:23:25 +00:00
|
|
|
|
2020-07-01 02:57:27 +00:00
|
|
|
o/$(MODE)/tool/build/%.com.dbg: \
|
|
|
|
$(TOOL_BUILD_DEPS) \
|
|
|
|
o/$(MODE)/tool/build/build.pkg \
|
|
|
|
o/$(MODE)/tool/build/%.o \
|
|
|
|
$(CRT) \
|
2022-05-25 18:31:08 +00:00
|
|
|
$(APE_NO_MODIFY_SELF)
|
2022-03-23 13:31:55 +00:00
|
|
|
@$(APELINK)
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2022-08-21 07:17:20 +00:00
|
|
|
o/$(MODE)/tool/build/blinkenlights.com: \
|
|
|
|
o/$(MODE)/tool/build/blinkenlights.com.dbg \
|
|
|
|
o/$(MODE)/third_party/zip/zip.com \
|
|
|
|
o/$(MODE)/tool/build/symtab.com
|
|
|
|
@$(MAKE_OBJCOPY)
|
|
|
|
@$(MAKE_SYMTAB_CREATE)
|
|
|
|
@$(MAKE_SYMTAB_ZIP)
|
|
|
|
|
2022-08-11 01:00:45 +00:00
|
|
|
o/$(MODE)/tool/build/emulator.o: private \
|
2020-07-01 02:57:27 +00:00
|
|
|
OVERRIDE_COPTS += \
|
2020-08-25 11:23:25 +00:00
|
|
|
-fno-sanitize=pointer-overflow
|
2020-07-01 02:57:27 +00:00
|
|
|
|
2022-08-11 01:00:45 +00:00
|
|
|
o/$(MODE)/tool/build/dso/sandbox.so.zip.o \
|
|
|
|
o/$(MODE)/tool/build/mkdir.zip.o \
|
|
|
|
o/$(MODE)/tool/build/chmod.zip.o \
|
|
|
|
o/$(MODE)/tool/build/cp.zip.o \
|
|
|
|
o/$(MODE)/tool/build/mv.zip.o \
|
|
|
|
o/$(MODE)/tool/build/echo.zip.o \
|
|
|
|
o/$(MODE)/tool/build/gzip.zip.o \
|
|
|
|
o/$(MODE)/tool/build/printf.zip.o \
|
|
|
|
o/$(MODE)/tool/build/dd.zip.o: private \
|
|
|
|
ZIPOBJ_FLAGS += \
|
|
|
|
-B
|
2022-07-21 16:16:38 +00:00
|
|
|
|
2022-08-08 18:41:08 +00:00
|
|
|
# we need pic because:
|
|
|
|
# so it can be an LD_PRELOAD payload
|
2022-08-11 01:00:45 +00:00
|
|
|
o/$(MODE)/tool/build/dso/sandbox.o: private \
|
2022-08-08 18:41:08 +00:00
|
|
|
OVERRIDE_CFLAGS += \
|
|
|
|
-fPIC
|
|
|
|
|
2022-08-09 04:23:37 +00:00
|
|
|
o/$(MODE)/tool/build/dso/sandbox.o: \
|
|
|
|
libc/calls/calls.h \
|
|
|
|
tool/build/dso/sandbox.c \
|
|
|
|
libc/calls/pledge.h \
|
|
|
|
libc/runtime/runtime.h \
|
|
|
|
libc/calls/pledge.internal.h \
|
|
|
|
libc/intrin/promises.internal.h \
|
|
|
|
tool/build/build.mk
|
|
|
|
|
|
|
|
o/$(MODE)/tool/build/dso/sandbox.so: \
|
|
|
|
o/$(MODE)/tool/build/dso/sandbox.o \
|
2022-08-08 18:41:08 +00:00
|
|
|
o/$(MODE)/libc/calls/pledge-linux.o \
|
|
|
|
o/$(MODE)/libc/sysv/restorert.o
|
2022-08-11 01:00:45 +00:00
|
|
|
@$(COMPILE) -ALINK.so \
|
|
|
|
$(CC) \
|
|
|
|
-s \
|
2022-08-08 18:41:08 +00:00
|
|
|
-shared \
|
|
|
|
-nostdlib \
|
|
|
|
-Wl,--gc-sections \
|
2022-08-09 04:23:37 +00:00
|
|
|
o/$(MODE)/tool/build/dso/sandbox.o \
|
|
|
|
o/$(MODE)/libc/calls/pledge-linux.o \
|
|
|
|
o/$(MODE)/libc/sysv/restorert.o \
|
2022-08-08 18:41:08 +00:00
|
|
|
$(OUTPUT_OPTION)
|
|
|
|
|
2022-08-09 04:23:37 +00:00
|
|
|
o/$(MODE)/tool/build/pledge.com.dbg: \
|
|
|
|
$(TOOL_BUILD_DEPS) \
|
|
|
|
o/$(MODE)/tool/build/build.pkg \
|
|
|
|
o/$(MODE)/tool/build/dso/sandbox.so.zip.o \
|
|
|
|
o/$(MODE)/tool/build/pledge.o \
|
|
|
|
$(CRT) \
|
|
|
|
$(APE_NO_MODIFY_SELF)
|
|
|
|
@$(APELINK)
|
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
.PHONY: o/$(MODE)/tool/build
|
2020-07-01 02:57:27 +00:00
|
|
|
o/$(MODE)/tool/build: \
|
2020-08-25 11:23:25 +00:00
|
|
|
o/$(MODE)/tool/build/emucrt \
|
|
|
|
o/$(MODE)/tool/build/emubin \
|
2020-07-01 02:57:27 +00:00
|
|
|
o/$(MODE)/tool/build/lib \
|
|
|
|
$(TOOL_BUILD_BINS) \
|
2020-06-15 14:18:57 +00:00
|
|
|
$(TOOL_BUILD_CHECKS)
|