mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
stdbuf: build shared library on Macs
This commit is contained in:
parent
de07c6218b
commit
8c846e2aa9
1 changed files with 9 additions and 5 deletions
|
@ -7,12 +7,16 @@ RUSTC ?= rustc
|
|||
SYSTEM := $(shell uname)
|
||||
DYLIB_EXT :=
|
||||
ifeq ($(SYSTEM),Linux)
|
||||
DYLIB_EXT := so
|
||||
DYLIB_FLAGS := -shared
|
||||
DYLIB_EXT := so
|
||||
DYLIB_FLAGS := -shared
|
||||
DYLIB_LINK_START := -Wl,--whole-archive
|
||||
DYLIB_LINK_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
ifeq ($(SYSTEM),Darwin)
|
||||
DYLIB_EXT := dylib
|
||||
DYLIB_FLAGS := -dynamiclib -undefined dynamic_lookup
|
||||
DYLIB_EXT := dylib
|
||||
DYLIB_FLAGS := -dynamiclib -undefined dynamic_lookup
|
||||
DYLIB_LINK_START := -Wl,-all_load
|
||||
DYLIB_LINK_END := -Wl,-noall_load
|
||||
endif
|
||||
|
||||
all: $(BUILDDIR)/libstdbuf.$(DYLIB_EXT)
|
||||
|
@ -23,5 +27,5 @@ $(BUILDDIR):
|
|||
$(BUILDDIR)/libstdbuf.$(DYLIB_EXT): build.rs libstdbuf/libstdbuf.rs libstdbuf.c libstdbuf.h | $(BUILDDIR)
|
||||
cp $(BUILDDIR)/../../../deps/liblibstdbuf-*.a $(BUILDDIR)/liblibstdbuf.a && \
|
||||
$(CC) -c -Wall -Werror -fPIC libstdbuf.c -o $(BUILDDIR)/libstdbuf.o && \
|
||||
$(CC) $(DYLIB_FLAGS) -o $@ $(BUILDDIR)/libstdbuf.o -Wl,--whole-archive $(BUILDDIR)/liblibstdbuf.a -Wl,--no-whole-archive
|
||||
$(CC) $(DYLIB_FLAGS) -o $@ $(BUILDDIR)/libstdbuf.o $(DYLIB_LINK_START) $(BUILDDIR)/liblibstdbuf.a $(DYLIB_LINK_END)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue