-
Notifications
You must be signed in to change notification settings - Fork 0
/
Make.common
56 lines (40 loc) · 1.49 KB
/
Make.common
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
#where-am-i = $(shell dirname $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) | sed -e 's/^.\+\/\//\//g')
# Mercury grade we want to compile to (asm_fast leads to segfaults caused by addresses not mapped to objects)
GRADE = hlc.par.gc
#GRADE = hlc.par.gc.prof
#GRADE = asm_fast.par.gc
LINKAGE = shared
# LINKAGE = static
# Name or path to the mercury compiler
MERCURY_INST = $(shell dirname $(shell which mmc))/..
MERCURY_SRC = $(MERCURY_INST)/..
MMC = mmc
# We install to the directory of Make.common.
# Since the Makefiles are in sub-directories, we need to append `..'.
INSTALL_PREFIX = $(CURDIR)/..
LIB_DIR = $(INSTALL_PREFIX)/lib/mercury
OPTIMIZATION = -O6 --optimize-duplicate-calls --optimize-unused-args --type-specialization --user-guided-type-specialization
#OPTIMIZATION += --profiling
LIB_FILE = $(LIB_DIR)/lib/$(GRADE)/lib$(GOAL).so
LIB_MCFLAGS += -E $(OPTIMIZATION) --no-libgrade --libgrade $(GRADE) --grade $(GRADE) --mercury-linkage $(LINKAGE) --install-prefix=$(INSTALL_PREFIX) --mld $(LIB_DIR)
EXE_FILE = $(GOAL)
EXE_MCFLAGS += -E $(OPTIMIZATION) --grade $(GRADE) --mercury-linkage $(LINKAGE) --mld $(LIB_DIR)
lib: $(LIB_FILE)
$(LIB_FILE): $(SOURCE_FILES)
$(MMC) --make $(LIB_MCFLAGS) lib$(GOAL).install
exe: $(EXE_FILE)
$(EXE_FILE): $(SOURCE_FILES)
$(MMC) --make $(EXE_MCFLAGS) $(GOAL)
clean:
rm -rf Mercury
rm -f *.o
rm -f *.a
rm -f *.so
rm -f *.mh
rm -f *.err
rm -f *.init
rm -f $(EXE_FILE)
rm -f $(LIB_FILE)
.mercury-depend:
make -C .. depend
include .mercury-depend