cosmopolitan/tool/hash/hash.mk
Justine Tunney 9f68d6eee9 Fix link order in cosmopolitan.a
It turned out that the linker was doing the wrong with the amalgamation
library concerning weak stubs. A regression test has been added and new
binaries have been uploaded to https://justine.lol/cosmopolitan/

Ideally this should be fixed by building a tool that turns multiple .a
files into a single .a file with deduplication. As a workaround for now
the cosmopolitan.a build is restructured to not include LIBC_STUBS which
meant technical debt needed to be paid off where non-stub interfaces
were moved to LIBC_INTRIN and LIBC_NEXGEN32E.

Thank @PerfectProductions in #31 for the report!
2021-01-16 12:05:41 -08:00

47 lines
1.1 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───────────────────────┘
PKGS += TOOL_HASH
TOOL_HASH_SRCS := $(wildcard tool/hash/*.c)
TOOL_HASH_OBJS = \
$(TOOL_HASH_SRCS:%.c=o/$(MODE)/%.o)
TOOL_HASH_COMS = \
$(TOOL_HASH_SRCS:%.c=o/$(MODE)/%.com)
TOOL_HASH_BINS = \
$(TOOL_HASH_COMS) \
$(TOOL_HASH_COMS:%=%.dbg)
TOOL_HASH_DIRECTDEPS = \
LIBC_FMT \
LIBC_INTRIN \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_STDIO \
LIBC_STR \
LIBC_STUBS
TOOL_HASH_DEPS := \
$(call uniq,$(foreach x,$(TOOL_HASH_DIRECTDEPS),$($(x))))
o/$(MODE)/tool/hash/hash.pkg: \
$(TOOL_HASH_OBJS) \
$(foreach x,$(TOOL_HASH_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/tool/hash/%.com.dbg: \
$(TOOL_HASH_DEPS) \
o/$(MODE)/tool/hash/%.o \
o/$(MODE)/tool/hash/hash.pkg \
$(CRT) \
$(APE)
@$(APELINK)
$(TOOL_HASH_OBJS): \
$(BUILD_FILES) \
tool/hash/hash.mk
.PHONY: o/$(MODE)/tool/hash
o/$(MODE)/tool/hash: $(TOOL_HASH_BINS) $(TOOL_HASH_CHECKS)