diff --git a/Makefile b/Makefile index 9a4e1416..11b0fc1b 100644 --- a/Makefile +++ b/Makefile @@ -10,8 +10,8 @@ CPPFLAGS=-g -IoneTBB/include -IxxHash -pthread -std=c++20 \ -DGIT_HASH=\"$(shell git rev-parse HEAD)\" LDFLAGS=-L$(TBB_LIBDIR) -Wl,-rpath=$(TBB_LIBDIR) \ -L$(MALLOC_LIBDIR) -Wl,-rpath=$(MALLOC_LIBDIR) \ - -L$(CURRENT_DIR)/xxHash -LIBS=-lcrypto -pthread -ltbb -lmimalloc -lz xxHash/libxxhash.a + -L$(CURRENT_DIR)/xxHash -Wl,-rpath=$(CURRENT_DIR)/xxHash +LIBS=-lcrypto -pthread -ltbb -lmimalloc -lz -lxxhash -ldl OBJS=main.o object_file.o input_sections.o output_chunks.o mapfile.o perf.o \ linker_script.o archive_file.o output_file.o subprocess.o gc_sections.o \ icf.o symbols.o cmdline.o filepath.o glob.o passes.o arch_x86_64.o \ @@ -24,6 +24,11 @@ else CPPFLAGS += -O2 endif +STATIC ?= 0 +ifeq ($(STATIC), 1) + LDFLAGS += -static +endif + all: mold mold-wrapper.so mold: $(OBJS) @@ -36,8 +41,9 @@ $(OBJS): mold.h elf.h Makefile submodules: $(MAKE) -C oneTBB + $(MAKE) -C oneTBB extra_inc=big_iron.inc mkdir -p mimalloc/out/release - (cd mimalloc/out/release; cmake ../..) + (cd mimalloc/out/release; CFLAGS=-DMI_USE_ENVIRON=0 cmake ../..) $(MAKE) -C mimalloc/out/release $(MAKE) -C xxHash