-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.sub
81 lines (71 loc) · 2.76 KB
/
Makefile.sub
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
define HELP_TEXT_JLM
echo ""
echo "JLM Make Targets"
echo "--------------------------------------------------------------------------------"
echo "jlm-debug Compile jlm libraries and tools in debug mode"
echo "jlm-release Compile jlm libraries and tools in release mode"
echo "jlm-clean Clean all build files and libraries"
echo ""
echo "jlc-debug Compile jlc compiler in debug mode"
echo "jlc-release Compile jlc compiler in release mode"
echo ""
echo "jlm-print-debug Compile jlm printer in debug mode"
echo "jlm-print-release Compile jlm printer in release mode"
echo ""
echo "jlm-opt-debug Compile jlm optimizer in debug mode"
echo "jlm-opt-release Compile jlm optimizer in release mode"
echo ""
echo "libjlm-debug Compile jlm library in debug mode"
echo "libjlm-release Compile jlm library in release mode"
endef
# Try to detect llvm-config
CONFIG := $(shell command -v llvm-config 2> /dev/null)
CONFIGVERSION := $(shell command -v llvm-config-16 2> /dev/null)
ifdef LLVMCONFIG
$(info LLVMCONFIG specified by user)
else ifdef CONFIGVERSION
$(info Found llvm-config-16)
LLVMCONFIG ?= llvm-config-16
else ifdef CONFIG
$(info Found llvm-config (make sure that it is LLVM 16))
LLVMCONFIG ?= llvm-config
else
$(info Did not find llvm-config or llvm-config-16 and LLVMCONFIG is not specified)
endif
JLM_BIN = $(JLM_ROOT)/bin
JLM_BUILD = $(JLM_ROOT)/build
# -gdwarf-4 is used since the valgrind version in Ubuntu 22.04 doesn't support dwarf-5,
# which is produced by default by clang-14
CXXFLAGS += --std=c++17 -Wall -Wpedantic -Wextra -Wno-unused-parameter -Werror -Wfatal-errors -gdwarf-4
CXXFLAGS_DEBUG += -g -DJIVE_DEBUG -DJLM_DEBUG -DJLM_ENABLE_ASSERTS
$(JLM_BUILD)/%.la: $(JLM_ROOT)/%.cpp
@mkdir -p ${dir $@}
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
$(JLM_BUILD)/%.o: $(JLM_ROOT)/%.cpp
@mkdir -p ${dir $@}
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
$(JLM_BUILD)/%.a:
rm -f $@
ar cqv $@ $^
ranlib $@
include $(JLM_ROOT)/libjive/Makefile.sub
include $(JLM_ROOT)/libjlm/Makefile.sub
include $(JLM_ROOT)/jlc/Makefile.sub
include $(JLM_ROOT)/jlm-print/Makefile.sub
include $(JLM_ROOT)/jlm-opt/Makefile.sub
include $(JLM_ROOT)/jlm-hls/Makefile.sub
include $(JLM_ROOT)/jhls/Makefile.sub
include $(JLM_ROOT)/docs/Makefile.sub
include $(JLM_ROOT)/tests/Makefile.sub
.PHONY: jlm-debug
jlm-debug: libjlm-debug jlm-print-debug jlm-opt-debug jlm-hls-debug jlc-debug jhls-debug
.PHONY: jlm-release
jlm-release: libjlm-release jlm-print-release jlm-opt-release jlm-hls-release jlc-release jhls-release
.PHONY: jlm-clean
jlm-clean:
@rm -rf $(JLM_BUILD)
@rm -rf $(JLM_BIN)
@rm -f $(JLM_ROOT)/utests.log
@rm -f $(JLM_ROOT)/ctests.log
@rm -f $(JLM_ROOT)/check.log
@rm -f $(COMMANDPATHSFILE)