[project @ 2003-05-29 13:03:56 by simonmar]
[ghc-hetmet.git] / Makefile
1 ############################################################################
2 #
3 #                       fptools/Makefile
4 #
5 #               This is the main Makefile for fptools.
6 #
7 ############################################################################
8
9 TOP=.
10 include $(TOP)/mk/boilerplate.mk
11
12 # find the projects that actually exist...
13 ProjectsThatExist = $(filter $(patsubst %/, %, $(wildcard */)), $(AllProjects))
14
15 # and filter only those that the user requested, if necessary
16 ifeq "$(ProjectsToBuild)" ""
17 SUBDIRS = $(ProjectsThatExist)
18 else
19 SUBDIRS = $(filter $(ProjectsToBuild), $(ProjectsThatExist))
20 endif
21
22 ifneq "$(Project)" ""
23    ifeq "$(Project)" "GreenCard"
24        ProjectDirectory=green-card
25    else
26         ifeq "$(Project)" "HaskellDirect"
27                 ProjectDirectory=hdirect
28         else
29                 ProjectDirectory=$(Project)
30         endif
31    endif
32    include $(shell echo $(ProjectDirectory) | tr A-Z a-z)/mk/config.mk
33 endif
34
35 # -----------------------------------------------------------------------------
36 # Certain targets require that Project is set from the command line.
37
38 CURRENT_TARGET = $(MAKECMDGOALS)
39 project-check :
40         @if [ "$(Project)" = "" ]; then \
41                 echo "  You need to set \"Project\" in order to make $(CURRENT_TARGET)"; \
42                 echo "  eg. make $(CURRENT_TARGET) Project=Ghc"; \
43                 exit 1; \
44         fi
45
46 # -----------------------------------------------------------------------------
47 # Targets: all, stage1, stage2, stage3
48
49 DIST_CLEAN_FILES += config.cache config.status
50
51 #
52 # If you've ended up using an in-place version of Happy,
53 # make sure it gets built early on.
54 #
55 ifeq "$(HAPPY)" "$(FPTOOLS_TOP_ABS)/happy/src/happy-inplace"
56 build : $(FPTOOLS_TOP_ABS)/happy/src/happy-inplace
57
58 $(FPTOOLS_TOP_ABS)/happy/src/happy-inplace : glafp-utils
59         $(MAKE) -C happy boot all
60 endif
61
62 # Build all projects that we know about
63 build :
64         @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
65         for i in $(SUBDIRS); do \
66            if [ -d $$i ]; then \
67               $(MAKE) -C $$i boot; \
68               if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ;  then true; else exit 1; fi; \
69               $(MAKE) -C $$i all; \
70               if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ;  then true; else exit 1; fi; \
71               fi; \
72         done
73
74 ifeq "$(findstring ghc, $(SUBDIRS))" "ghc"
75
76 stage1 : build
77
78 stage2 :
79         $(MAKE) -C ghc/compiler boot stage=2
80         $(MAKE) -C ghc/compiler stage=2
81
82 stage3 :
83         $(MAKE) -C ghc/compiler boot stage=3
84         $(MAKE) -C ghc/compiler stage=3
85
86 bootstrap  : bootstrap2
87 bootstrap2 : stage1 stage2
88 bootstrap3 : stage1 stage2 stage3
89
90 all :: bootstrap
91
92 # We want to install the stage 2 bootstrapped compiler by default, but we let
93 # the user override this by saying 'make install stage=1', for example.
94 ifeq "$(stage)" ""
95 INSTALL_STAGE = stage=2
96 else
97 INSTALL_STAGE =
98 endif
99
100 else # Not building GHC
101
102 all :: build
103
104 INSTALL_STAGE =
105
106 endif
107
108 boot ::
109         @echo "Please use \`make all' only from the top-level, or \`make boot' followed"
110         @echo "by \`make all' in an individual project subdirectory (ghc, hslibs etc.)."
111
112 install ::
113         @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
114         for i in $(filter-out $(ProjectsDontInstall), $(SUBDIRS)); do \
115            if [ -d $$i ]; then \
116               $(MAKE) -C $$i $(INSTALL_STAGE) install; \
117               if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ;  then true; else exit 1; fi; \
118               fi; \
119         done
120
121 install-docs ::
122         @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
123         for i in $(filter-out $(ProjectsDontInstall), $(SUBDIRS)); do \
124            if [ -d $$i ]; then \
125               $(MAKE) -C $$i $(INSTALL_STAGE) install-docs; \
126               if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ;  then true; else exit 1; fi; \
127               fi; \
128         done
129
130 # -----------------------------------------------------------------------------
131 # Making a binary distribution
132 #
133 # To make a particular binary distribution: 
134 # set $(Project) to the name of the project, capitalised (eg. Ghc or Happy).
135
136 # `dist' `binary-dist'
137 #      Create a distribution tar file for this program. The tar file
138 #      should be set up so that the file names in the tar file start with
139 #      a subdirectory name which is the name of the package it is a
140 #      distribution for. This name can include the version number.
141 #
142 #      For example, the distribution tar file of GCC version 1.40 unpacks
143 #      into a subdirectory named `gcc-1.40'.
144
145 #      The easiest way to do this is to create a subdirectory
146 #      appropriately named, use ln or cp to install the proper files in
147 #      it, and then tar that subdirectory.
148
149 #      The dist target should explicitly depend on all non-source files
150 #      that are in the distribution, to make sure they are up to date in
151 #      the distribution. See Making Releases.
152 #
153 #       binary-dist is an FPtools addition for binary distributions
154
155
156 binary-dist :: project-check
157
158 BIN_DIST_TMPDIR=$(FPTOOLS_TOP_ABS)
159 BIN_DIST_NAME=$(ProjectNameShort)-$(ProjectVersion)
160
161 #
162 # list of toplevel directories to include in binary distrib.
163 #
164 BIN_DIST_MAIN_DIR=$($(Project)MainDir)
165 BIN_DIST_DIRS=$($(Project)BinDistDirs)
166
167 binary-dist:: binary-dist-pre
168
169 BIN_DIST_TOP= distrib/Makefile-bin.in \
170               distrib/configure-bin.in \
171               distrib/INSTALL \
172               $(BIN_DIST_MAIN_DIR)/ANNOUNCE \
173               $(BIN_DIST_MAIN_DIR)/VERSION \
174               $(BIN_DIST_MAIN_DIR)/LICENSE \
175               $(BIN_DIST_MAIN_DIR)/README \
176               glafp-utils/mkdirhier/mkdirhier \
177               install-sh \
178               config.guess \
179               config.sub   \
180               aclocal.m4
181
182 #
183 # binary-dist creates a binary bundle, set BIN_DIST_NAME
184 # to package name and do `make binary-dist Project=<project-name>'
185 # (normally this just a thing you would do from the toplevel of fptools)
186 #
187 .PHONY: binary-dist-pre binary-dist binary-pack
188
189 BIN_DIST_NAME=$(ProjectNameShort)-$(ProjectVersion)
190 BIN_DIST_TMPDIR=$(FPTOOLS_TOP_ABS)
191
192 binary-dist-pre::
193 ifeq "$(BIN_DIST)" ""
194         echo "WARNING: To run the binary-dist target, you need to set BIN_DIST=1 in your build.mk" && exit 1
195 endif
196         -rm -rf $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)
197         -$(RM) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME).tar.gz
198         -echo "BIN_DIST_DIRS = $(BIN_DIST_DIRS)"
199         @for i in $(BIN_DIST_DIRS); do                   \
200           if test -d "$$i"; then                         \
201            echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM); \
202            $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM); \
203            echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM); \
204            $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM); \
205            echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share; \
206            $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share; \
207            echo $(MAKE) -C $$i $(MFLAGS) $(INSTALL_STAGE) install \
208                 prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
209                 exec_prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
210                 bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM) \
211                 libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM) \
212                 libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM) \
213                 datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share; \
214            $(MAKE) -C $$i $(MFLAGS) $(INSTALL_STAGE) install \
215                 prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
216                 exec_prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
217                 bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM) \
218                 libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM) \
219                 libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM) \
220                 datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share; \
221           fi; \
222         done
223
224 binary-dist::
225         @for i in $(BIN_DIST_TOP); do \
226           if test -f "$$i"; then \
227              echo cp $$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); \
228              cp $$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); \
229           fi; \
230         done;
231         @echo "Configuring the Makefile for this project..."
232         touch $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
233         echo "package = $(ProjectNameShort)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
234         echo "version = $(ProjectVersion)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
235         echo "PACKAGE_SH_SCRIPTS = $($(Project)BinDistShScripts)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
236         echo "PACKAGE_PRL_SCRIPTS = $($(Project)BinDistPrlScripts)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
237         echo "PACKAGE_LIB_PRL_SCRIPTS = $($(Project)BinDistLibPrlScripts)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
238         echo "PACKAGE_BINS = $($(Project)BinDistBins)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
239         echo "PACKAGE_LINKS = $($(Project)BinDistLinks)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
240         cat $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile-bin.in >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
241         @echo "Generating a shippable configure script.."
242         $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/configure-bin.in $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/configure.in 
243         ( cd $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); autoconf )
244         if test -x $(BIN_DIST_MAIN_DIR)/mk/post-install-script ; then \
245                 cp $(BIN_DIST_MAIN_DIR)/mk/post-install-script \
246                         $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) ; \
247         fi
248         if test -x $(BIN_DIST_MAIN_DIR)/mk/post-inplace-script ; then \
249                 cp $(BIN_DIST_MAIN_DIR)/mk/post-inplace-script \
250                         $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) ; \
251         fi
252 #
253 # binary dist'ing the documentation.  
254 # Which documentation to build/install is hardcoded below.
255 #
256
257 BINDIST_DOC_WAYS = html ps
258 # BINDIST_DOC_WAYS =
259
260 binary-dist ::
261         @for i in $(BIN_DIST_DIRS); do                          \
262           if test -d "$$i"; then                                \
263             $(MAKE) -C $$i $(MFLAGS) $(BINDIST_DOC_WAYS);       \
264             echo $(MAKE) -C $$i $(MFLAGS) install-docs SGMLDocWays="$(BINDIST_DOC_WAYS)" \
265                 prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)      \
266                 exec_prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
267                 bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM) \
268                 libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM) \
269                 libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM) \
270                 datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share; \
271             $(MAKE) -C $$i $(MFLAGS) install-docs SGMLDocWays="$(BINDIST_DOC_WAYS)" \
272                 prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)      \
273                 exec_prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
274                 bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM) \
275                 libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM) \
276                 libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM) \
277                 datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share; \
278           fi \
279         done
280
281 # Rename scripts to $i.prl and $i.sh where necessary.
282 # ToDo: do this in a cleaner way...
283
284 ifneq "$($(Project)BinDistPrlScripts)" ""
285 binary-dist::
286         @for i in $($(Project)BinDistPrlScripts); do \
287              echo "Renaming $$i to $$i.prl"; \
288             $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$$i  $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$$i.prl; \
289         done
290 endif
291
292 ifneq "$($(Project)BinDistLibPrlScripts)" ""
293 binary-dist::
294         @for i in $($(Project)BinDistLibPrlScripts); do \
295              echo "Renaming $$i to $$i.prl"; \
296             $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i  $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i.prl; \
297         done
298 endif
299
300 ifneq "$($(Project)BinDistShScripts)" ""
301 binary-dist::
302         @for i in $($(Project)BinDistShScripts); do \
303              echo "Renaming $$i to $$i.sh"; \
304             $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$$i  $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$$i.sh; \
305         done
306 endif
307
308 #
309 # Do this separately for now
310
311 binary-pack::
312         ( cd $(BIN_DIST_TMPDIR); $(TAR) chzf $(BIN_DIST_NAME).tar.gz $(BIN_DIST_NAME) )
313
314 ifneq "$(way)" ""
315 .PHONY: package-way-dist
316 package-way-dist::
317         ( cd $(BIN_DIST_TMPDIR); $(FIND) $(BIN_DIST_NAME)/ \( -name "*$(_way).a" -o -name "*.$(way_)hi" \) -print | xargs tar cvf $(BIN_DIST_TMPDIR)/ghc-$(ProjectVersion)-$(way)-$(TARGETPLATFORM).tar )
318         gzip $(BIN_DIST_TMPDIR)/ghc-$(ProjectVersion)-$(way)-$(TARGETPLATFORM).tar
319 endif
320
321 ifneq "$(way)" ""
322 remove-way-dist::
323         ( cd $(BIN_DIST_TMPDIR); $(FIND) $(BIN_DIST_NAME)/ \( -name "*$(_way).a" -o -name "*.$(way_)hi" \) -print -exec $(RM) {} \; )
324 endif
325
326 binary-dist::
327         @echo "Mechanical and super-natty! Inspect the result and *if* happy; freeze, sell and get some sleep!"
328
329 # -----------------------------------------------------------------------------
330 # Building source distributions
331 #
332 # Do it like this: 
333 #
334 #       $ make
335 #       $ make dist Project=Ghc
336 #
337 # WARNING: `make dist' calls `make distclean' before tarring up the tree.
338 #
339
340 .PHONY: dist
341
342 #
343 # Directory in which we're going to build the src dist
344 #
345 SRC_DIST_DIR=$(shell pwd)/$(SRC_DIST_NAME)
346
347 #
348 # Files to include in source distributions
349 #
350 SRC_DIST_DIRS += docs distrib $(SUBDIRS)
351 SRC_DIST_FILES += \
352         configure.in config.guess config.sub configure \
353         aclocal.m4 acconfig.h README Makefile Makefile.config install-sh \
354         mk/bootstrap.mk \
355         mk/boilerplate.mk mk/config.h.in mk/config.mk.in mk/opts.mk \
356         mk/paths.mk mk/package.mk mk/suffix.mk mk/target.mk
357
358 dist dist-manifest dist-package :: project-check
359
360 # clean the tree first, leaving certain extra files in place (eg. configure)
361 dist :: distclean
362
363 dist ::
364         -rm -rf $(SRC_DIST_DIR)
365         -$(RM) $(SRC_DIST_NAME).tar.gz
366         mkdir $(SRC_DIST_DIR)
367         mkdir $(SRC_DIST_DIR)/mk
368         $(FIND) $(SRC_DIST_DIRS) -type d \( -name CVS -prune -o -name SRC -prune -o -print \) | sed -e 's!.*!mkdir "$(SRC_DIST_DIR)/&"!' | sh
369         $(FIND) $(SRC_DIST_DIRS) $(SRC_DIST_FILES) -name CVS -prune -o -name SRC -prune -o -name "autom4te*" -prune -o -name "*~" -prune -o -name ".cvsignore" -prune -o -name "\#*" -prune -o -name ".\#*" -prune -o -name "log" -prune -o -name "*-SAVE" -prune -o -name "*.orig" -prune -o -name "*.rej" -prune -o ! -type d -print | sed -e 's!.*!$(LN_S) "$(FPTOOLS_TOP_ABS)/&" "$(SRC_DIST_DIR)/&"!' | sh
370
371 # Automatic generation of a MANIFEST file for a source distribution
372 # tree that is ready to go.
373 dist-manifest ::
374         cd $(SRC_DIST_DIR); $(FIND) . \( -type l -o -type f \) -exec ls -lLG {} \; | sed -e 's/\.\///' > MANIFEST
375
376 dist-package :: dist-package-tar-gz
377
378 SRC_DIST_PATHS = $(patsubst %, $(SRC_DIST_NAME)/%, $(SRC_DIST_FILES) $(SRC_DIST_DIRS))
379
380 dist-package-tar-gz ::
381         $(TAR) chzf $(SRC_DIST_NAME)-src.tar.gz $(SRC_DIST_NAME)
382
383 dist-package-zip ::
384         cd ..; $(LN_S) $(FPTOOLS_TOP_ABS) $(SRC_DIST_NAME) && \
385                $(ZIP) $(ZIP_OPTS) -r $(SRC_DIST_NAME)-src.zip $(SRC_DIST_PATHS)
386
387 # -----------------------------------------------------------------------------
388 # HC file bundles
389
390 hc-file-bundle : project-check
391         $(RM) -r $(ProjectNameShort)-$(ProjectVersion)
392         $(LN_S) . $(ProjectNameShort)-$(ProjectVersion)
393         $(FIND) $(ProjectNameShort)-$(ProjectVersion)/ghc/compiler \
394              $(ProjectNameShort)-$(ProjectVersion)/ghc/utils \
395              $(ProjectNameShort)-$(ProjectVersion)/libraries \
396              $(ProjectNameShort)-$(ProjectVersion)/hslibs \
397           \( -name "*.hc" -o -name "*_hsc.[ch]" -o -name "*_stub.[ch]" \) -print > hc-files-to-go
398         for f in `$(FIND) $(ProjectNameShort)-$(ProjectVersion)/ghc/compiler $(ProjectNameShort)-$(ProjectVersion)/ghc/utils $(ProjectNameShort)-$(ProjectVersion)/libraries $(ProjectNameShort)-$(ProjectVersion)/hslibs -name "*.hsc" -print` ""; do \
399              if test "x$$f" != "x" && test -e `echo "$$f" | sed 's/hsc$$/hs/g'`; then \
400                 echo `echo "$$f" | sed 's/hsc$$/hs/g' ` >> hc-files-to-go ; \
401              fi; \
402         done;
403         echo $(ProjectNameShort)-$(ProjectVersion)/libraries/base/GHC/PrimopWrappers.hs >> hc-files-to-go
404         echo $(ProjectNameShort)-$(ProjectVersion)/ghc/compiler/*.hs-incl >> hc-files-to-go
405         echo $(ProjectNameShort)-$(ProjectVersion)/ghc/compiler/parser/Parser.hs >> hc-files-to-go
406         echo $(ProjectNameShort)-$(ProjectVersion)/ghc/compiler/parser/ParserCore.hs >> hc-files-to-go
407         echo $(ProjectNameShort)-$(ProjectVersion)/ghc/compiler/main/ParsePkgConf.hs >> hc-files-to-go
408         echo $(ProjectNameShort)-$(ProjectVersion)/libraries/haskell-src/Language/Haskell/Parser.hs >> hc-files-to-go
409         tar czf $(ProjectNameShort)-$(ProjectVersion)-$(TARGETPLATFORM)-hc.tar.gz `cat hc-files-to-go`
410
411 CLEAN_FILES += hc-files-to-go *-hc.tar.gz
412
413 # -----------------------------------------------------------------------------
414
415 # Turn off target.mk's rules for 'all', 'boot' and 'install'.
416 NO_BOOT_TARGET=YES
417 NO_ALL_TARGET=YES
418 NO_INSTALL_TARGET=YES
419
420 include $(TOP)/mk/target.mk
421
422 # -----------------------------------------------------------------------------
423