/
Mmakefile
121 lines (87 loc) · 3.73 KB
/
Mmakefile
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#-----------------------------------------------------------------------------#
# Copyright (C) 1995-2002 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public Licence - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------#
# Mmake - this is Mmake file for building the Mercury deep profiler
-include Mmake.deep.params
MERCURY_DIR=..
LINK_STATIC=yes
include $(MERCURY_DIR)/Mmake.common
# Module-specific options should go in Mercury.options so they
# can be found by `mmc --make'.
include Mercury.options
ifeq ("$(ENABLE_DEEP_PROFILER)","yes")
MAIN_TARGET=mdprof_cgi mdprof_server
MERCURY_MAIN_MODULES=mdprof_cgi mdprof_server
DEPEND=mdprof_cgi.depend mdprof_server.depend
INSTALL=install_deep
else
MAIN_TARGET=nothing
MERCURY_MAIN_MODULES=
DEPEND=nothing
INSTALL=nothing
endif
# Avoid trying to make this file with `mmc --make' if it doesn't exist.
Mmake.deep.params: ;
#-----------------------------------------------------------------------------#
MLFLAGS += --shared
#-----------------------------------------------------------------------------#
.PHONY: nothing
nothing:
.PHONY: depend
depend: $(DEPEND)
.PHONY: all
all: mdprof_cgi mdprof_server
#-----------------------------------------------------------------------------#
# Add some additional dependencies, so that Mmake knows to remake the
# profiler if one of the libraries changes.
mdprof_cgi: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
mdprof_cgi: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
mdprof_server: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
mdprof_server: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
# Should also depend on $(BOEHM_GC_DIR)/libgc(_prof).$A, but only
# if in .gc(.prof) grade; GNU make does not support dynamic dependencies,
# so just leave it out.
$(cs_subdir)mdprof_cgi_init.c: $(UTIL_DIR)/mkinit
$(cs_subdir)mdprof_server_init.c: $(UTIL_DIR)/mkinit
#-----------------------------------------------------------------------------#
.PHONY: check
check: mdprof_cgi.check mdprof_server.check
.PHONY: ints
ints: mdprof_cgi.ints mdprof_server.ints
#-----------------------------------------------------------------------------#
# We need the shenanigans with .deep.tags to avoid situations in which an
# "mmake tags" in this directory does nothing even in the absence of a tags
# file in this directory, because mmake uses VPATH to find ../library/tags
# and believes it to be the tags file we are asking for.
.PHONY: tags
tags: .deep.tags
.deep.tags: $(MTAGS) $(mdprof_cgi.ms) $(mdprof_server.ms) $(LIBRARY_DIR)/*.m
$(MTAGS) $(mdprof_cgi.ms) $(mdprof_server.ms) $(LIBRARY_DIR)/*.m
touch .deep.tags
#-----------------------------------------------------------------------------#
.PHONY: dates
dates:
touch $(mdprof_cgi.dates) $(mdprof_server.dates)
#-----------------------------------------------------------------------------#
.PHONY: os cs
os: $(mdprof_cgi.os) $(os_subdir)mdprof_cgi_init.o
os: $(mdprof_server.os) $(os_subdir)mdprof_server_init.o
cs: $(mdprof_cgi.cs) $(cs_subdir)mdprof_cgi_init.c
cs: $(mdprof_server.cs) $(cs_subdir)mdprof_server_init.c
#-----------------------------------------------------------------------------#
realclean_local:
rm -f tags
#-----------------------------------------------------------------------------#
# Installation targets
.PHONY: install
install: $(INSTALL)
.PHONY: install_deep
install_deep: mdprof_cgi mdprof_server
-[ -d $(INSTALL_MERC_BIN_DIR) ] || mkdir -p $(INSTALL_MERC_BIN_DIR)
cp `vpath_find mdprof_cgi$(EXT_FOR_EXE)` \
$(INSTALL_MERC_BIN_DIR)/mdprof_cgi
cp `vpath_find mdprof_server$(EXT_FOR_EXE)`\
$(INSTALL_MERC_BIN_DIR)/mdprof_server
#-----------------------------------------------------------------------------#