File: Mmakefile

package info (click to toggle)
mercury 0.10.1-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 21,984 kB
  • ctags: 11,923
  • sloc: objc: 187,634; ansic: 66,107; sh: 7,570; lisp: 1,568; cpp: 1,337; makefile: 614; perl: 511; awk: 274; asm: 252; exp: 32; xml: 12; fortran: 3; csh: 1
file content (208 lines) | stat: -rw-r--r-- 5,932 bytes parent folder | download
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#-----------------------------------------------------------------------------#
# Copyright (C) 1998-2001 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------#

# browser/Mmakefile - this is the Mmakefile for building the Mercury
# browser library, which also includes other functionality needed
# by Mercury debuggers.

# Since the code in this directory is intended to be invoked only from
# the trace library, which turns off tracing in the Mercury code it calls,
# compiling the modules in this directory with tracing on only makes
# the generated code much bigger. However, since all Mercury code
# in an executable must be of the same grade, we need to be able to
# compile the modules in this directory in debug grades as well.

MERCURY_DIR=..
include $(MERCURY_DIR)/Mmake.common

MAIN_TARGET=library

VPATH=$(LIBRARY_DIR)

#-----------------------------------------------------------------------------#

# If we're going to generate both `.o' files and `.pic_o' files, then
# don't remove the intermediate `.c' files.
RM_C	=	$(LIBRARY_RM_C)

#-----------------------------------------------------------------------------#

# Specify which compilers to use to compile the library.
# Don't change these without good reason - if you want to
# do a temporary change, change ../Mmake.params.

M_ENV	=	MERCURY_INT_DIR=$(LIBRARY_DIR) \
		MERCURY_ALL_C_INCL_DIRS="\
			-I$(TRACE_DIR) \
			-I$(LIBRARY_DIR) \
			-I$(RUNTIME_DIR) \
			-I$(BOEHM_GC_DIR) \
			-I$(BOEHM_GC_DIR)/include \
		"

MCD	=	$(M_ENV) $(MC) --generate-dependencies
MCI	=	$(M_ENV) $(MC) --make-interface
MCPI	=	$(M_ENV) $(MC) --make-private-interface
MCSI	=	$(M_ENV) $(MC) --make-short-interface
MCOI	=	$(M_ENV) $(MC) --make-opt-int
MCTOI	=	$(M_ENV) $(MC) --make-trans-opt
MCG	=	$(M_ENV) $(MC) --compile-to-c
MCS	=	$(M_ENV) $(MC) --split-c-files -c --cflags "$(ALL_CFLAGS)"
MGNUC	=	$(M_ENV) $(SCRIPTS_DIR)/mgnuc
MGNUCFLAGS =	$(DLL_CFLAGS)
LDFLAGS	=	-L$(LIBRARY_DIR) -L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR)
LDLIBS	=	-l$(STD_LIB_NAME) -l$(RT_LIB_NAME) \
		` case "$(GRADE)" in 					\
		    *.par*.gc*.prof*)	echo "-lpar_gc_prof" ;;		\
		    *.par*.gc*)		echo "-lpar_gc" ;;		\
		    *.gc*.prof*)	echo "-lgc_prof" ;;		\
		    *.gc*)		echo "-lgc" ;;			\
		  esac							\
		`

MTAGS	=	$(SCRIPTS_DIR)/mtags

#-----------------------------------------------------------------------------#

# Stuff for Windows DLLS using gnu-win32

ifeq ($(USE_DLLS),yes)

DLL_CFLAGS = -Dlib$(BROWSER_LIB_NAME)_DEFINE_DLL

include $(MERCURY_DIR)/Makefile.DLLs

else

DLL_CFLAGS =
DLL_DEF_LIB =

endif

#-----------------------------------------------------------------------------#

# targets

.PHONY: all
all : library browse_test declarative_test

.PHONY: depend
depend		: mdb.depend browse_test.depend declarative_test.depend

.PHONY: check
check		: mdb.check

.PHONY: all-ints 
all-ints: ints int3s

.PHONY: ints 
ints		: mdb.ints browse_test.ints declarative_test.ints

.PHONY: int3s 
int3s		: mdb.int3s

#-----------------------------------------------------------------------------#

tags		: $(MTAGS) $(mdb.ms)
	$(MTAGS) $(mdb.ms) ../library/*.m

mdb.stats : $(COMPILER_DIR)/source_stats.awk $(mdb.ms)
	awk -f $(COMPILER_DIR)/source_stats.awk \
		`vpath_find $(mdb.ms)` > $@
	
#-----------------------------------------------------------------------------#

.PHONY: dates
dates		:
	touch $(mdb.dates)

#-----------------------------------------------------------------------------#

.PHONY: os cs ss
os: $(mdb.os)
cs: $(mdb.cs)
ss: $(mdb.ss)

#-----------------------------------------------------------------------------#

.PHONY: library
library: lib$(BROWSER_LIB_NAME).$A lib$(BROWSER_LIB_NAME).$(EXT_FOR_SHARED_LIB)
library: $(BROWSER_LIB_NAME).init

lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A : $(mdb.os)
	rm -f lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A
	$(AR) $(ALL_ARFLAGS) \
		$(AR_LIBFILE_OPT)lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A \
		$(mdb.os)
	$(RANLIB) lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A

RPATH_1=$(SHLIB_RPATH_OPT)$(FINAL_INSTALL_MERC_LIB_DIR)
RPATH_2=$(SHLIB_RPATH_SEP)$(FINAL_INSTALL_MERC_GC_LIB_DIR)

lib$(BROWSER_LIB_NAME).so : $(mdb.pic_os)
	$(LINK_SHARED_OBJ) $(ERROR_UNDEFINED)				\
		-o lib$(BROWSER_LIB_NAME).so				\
		$(mdb.pic_os)						\
		$(RPATH_1)$(RPATH_2)					\
		$(LDFLAGS) $(LDLIBS)					\
		$(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY)		\
		$(READLINE_LIBRARIES)					\
		$(SHARED_LIBS)

$(BROWSER_LIB_NAME).init: $(deps_subdir)mdb.dep mdb.init
	cp mdb.init $(BROWSER_LIB_NAME).init

# Ensure we recompile mdb__version if VERSION is changed.
$(os_subdir)mdb.o \
$(os_subdir)mdb.pic_o \
        : $(RUNTIME_DIR)/mercury_conf.h

#-----------------------------------------------------------------------------#

realclean_local:
	rm -f lib$(BROWSER_LIB_NAME).$A lib$(BROWSER_LIB_NAME).so \
		$(BROWSER_LIB_NAME).init mdb.init
	rm -f tags

#-----------------------------------------------------------------------------#

# Installation targets

.PHONY: install
install: install_init install_library

.PHONY: install_dirs
install_dirs:
	[ -d $(INSTALL_MODULE_DIR) ] || mkdir -p $(INSTALL_MODULE_DIR)
	[ -d $(INSTALL_MERC_LIB_DIR) ] || mkdir -p $(INSTALL_MERC_LIB_DIR)

ifeq ($(findstring il,$(GRADE)),il)                                     

# there is no browser in the .NET backend

.PHONY: install_init
install_init: 

.PHONY: install_library
install_library:

else 

.PHONY: install_init
install_init: $(BROWSER_LIB_NAME).init install_dirs
	cp `vpath_find $(BROWSER_LIB_NAME).init` $(INSTALL_MODULE_DIR)


.PHONY: install_library
install_library: lib$(BROWSER_LIB_NAME).$A \
		lib$(BROWSER_LIB_NAME).$(EXT_FOR_SHARED_LIB) install_dirs
	cp `vpath_find lib$(BROWSER_LIB_NAME).$A \
		lib$(BROWSER_LIB_NAME).$(EXT_FOR_SHARED_LIB)` \
		$(INSTALL_MERC_LIB_DIR)

endif