1 #################################################################################
5 # This file defines Make variables for standard directories
8 #################################################################################
11 #-----------------------------------------------------------------
16 #-----------------------------------------------------------------------------
17 # install configuration
19 # The install standard target is guided by the following four variables
21 # INSTALL_PROGS (installed in $(bindir))
22 # INSTALL_LIBS (installed in $(libdir))
23 # INSTALL_LIBEXECS (installed in $(libexecdir))
24 # INSTALL_DATAS (installed in $(datadir))
26 # see target.mk for more information.
30 # Setting user/group ownership for the installed entities
32 # this stuff about "who" does the installing doesn't have make vars
33 # as it is not intended to be run-time changeable.
36 INSTALL_OWNER = -o $(OWNER)
42 INSTALL_GROUP = -g $(GROUP)
47 SRC_INSTALL_OPTS += $(INSTALL_OWNER) $(INSTALL_GROUP)
50 # Invocations of `install' for the four different classes
54 INSTALL_PROGRAM = $(INSTALL) -m 755
55 INSTALL_SCRIPT = $(INSTALL) -m 755
56 INSTALL_SHLIB = $(INSTALL) -m 755
57 INSTALL_DATA = $(INSTALL) -m 644
58 INSTALL_DIR = $(FPTOOLS_TOP)/glafp-utils/mkdirhier/mkdirhier
61 # The install variables does not have any defaults,
62 # what files to install have to be specified in the Makefiles.
64 #INSTALL_PROGS += $(HS_PROG) $(C_PROG)
65 #INSTALL_LIBS += $(LIBRARY)
66 #INSTALL_DATAS += $(HS_IFACES)
68 #################################################################################
70 # Standard variable names
72 #################################################################################
75 # The fptools mk setup defines a set of standard names which are used by the standard
76 # targets provided by mk. One example of this is the use of standard names
77 # for specifying what files to compile, their intermediate/object code, and
78 # the name of the final executable. Based on the settings of these variables, the
79 # standard targets will generate/expand rules that automatically compile and
84 # SRCS - sources, might be prefixed to indicate what type of source
86 # OBJS - object files (possibly prefixed).
88 # PROG - name of final executable
90 # We attempt to automatically devine the list of sources $(SRCS) to
91 # compile by looking in the current directory. This is complicated by
92 # the fact that a .hsc file gives rise to a .hs file (which needs to
93 # be automatically included in $(SRCS)), but the .hs file might
94 # already be present in the current directory and we don't want to
97 # So we figure out the sources in three stages: first figure out
98 # what's in the current directory (this is $(PRE_SRCS)). Then figure
99 # out all the "derived" sources (eg. A.hsc generates A.hs and
100 # A_hsc.c), and finally put all these together and remove duplicates
101 # (GNU make's handy sort function does the duplicate removing).
103 # BOOT_SRCS: list of machine generated Haskell modules.
104 # HS_SRCS: list of Haskell modules you want to compile.
105 # (also use by depend rule).
106 # HS_OBJS: list of corresponding object files
107 # HS_PROG: program that is ultimately linked.
108 # HS_IFACES: list of interface files generated
109 # (caveat: assuming no funny use of -hisuf and that
110 # file name and module name match)
112 PRE_SRCS = $(patsubst ./%, %, \
113 $(wildcard $(patsubst %, %/*.hs, . $(ALL_DIRS))) \
114 $(wildcard $(patsubst %, %/*.lhs, . $(ALL_DIRS))) \
115 $(wildcard $(patsubst %, %/*.y, . $(ALL_DIRS))) \
116 $(wildcard $(patsubst %, %/*.c, . $(ALL_DIRS))) \
117 $(wildcard $(patsubst %, %/*.prl, . $(ALL_DIRS))) \
118 $(wildcard $(patsubst %, %/*.lprl, . $(ALL_DIRS))) \
119 $(wildcard $(patsubst %, %/*.lit, . $(ALL_DIRS))) \
120 $(wildcard $(patsubst %, %/*.verb, . $(ALL_DIRS))) \
121 $(wildcard $(patsubst %, %/*.hsc, . $(ALL_DIRS))) \
124 HSC_SRCS = $(filter %.hsc, $(PRE_SRCS))
125 HAPPY_SRCS = $(filter %.y, $(PRE_SRCS))
127 DERIVED_SRCS = $(patsubst %.hsc, %.hs, $(HSC_SRCS)) \
128 $(patsubst %.hsc, %_hsc.c, $(HSC_SRCS)) \
129 $(patsubst %.hsc, %_hsc.h, $(HSC_SRCS)) \
130 $(patsubst %.y, %.hs, $(HAPPY_SRCS))
132 # EXCLUDED_SRCS can be set in the Makefile, otherwise it defaults to empty.
133 EXCLUDED_HSC_SRCS = $(filter %.hsc, $(EXCLUDED_SRCS))
134 EXCLUDED_HAPPY_SRCS = $(filter %.y, $(EXCLUDED_SRCS))
135 EXCLUDED_DERIVED_SRCS = $(patsubst %.hsc, %.hs, $(EXCLUDED_HSC_SRCS)) \
136 $(patsubst %.hsc, %_hsc.h, $(EXCLUDED_HSC_SRCS)) \
137 $(patsubst %.hsc, %_hsc.c, $(EXCLUDED_HSC_SRCS)) \
138 $(patsubst %.y, %.hs, $(EXCLUDED_HAPPY_SRCS))
139 # Exclude _hsc.c files; they get built as part of the cbits library,
140 # not part of the main library
142 CLOSED_EXCLUDED_SRCS = $(sort $(EXCLUDED_SRCS) $(EXCLUDED_DERIVED_SRCS))
144 SRCS = $(filter-out $(CLOSED_EXCLUDED_SRCS), \
145 $(sort $(PRE_SRCS) $(DERIVED_SRCS)))
147 HS_SRCS = $(filter %.lhs %.hs %.hc,$(sort $(SRCS) $(BOOT_SRCS)))
148 HS_OBJS = $(addsuffix .$(way_)o,$(basename $(HS_SRCS)))
149 HS_HCS = $(addsuffix .$(way_)hc,$(basename $(HS_SRCS)))
150 HS_SS = $(addsuffix .$(way_)s,$(basename $(HS_SRCS)))
151 HS_IFACES = $(addsuffix .$(way_)hi,$(basename $(HS_SRCS)))
153 HSC_C_OBJS = $(addsuffix _hsc.$(way_)o,$(basename $(filter %.hsc,$(SRCS))))
155 C_SRCS = $(filter %.c,$(SRCS))
156 C_OBJS = $(addsuffix .$(way_)o,$(basename $(C_SRCS)))
158 # SCRIPT_SRCS: list of raw script files (in literate form)
159 # SCRIPT_OBJS: de-litted scripts
160 SCRIPT_SRCS=$(filter %.lprl,$(SRCS))
161 SCRIPT_OBJS=$(addsuffix .prl,$(basename $(SCRIPT_SRCS)))
163 OBJS=$(HS_OBJS) $(C_OBJS) $(SCRIPT_OBJS)
166 # Note that as long as you use the standard variables for setting
167 # which C & Haskell programs you want to work on, you don't have
168 # to set any of the clean variables - the default should do the Right
172 #------------------------------------------------------------------
174 # make depend defaults
176 # The default set of files for the dependency generators to work on
177 # is just their source equivalents.
180 ifneq "$(BootingFromHc)" "YES"
181 MKDEPENDHS_SRCS=$(HS_SRCS)
186 MKDEPENDC_SRCS=$(C_SRCS)
188 #------------------------------------------------------------------
192 # The default set of files for the dependency generators to work on
193 # is just their source equivalents.
195 TAGS_HS_SRCS=$(HS_SRCS)
196 TAGS_C_SRCS=$(C_SRCS)
198 #------------------------------------------------------------------
199 # Clean file make-variables.
201 # The following three variables are used to control
202 # what gets removed when doing `make clean'
204 # MOSTLYCLEAN_FILES object code etc., but not stuff
205 # that is slow to recompile and/or stable
207 # CLEAN_FILES all files that are created by running make.
209 # MAINTAINER_CLEAN_FILES also clean out machine-generated files
210 # that may require extra tools to create.
213 MOSTLY_CLEAN_FILES += $(HS_OBJS) $(C_OBJS) $(HSC_C_OBJS)
214 CLEAN_FILES += $(HS_PROG) $(C_PROG) $(SCRIPT_PROG) $(SCRIPT_LINK) \
215 $(PROG) $(LIBRARY) $(HS_IFACES) $(HS_SS) a.out \
218 # Don't clean the .hc files if we're bootstrapping
219 ifneq "$(BootingFromHc)" "YES"
220 CLEAN_FILES += $(HS_HCS)
223 DIST_CLEAN_FILES += .depend
224 MAINTAINER_CLEAN_FILES += $(BOOT_SRCS)
227 # `Standard' set of files to clean out.
229 MOSTLY_CLEAN_FILES += \
230 *.CKP *.ln *.BAK *.bak .*.bak *.o core a.out errs ,* *.a .emacs_* \
231 tags TAGS *.ind *.ilg *.idx *.idx-prev *.aux *.aux-prev *.dvi *.log \
232 *.toc *.lot *.lof *.blg *.cb *_stub.c *_stub.h *.raw_s *.a.list
234 #------------------------------------------------------------------
238 # Following variables are used for creating source and binary distributions:
240 # SRC_DIST_NAME && BIN_DIST_NAME -- the package names
242 # SRC_DIST_FILES = list of extra files to include from a build tree into a source
245 # SRC_DIST_DIR = what the current directory in the source/build tree
246 # maps to in the source distrib. tree being created.
248 SRC_DIST_NAME=$(ProjectNameShort)-$(ProjectVersion)
251 # Binary distributions proceeds as follows:
253 # Fromthe top of a build tree, you do `make binary-dist'. The
254 # canned rule for this (in target.mk) will then do a binary
255 # install to a temporary directory before packaging it all up.
256 # The following variables guide the binary-dist:
258 # BIN_DIST_TMPDIR= the absolute path to where the temporary directory
259 # structure of a binary distribution should be created.
260 # [Default: toplevel from which you issue `make binary-dist']
261 # BIN_DIST_NAME= what to call the thing.
263 # BIN_DIST_DIRS= at the toplevel, list of directories to descend into when
264 # building the distribution tree.
266 # An extra directory variable that is set during bin-dists is $(bindist_top), giving
267 # the abs. path to the root of the binary installation tree. (useful when punting
268 # stuff like README and ANNOUNCE into a distrib, for instance)
270 # The layout of a binary distribution is described in the
271 # installation documentation.
275 # Directory in which DLLs are dumped so as not to get picked up by running
276 # programs (e.g. ghc or hsc) that run in the build tree
278 DLL_PEN = $(FPTOOLS_TOP)/dll