[project @ 1998-05-31 18:59:39 by sof]
[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 acconfig.h README INSTALL Makefile install-sh
25
26 #
27 # Making a binary distribution
28 #
29 # To make a particular binary distribution: 
30 # set $(Project) to the name of the project (currently Ghc or Happy).
31
32 BIN_DIST_TMPDIR=$(shell pwd)
33 BIN_DIST_NAME=fptools
34
35 #
36 # list of toplevel directories to include in binary distrib.
37 #
38 BIN_DIST_MAIN_DIR=$($(Project)MainDir)
39 BIN_DIST_DIRS=$($(Project)BinDistDirs)
40
41 binary-dist:: binary-dist-pre
42
43 BIN_DIST_TOP= distrib/Makefile-bin.in \
44               distrib/configure-bin.in \
45               README \
46               distrib/INSTALL \
47               $(BIN_DIST_MAIN_DIR)/ANNOUNCE \
48               $(BIN_DIST_MAIN_DIR)/PATCHLEVEL \
49               $(BIN_DIST_MAIN_DIR)/RELEASE \
50               glafp-utils/mkdirhier/mkdirhier \
51               install-sh \
52               config.guess \
53               config.sub   \
54               aclocal.m4
55
56 binary-dist::
57         @for i in $(BIN_DIST_TOP); do \
58           if test -f "$$i"; then \
59              echo cp $$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); \
60              cp $$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); \
61           fi; \
62         done;
63         @echo "Configuring the Makefile for this project..."
64         touch $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
65         echo "package = $(ProjectNameShort)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
66         echo "version = $(ProjectVersion)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
67         echo "PACKAGE_SH_SCRIPTS = $($(Project)BinDistShScripts)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
68         echo "PACKAGE_PRL_SCRIPTS = $($(Project)BinDistPrlScripts)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
69         echo "PACKAGE_LIB_PRL_SCRIPTS = $($(Project)BinDistLibPrlScripts)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
70         echo "PACKAGE_BINS = $($(Project)BinDistBins)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
71         cat $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile-bin.in >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
72         @echo "Generating a shippable configure script.."
73         $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/configure-bin.in $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/configure.in 
74         ( cd $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); autoconf )
75
76 #
77 # binary dist'ing the documentation.  
78 # Which documentation to build/install is hardcoded below.
79 #
80
81 BINDIST_DOCS = $($(Project)BinDistDocs)
82 BINDIST_DOCS_WAYS = html info dvi
83
84 binary-dist ::
85         @for way in $(BINDIST_DOCS_WAYS); do \
86            $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/$$way/$(ProjectNameShort)-$(ProjectVersion); \
87            for dir in $(BINDIST_DOCS); do \
88              echo Making $$way documentation in $$dir && \
89              $(MAKE) -C $$dir --no-print-directory $(MFLAGS) $$way && \
90              echo cp -f $$dir/*.$$way $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/$$way/$(ProjectNameShort)-$(ProjectVersion) && \
91              cp -f $$dir/*.$$way $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/$$way/$(ProjectNameShort)-$(ProjectVersion) && \
92              echo "Done."; \
93            done; \
94         done
95
96 # Rename scripts to $i.prl and $i.sh where necessary.
97 # ToDo: do this in a cleaner way...
98
99 ifneq "$($(Project)BinDistPrlScripts)" ""
100 binary-dist::
101         @for i in $($(Project)BinDistPrlScripts); do \
102              echo "Renaming $$i to $$i.prl"; \
103             $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion)/$$i  $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion)/$$i.prl; \
104         done
105 endif
106
107 ifneq "$($(Project)BinDistLibPrlScripts)" ""
108 binary-dist::
109         @for i in $($(Project)BinDistLibPrlScripts); do \
110              echo "Renaming $$i to $$i.prl"; \
111             $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion)/$$i  $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion)/$$i.prl; \
112         done
113 endif
114
115 ifneq "$($(Project)BinDistShScripts)" ""
116 binary-dist::
117         @for i in $($(Project)BinDistShScripts); do \
118              echo "Renaming $$i to $$i.sh"; \
119             $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion)/$$i  $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion)/$$i.sh; \
120         done
121 endif
122
123 dist :: dist-pre
124 include $(TOP)/mk/target.mk
125 dist :: dist-post
126
127 binary-dist::
128         @echo "Mechanical and super-natty! Inspect the result and *if* happy; freeze, sell and get some sleep!"