Fixed build on MacOS X.
This commit is contained in:
parent
661b9ce39b
commit
6308ee1cd4
@ -919,6 +919,10 @@ The following environment variables can be used to control the build process:
|
||||
|
||||
* `CC` – specifies the C compiler (default is `cc`)
|
||||
|
||||
* `STRIP` – set to a non-zero value in order to *strip* the generated binaries
|
||||
|
||||
* `STATIC` – set to a non-zero value in order to enable *static* linking
|
||||
|
||||
* `FLTO` – set to a non-zero value in order to enable *link-time optimizer* (`-flto`)
|
||||
|
||||
* `DEBUG` – set to a non-zero value in order to enable "debug" build
|
||||
|
22
config.mk
22
config.mk
@ -11,17 +11,14 @@ ifneq ($(ASAN),)
|
||||
XLDFLAGS += -static-libasan
|
||||
else
|
||||
XCFLAGS = -Ofast -DNDEBUG
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(firstword $(filter x86_64-%,$(DUMPMACHINE))),)
|
||||
XCFLAGS += -march=x86-64 -mtune=nocona
|
||||
else ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
||||
XCFLAGS += -march=pentiumpro -mtune=intel
|
||||
endif
|
||||
ifneq ($(FLTO),)
|
||||
XCFLAGS += -flto
|
||||
endif
|
||||
XLDFLAGS += -s -static
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(firstword $(filter %-mingw32 %-windows-gnu %-cygwin,$(DUMPMACHINE))),)
|
||||
DLL_LDFLAGS = -shared
|
||||
@ -34,3 +31,16 @@ ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
||||
XLDFLAGS += -Wl,--large-address-aware
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(STATIC),)
|
||||
XLDFLAGS += -static
|
||||
endif
|
||||
|
||||
ifneq ($(FLTO),)
|
||||
XCFLAGS += -flto
|
||||
endif
|
||||
|
||||
ifneq ($(STRIP),)
|
||||
XLDFLAGS += -Wl,--strip-all
|
||||
DLL_LDFLAGS += -Wl,--strip-all
|
||||
endif
|
||||
|
@ -7,8 +7,7 @@ cp -rfv "libhashset/include/"*.h "out/_next/include"
|
||||
|
||||
target="$(gcc -dumpmachine)"
|
||||
echo -e "--------------------------------\n${target}\n--------------------------------"
|
||||
make CC="gcc" clean
|
||||
make CC="gcc"
|
||||
make CC="gcc" STATIC=1 STRIP=1
|
||||
rm -rf "out/_next/lib/${target}" "out/_next/bin/${target}"
|
||||
mkdir -pv "out/_next/lib/${target}" "out/_next/bin/${target}"
|
||||
cp -rv "libhashset/lib/"* "out/_next/lib/${target}"
|
||||
|
@ -18,8 +18,7 @@ case "${mode}" in
|
||||
compiler="${target}-linux-gnu-gcc"
|
||||
target="$("${compiler}" -dumpmachine)"
|
||||
echo -e "--------------------------------\n${target}\n--------------------------------"
|
||||
make CC="${compiler}" clean
|
||||
make CC="${compiler}"
|
||||
make CC="${compiler}" STRIP=1
|
||||
mkdir -pv "out/lib/${target}" "out/bin/${target}"
|
||||
cp -rv "libhashset/lib/"* "out/lib/${target}"
|
||||
for i in example test; do
|
||||
@ -34,8 +33,7 @@ case "${mode}" in
|
||||
compiler="/usr/local/musl/${target}/bin/musl-gcc"
|
||||
target="$("${compiler}" -dumpmachine | sed 's/-gnu/-musl/i')"
|
||||
echo -e "--------------------------------\n${target}\n--------------------------------"
|
||||
make CC="${compiler}" clean
|
||||
make CC="${compiler}"
|
||||
make CC="${compiler}" STATIC=1 STRIP=1
|
||||
mkdir -pv "out/lib/${target}" "out/bin/${target}"
|
||||
cp -rv "libhashset/lib/"* "out/lib/${target}"
|
||||
for i in example test; do
|
||||
|
@ -8,6 +8,9 @@
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
# if defined(__APPLE__) && defined(__MACH__)
|
||||
# include <sys/random.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define ARRAY_SIZE(X) (sizeof(X) / sizeof((X)[0U]))
|
||||
|
Loading…
Reference in New Issue
Block a user