mirror of
https://github.com/rui314/mold.git
synced 2024-09-21 09:57:18 +03:00
Import xxhash library to third-party for ease of building
In some environment, XXH3 isn't available as a binary package. If you do not like to use the imported xxhash library but instead link to system's libxxhash.so, invoke make with `SYSTEM_XXHASH=1`.
This commit is contained in:
parent
65dc32fdb8
commit
665bffa52f
16
Makefile
16
Makefile
@ -26,7 +26,7 @@ CFLAGS += $(COMMON_FLAGS)
|
|||||||
CXXFLAGS ?= -O2
|
CXXFLAGS ?= -O2
|
||||||
CXXFLAGS += $(COMMON_FLAGS) -std=c++20 -fno-exceptions
|
CXXFLAGS += $(COMMON_FLAGS) -std=c++20 -fno-exceptions
|
||||||
CPPFLAGS += -DMOLD_VERSION=\"1.0.0\" -DLIBDIR="\"$(LIBDIR)\""
|
CPPFLAGS += -DMOLD_VERSION=\"1.0.0\" -DLIBDIR="\"$(LIBDIR)\""
|
||||||
LIBS = -pthread -lz -lxxhash -ldl -lm
|
LIBS = -pthread -lz -ldl -lm
|
||||||
|
|
||||||
SRCS=$(wildcard *.cc elf/*.cc macho/*.cc)
|
SRCS=$(wildcard *.cc elf/*.cc macho/*.cc)
|
||||||
HEADERS=$(wildcard *.h elf/*.h macho/*.h)
|
HEADERS=$(wildcard *.h elf/*.h macho/*.h)
|
||||||
@ -85,6 +85,14 @@ else
|
|||||||
CPPFLAGS += -Ithird-party/tbb/include
|
CPPFLAGS += -Ithird-party/tbb/include
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef SYSTEM_XXHASH
|
||||||
|
LIBS += -lxxhash
|
||||||
|
else
|
||||||
|
XXHASH_LIB = third-party/xxhash/libxxhash.a
|
||||||
|
LIBS += $(XXHASH_LIB)
|
||||||
|
CPPFLAGS += -Ithird-party/xxhash
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(OS), Linux)
|
ifeq ($(OS), Linux)
|
||||||
# glibc versions before 2.17 need librt for clock_gettime
|
# glibc versions before 2.17 need librt for clock_gettime
|
||||||
LIBS += -lrt
|
LIBS += -lrt
|
||||||
@ -96,7 +104,7 @@ endif
|
|||||||
|
|
||||||
all: mold mold-wrapper.so
|
all: mold mold-wrapper.so
|
||||||
|
|
||||||
mold: $(OBJS) $(MIMALLOC_LIB) $(TBB_LIB)
|
mold: $(OBJS) $(MIMALLOC_LIB) $(TBB_LIB) $(XXHASH_LIB)
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(LIBS)
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(LIBS)
|
||||||
ln -sf mold ld
|
ln -sf mold ld
|
||||||
ln -sf mold ld64.mold
|
ln -sf mold ld64.mold
|
||||||
@ -126,6 +134,9 @@ $(TBB_LIB):
|
|||||||
$(MAKE) -C out/tbb tbb
|
$(MAKE) -C out/tbb tbb
|
||||||
(cd out/tbb; ln -sf *_relwithdebinfo libs)
|
(cd out/tbb; ln -sf *_relwithdebinfo libs)
|
||||||
|
|
||||||
|
$(XXHASH_LIB):
|
||||||
|
$(MAKE) -C third-party/xxhash libxxhash.a
|
||||||
|
|
||||||
ifeq ($(OS), Darwin)
|
ifeq ($(OS), Darwin)
|
||||||
test tests check: all
|
test tests check: all
|
||||||
$(MAKE) -C test -f Makefile.darwin --no-print-directory
|
$(MAKE) -C test -f Makefile.darwin --no-print-directory
|
||||||
@ -156,5 +167,6 @@ uninstall:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *~ mold mold-wrapper.so out ld ld64.mold
|
rm -rf *~ mold mold-wrapper.so out ld ld64.mold
|
||||||
|
$(MAKE) -C third-party/xxhash clean
|
||||||
|
|
||||||
.PHONY: all test tests check clean
|
.PHONY: all test tests check clean
|
||||||
|
Loading…
Reference in New Issue
Block a user