paths.mk 8.29 KB
Newer Older
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
#################################################################################
#
#			    paths.mk
#
# 	This file defines Make variables for standard directories
#	and file lists
#
#################################################################################


#-----------------------------------------------------------------
#
# Installation setup
#

#-----------------------------------------------------------------------------
# install configuration
#
# The install standard target is guided by the following four variables
#
#  INSTALL_PROGS    (installed in $(bindir))
#  INSTALL_LIBS     (installed in $(libdir))
#  INSTALL_LIBEXECS (installed in $(libexecdir))
#  INSTALL_DATAS    (installed in $(datadir))
#
# see target.mk for more information.
#

#
# Setting user/group ownership for the installed entities
#
# this stuff about "who" does the installing doesn't have make vars
# as it is not intended to be run-time changeable.
#
ifneq "$(OWNER)" ""
INSTALL_OWNER 	= -o $(OWNER)
else
INSTALL_OWNER	=
endif

ifneq "$(GROUP)" ""
INSTALL_GROUP	= -g $(GROUP)
else
INSTALL_GROUP	=
endif

SRC_INSTALL_OPTS += $(INSTALL_OWNER) $(INSTALL_GROUP)

#
# Invocations of `install' for the three different classes
# of targets:
#

54
55
INSTALL_PROGRAM = $(INSTALL) -m 755
INSTALL_SCRIPT  = $(INSTALL) -m 755
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
INSTALL_DATA    = $(INSTALL) -m 644
INSTALL_DIR     = $(FPTOOLS_TOP)/glafp-utils/mkdirhier/mkdirhier

#
# The install variables does not have any defaults,
# what files to install have to be specified in the Makefiles.
# 
#INSTALL_PROGS += $(HS_PROG) $(C_PROG)
#INSTALL_LIBS  += $(LIBRARY)
#INSTALL_DATAS += $(HS_IFACES)

#################################################################################
#
#		Standard variable names
#
#################################################################################

#
# The fptools mk setup defines a set of standard names which are used by the standard
# targets provided by mk. One example of this is the use of standard names
# for specifying what files to compile, their intermediate/object code, and
# the name of the final executable. Based on the settings of these variables, the
# standard targets will generate/expand rules that automatically compile and
# link your program.
#
# The general rules:
#   
#   SRCS - sources, might be prefixed to indicate what type of source
#          they are.
#   OBJS - object files (possibly prefixed).
#
#   PROG - name of final executable
88
89
90
91
92
93
94
95
96

# We attempt to automatically devine the list of sources $(SRCS) to
# compile by looking in the current directory.  This is complicated by
# the fact that a .hsc file gives rise to a .hs file (which needs to
# be automatically included in $(SRCS)), but the .hs file might
# already be present in the current directory and we don't want to
# compile it twice.

# So we figure out the sources in three stages: first figure out
97
98
99
100
# what's in the current directory (this is $(PRE_SRCS)).  Then figure
# out all the "derived" sources (eg. A.hsc generates A.hs and
# A_hsc.c), and finally put all these together and remove duplicates
# (GNU make's handy sort function does the duplicate removing).
101
102
103
104
105
106
107
108
109
110
#
# BOOT_SRCS: list of machine generated Haskell modules.
# HS_SRCS:   list of Haskell modules you want to compile.
#             (also use by depend rule).
# HS_OBJS:   list of corresponding object files
# HS_PROG:   program that is ultimately linked.
# HS_IFACES: list of interface files generated
#             (caveat: assuming no funny use of -hisuf and that
#               file name and module name match)

111
PRE_SRCS    = $(wildcard *.lhs *.hs *.c *.prl *.lprl *.lit *.verb *.hsc)
112

113
114
115
116
HSC_SRCS     = $(filter %.hsc, $(PRE_SRCS))
DERIVED_SRCS = $(patsubst %.hsc, %.hs, $(HSC_SRCS)) \
	       $(patsubst %.hsc, %_hsc.c, $(HSC_SRCS)) \
	       $(patsubst %.hsc, %_hsc.h, $(HSC_SRCS))
117

118
119
120
121
122
123
# EXCLUDED_SRCS can be set in the Makefile, otherwise it defaults to empty.
EXCLUDED_DERIVED_SRCS = $(patsubst %.hsc,%.hs %_hsc.c, \
			    $(filter %.hsc, $(EXCLUDED_SRCS)))
CLOSED_EXCLUDED_SRCS  = $(sort $(EXCLUDED_SRCS) $(EXCLUDED_DERIVED_SRCS))

SRCS        = $(filter-out $(CLOSED_EXCLUDED_SRCS), \
124
	        $(sort $(PRE_SRCS) $(DERIVED_SRCS)))
125

126
127
128
129
130
131
HS_SRCS	    = $(filter %.lhs %.hs %.hc,$(sort $(SRCS) $(BOOT_SRCS)))
HS_OBJS     = $(addsuffix .$(way_)o,$(basename $(HS_SRCS)))
HS_HCS      = $(addsuffix .$(way_)hc,$(basename $(HS_SRCS)))
HS_SS       = $(addsuffix .$(way_)s,$(basename $(HS_SRCS)))
HS_IFACES   = $(addsuffix .$(way_)hi,$(basename $(HS_SRCS)))

132
133
HSC_C_OBJS  = $(patsubst %_hsc.c,%_hsc.o,$(SRCS))

134
135
C_SRCS      = $(filter %.c,$(SRCS)) 
C_OBJS      = $(addsuffix .$(way_)o,$(basename $(C_SRCS)))
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150

# SCRIPT_SRCS:  list of raw script files (in literate form)
# SCRIPT_OBJS:  de-litted scripts
SCRIPT_SRCS=$(filter %.lprl,$(SRCS))
SCRIPT_OBJS=$(addsuffix .prl,$(basename $(SCRIPT_SRCS)))

OBJS=$(HS_OBJS) $(C_OBJS) $(SCRIPT_OBJS)

#
# Note that as long as you use the standard variables for setting
# which C & Haskell programs you want to work on, you don't have
# to set any of the clean variables - the default should do the Right
# Thing.
#

sof's avatar
sof committed
151
152
153
154
155
156
157
#------------------------------------------------------------------
#
# make depend defaults
#
# The default set of files for the dependency generators to work on
# is just their source equivalents.
# 
158
159

ifneq "$(BootingFromHc)" "YES"
sof's avatar
sof committed
160
MKDEPENDHS_SRCS=$(HS_SRCS)
161
162
163
164
else
MKDEPENDHS_SRCS=
endif

165
MKDEPENDC_SRCS=$(C_SRCS) 
sof's avatar
sof committed
166

sof's avatar
sof committed
167
168
169
170
171
172
173
174
175
176
#------------------------------------------------------------------
#
# make TAGS defaults
#
# The default set of files for the dependency generators to work on
# is just their source equivalents.
# 
TAGS_HS_SRCS=$(HS_SRCS)
TAGS_C_SRCS=$(C_SRCS)

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#------------------------------------------------------------------
# Clean file make-variables.
#
# The following three variables are used to control
# what gets removed when doing `make clean' 
#
# MOSTLYCLEAN_FILES   object code etc., but not stuff
#                     that is slow to recompile and/or stable
#
# CLEAN_FILES  all files that are created by running make.
#
# MAINTAINER_CLEAN_FILES also clean out machine-generated files
#                        that may require extra tools to create.
#
#
192
193
194
MOSTLY_CLEAN_FILES += $(HS_OBJS) $(C_OBJS)
CLEAN_FILES        += $(HS_PROG) $(C_PROG) $(SCRIPT_PROG) $(SCRIPT_LINK) \
		      $(PROG) $(LIBRARY) $(HS_IFACES) $(HS_SS) a.out \
195
		      $(DERIVED_SRCS)
196

197
198
199
200
201
# Don't clean the .hc files if we're bootstrapping
ifneq "$(BootingFromHc)" "YES"
CLEAN_FILES += $(HS_HCS)
endif

202
203
DIST_CLEAN_FILES += .depend
MAINTAINER_CLEAN_FILES += $(BOOT_SRCS)
204
205
206
207
208

#
# `Standard' set of files to clean out.
#
MOSTLY_CLEAN_FILES += \
209
 *.CKP *.ln *.BAK *.bak .*.bak *.o *core a.out errs ,* *.a .emacs_*  \
210
 tags TAGS *.ind *.ilg *.idx *.idx-prev *.aux *.aux-prev *.dvi *.log \
211
 *.toc *.lot *.lof *.blg *.cb *_stub.c *_stub.h *.raw_s
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253

#------------------------------------------------------------------
#
# Distribution setup
# 
# Following variables are used for creating source and binary distributions:
#
#  SRC_DIST_NAME && BIN_DIST_NAME  -- the package names
#
#  SRC_DIST_FILES = list of extra files to include from a build tree into a source
#                   distribution
#  
#  SRC_DIST_DIR  = what the current directory in the source/build tree
#                  maps to in the source distrib. tree being created.
#
SRC_DIST_NAME=$(ProjectNameShort)-$(ProjectVersion)

#
# Binary distributions proceeds as follows:
#
# Fromthe top of a build tree, you do `make binary-dist'. The
# canned rule for this  (in target.mk) will then do a binary
# install to a temporary directory before packaging it all up.
# The following variables guide the binary-dist:
#
#  BIN_DIST_TMPDIR= the absolute path to where the temporary directory
#		    structure of a binary distribution should be created.
#		    [Default: toplevel from which you issue `make binary-dist']
#  BIN_DIST_NAME=   what to call the thing.
#
#  BIN_DIST_DIRS=   at the toplevel, list of directories to descend into when
#		    building the distribution tree.
#  
#  An extra directory variable that is set during bin-dists is $(bindist_top), giving
#  the abs. path to the root of the binary installation tree. (useful when punting
#  stuff like README and ANNOUNCE into a distrib, for instance)
#
#  The layout of a binary distribution is described in the
#  installation documentation.
#


rrt's avatar
rrt committed
254
255
256
257
258
# Directory in which DLLs are dumped so as not to get picked up by running
# programs (e.g. ghc or hsc) that run in the build tree

DLL_PEN = $(FPTOOLS_TOP)/dll