1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-28 19:04:27 +03:00
mold/Makefile

42 lines
1.2 KiB
Makefile
Raw Normal View History

2020-10-04 12:00:33 +03:00
CC=clang
CXX=clang++
2020-10-02 07:28:26 +03:00
LLVM_CONFIG=llvm-project/build/bin/llvm-config
LLVM_TBLGEN=llvm-project/build/bin/llvm-tblgen
2020-10-10 06:47:12 +03:00
LLVM_LIBS=$(wildcard llvm-project/build/lib/libLLVM*.a)
2020-09-29 09:05:29 +03:00
2020-10-09 14:47:45 +03:00
CURRENT_DIR=$(shell pwd)
TBB_LIBDIR=$(wildcard $(CURRENT_DIR)/oneTBB/build/linux_intel64_*_release/)
2020-11-06 02:49:41 +03:00
CPPFLAGS=-g $(shell $(LLVM_CONFIG) --cxxflags) -IoneTBB/include -pthread -std=c++17 -O2
2020-10-22 16:59:00 +03:00
LDFLAGS=$(shell $(LLVM_CONFIG) --ldflags) -L$(TBB_LIBDIR) -Wl,-rpath=$(TBB_LIBDIR) -fuse-ld=lld
LIBS=-pthread -ltbb -lcurses -Wl,--start-group $(LLVM_LIBS) -Wl,--end-group
2020-11-03 11:26:42 +03:00
OBJS=main.o object_file.o input_sections.o output_chunks.o mapfile.o perf.o
2020-10-02 07:28:26 +03:00
2020-10-20 08:54:35 +03:00
mold: $(OBJS)
2020-10-23 06:09:27 +03:00
@$(CXX) $(CFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LIBS)
2020-10-02 07:28:26 +03:00
2020-10-20 08:54:35 +03:00
$(OBJS): mold.h Makefile
2020-10-08 11:01:54 +03:00
2020-11-03 15:19:05 +03:00
main.o: options.inc
2020-10-02 07:28:26 +03:00
options.inc: options.td
$(LLVM_TBLGEN) -I=llvm-project/llvm/include --gen-opt-parser-defs -o $@ $^
2020-09-29 09:05:29 +03:00
submodules: llvm intel_tbb
llvm:
mkdir -p llvm-project/build
2020-10-24 09:59:38 +03:00
(cd llvm-project/build; cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS='lld;clang' -DLLVM_ENABLE_LLD=1 ../llvm)
2020-09-29 09:05:29 +03:00
ninja -C llvm-project/build
intel_tbb:
$(MAKE) -C oneTBB
2020-10-20 08:54:35 +03:00
test: mold
2020-09-29 09:05:29 +03:00
./llvm-project/build/bin/llvm-lit test
clean:
2020-10-20 08:54:35 +03:00
rm -f *.o *~ mold options.inc
2020-09-29 09:05:29 +03:00
.PHONY: llvm intel_tbb test clean