[project @ 1997-09-26 10:03:57 by simonm]
[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 SRC_DIST_DIR=$(shell pwd)/$(SRC_DIST_NAME)
12
13 #
14 # Totally evil hack to make the setting of SUBDIRS be dependent
15 # on whether we do `make install' or not. Having a $(ifeq ... ) would
16 # be preferable..
17 CURRENT_TARGET = $@
18 SUBDIRS = $(shell if (test x$(CURRENT_TARGET) = xinstall) ; then echo $(ProjectsToInstall); else echo $(ProjectsToBuild); fi)
19
20 #
21 # Files to include in fptools source distribution
22 #
23 SRC_DIST_DIRS += mk docs CONTRIB distrib $(ProjectsToBuild)
24 SRC_DIST_FILES += configure.in config.guess config.sub configure aclocal.m4 README ANNOUNCE INSTALL Makefile install-sh
25
26 #
27 # Making a binary distribution
28 #
29 BIN_DIST_TMPDIR=$(shell pwd)
30 BIN_DIST_NAME=fptools
31
32 #
33 # list of toplevel `projects' to include in binary distrib.
34 #
35 BIN_DIST_DIRS=ghc
36
37 binary-dist:: binary-dist-pre
38
39 BIN_DIST_TOP= distrib/Makefile-bin.in \
40               distrib/configure-bin.in \
41               README \
42               distrib/INSTALL \
43               ANNOUNCE \
44               ghc/PATCHLEVEL \
45               glafp-utils/mkdirhier/mkdirhier \
46               ghc/RELEASE \
47               install-sh \
48               config.guess \
49               config.sub
50
51 binary-dist::
52         @for i in $(BIN_DIST_TOP); do \
53           echo cp $$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); \
54           cp $$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); \
55         done;
56         @echo "hackily rename some of these chaps.."
57         $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile-bin.in $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in 
58         $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/configure-bin.in $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/configure.in 
59         @echo "Generating a shippable configure script.."
60         #-(cd $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); autoconf )
61
62 #
63 # binary dist'ing the documentation.  
64 # Which documentation to build/install is hardcoded below.
65 #
66
67 BINDIST_DOCS = docs ghc/docs/users_guide
68 BINDIST_DOCS_WAYS = html info dvi
69
70 binary-dist ::
71         @for way in $(BINDIST_DOCS_WAYS); do \
72            $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/$$way/$(GhcProjectNameShort)-$(GhcProjectVersion); \
73            for dir in $(BINDIST_DOCS); do \
74              echo Making $$way documentation in $$dir; \
75              $(MAKE) -C $$dir --no-print-directory $(MFLAGS) $$way; \
76              echo cp -f $$dir/*.$$way $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/$$way/$(GhcProjectNameShort)-$(GhcProjectVersion); \
77              cp -f $$dir/*.$$way $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/$$way/$(GhcProjectNameShort)-$(GhcProjectVersion); \
78              echo "Done."; \
79            done; \
80         done
81
82 #
83 # binary dist'ing hslibs/, hackily.
84 #
85 binary-dist ::
86         @echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/hslibs;
87         @$(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/hslibs;
88         $(MAKE) -C hslibs $(MFLAGS) install \
89                 BIN_DIST=1 BIN_DIST_NAME=$(BIN_DIST_NAME) \
90                 prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
91                 exec_prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
92                 bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/ghc-$(ProjectVersion) \
93                 libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/hslibs \
94                 libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/hslibs \
95                 datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/ghc-$(ProjectVersion) ;
96
97 # Even more of a hack, but I'm too tired to fix this up right now..
98 BIN_DIST_SCRIPTS_NEEDING_RENAMING=ghc stat2resid hstags mkdependHS
99
100 binary-dist::
101         @for i in $(BIN_DIST_SCRIPTS_NEEDING_RENAMING); do \
102              echo "Renaming $$i to $$i.prl"; \
103             $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/$$i  $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/$$i.prl; \
104         done
105         @echo "Renaming hscpp to hscpp.prl"
106         @$(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/hscpp  $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/hscpp.prl
107
108 dist :: dist-pre
109 include $(TOP)/mk/target.mk
110 dist :: dist-post
111
112 binary-dist::
113         @echo "Mechanical and super-natty! Inspect the result and *if* happy; freeze, sell and get some sleep!"