1 #################################################################################
5 # This is the main Makefile for fptools.
7 #################################################################################
10 include $(TOP)/mk/boilerplate.mk
11 SRC_DIST_DIR=$(shell pwd)/$(SRC_DIST_NAME)
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
18 SUBDIRS = $(shell if (test x$(CURRENT_TARGET) = xinstall) ; then echo $(ProjectsToInstall); else echo $(ProjectsToBuild); fi)
19 PROJECT_CONFIG_MK = $(shell if (test x$(CURRENT_TARGET) = xbinary-dist) ; then echo inlude $(Project)/mk/config.mk; else echo ''; fi)
24 # Files to include in fptools source distribution
26 SRC_DIST_DIRS += mk docs CONTRIB distrib $(ProjectsToBuild)
27 SRC_DIST_FILES += configure.in config.guess config.sub configure aclocal.m4 acconfig.h README INSTALL Makefile install-sh
30 # Making a binary distribution
32 # To make a particular binary distribution:
33 # set $(Project) to the name of the project (currently Ghc or Happy).
35 BIN_DIST_TMPDIR=$(shell pwd)
39 # list of toplevel directories to include in binary distrib.
41 BIN_DIST_MAIN_DIR=$($(Project)MainDir)
42 BIN_DIST_DIRS=$($(Project)BinDistDirs)
44 binary-dist:: binary-dist-pre
46 BIN_DIST_TOP= distrib/Makefile-bin.in \
47 distrib/configure-bin.in \
50 $(BIN_DIST_MAIN_DIR)/ANNOUNCE \
51 $(BIN_DIST_MAIN_DIR)/PATCHLEVEL \
52 $(BIN_DIST_MAIN_DIR)/RELEASE \
53 glafp-utils/mkdirhier/mkdirhier \
60 @for i in $(BIN_DIST_TOP); do \
61 if test -f "$$i"; then \
62 echo cp $$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); \
63 cp $$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); \
66 @echo "Configuring the Makefile for this project..."
67 touch $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
68 echo "package = $(ProjectNameShort)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
69 echo "version = $(ProjectVersion)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
70 echo "PACKAGE_SH_SCRIPTS = $($(Project)BinDistShScripts)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
71 echo "PACKAGE_PRL_SCRIPTS = $($(Project)BinDistPrlScripts)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
72 echo "PACKAGE_LIB_PRL_SCRIPTS = $($(Project)BinDistLibPrlScripts)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
73 echo "PACKAGE_BINS = $($(Project)BinDistBins)" >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
74 cat $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile-bin.in >> $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in
75 @echo "Generating a shippable configure script.."
76 $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/configure-bin.in $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/configure.in
77 ( cd $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); autoconf )
80 # binary dist'ing the documentation.
81 # Which documentation to build/install is hardcoded below.
84 BINDIST_DOCS = $($(Project)BinDistDocs)
85 BINDIST_DOCS_WAYS = html info dvi
88 @for way in $(BINDIST_DOCS_WAYS); do \
89 $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/$$way/$(ProjectNameShort)-$(ProjectVersion); \
90 for dir in $(BINDIST_DOCS); do \
91 echo Making $$way documentation in $$dir && \
92 $(MAKE) -C $$dir --no-print-directory $(MFLAGS) $$way && \
93 echo cp -f $$dir/*.$$way $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/$$way/$(ProjectNameShort)-$(ProjectVersion) && \
94 cp -f $$dir/*.$$way $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/$$way/$(ProjectNameShort)-$(ProjectVersion) && \
99 # Rename scripts to $i.prl and $i.sh where necessary.
100 # ToDo: do this in a cleaner way...
102 ifneq "$($(Project)BinDistPrlScripts)" ""
104 @for i in $($(Project)BinDistPrlScripts); do \
105 echo "Renaming $$i to $$i.prl"; \
106 $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion)/$$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion)/$$i.prl; \
110 ifneq "$($(Project)BinDistLibPrlScripts)" ""
112 @for i in $($(Project)BinDistLibPrlScripts); do \
113 echo "Renaming $$i to $$i.prl"; \
114 $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion)/$$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion)/$$i.prl; \
118 ifneq "$($(Project)BinDistShScripts)" ""
120 @for i in $($(Project)BinDistShScripts); do \
121 echo "Renaming $$i to $$i.sh"; \
122 $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion)/$$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion)/$$i.sh; \
127 include $(TOP)/mk/target.mk
131 @echo "Mechanical and super-natty! Inspect the result and *if* happy; freeze, sell and get some sleep!"