Makefile 6.51 KB
Newer Older
1 2 3 4 5 6 7
#################################################################################
#
#			fptools/Makefile
#
#		This is the main Makefile for fptools.
#
#################################################################################
8

9 10 11
TOP=.
include $(TOP)/mk/boilerplate.mk
SRC_DIST_DIR=$(shell pwd)/$(SRC_DIST_NAME)
12

sof's avatar
sof committed
13 14 15 16 17 18
#
# Totally evil hack to make the setting of SUBDIRS be dependent
# on whether we do `make install' or not. Having a $(ifeq ... ) would
# be preferable..
CURRENT_TARGET = $@
SUBDIRS = $(shell if (test x$(CURRENT_TARGET) = xinstall) ; then echo $(ProjectsToInstall); else echo $(ProjectsToBuild); fi)
19

20 21 22
#
# Files to include in fptools source distribution
#
sof's avatar
sof committed
23
SRC_DIST_DIRS += mk docs CONTRIB distrib $(ProjectsToBuild)
sof's avatar
sof committed
24
SRC_DIST_FILES += configure.in config.guess config.sub configure README ANNOUNCE ANNOUNCE-$(GhcProjectVersion) NEWS INSTALL Makefile install-sh
25 26


27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#
# Making a binary distribution
#
BIN_DIST_TMPDIR=$(shell pwd)
BIN_DIST_NAME=fptools

#
# list of toplevel `projects' to include in binary distrib.
#
BIN_DIST_DIRS=ghc

binary-dist:: binary-dist-pre

BIN_DIST_TOP= distrib/Makefile-bin.in \
	      distrib/configure-bin.in \
	      distrib/README \
	      distrib/INSTALL \
sof's avatar
sof committed
44 45 46 47 48 49 50
	      distrib/ANNOUNCE \
	      distrib/PATCHLEVEL \
	      glafp-utils/mkdirhier/mkdirhier \
	      ghc/RELEASE \
	      install-sh \
	      config.guess \
	      config.sub
51 52 53

binary-dist::
	@for i in $(BIN_DIST_TOP); do \
sof's avatar
sof committed
54 55
	  echo cp $$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); \
	  cp $$i $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); \
56
	done;
sof's avatar
sof committed
57 58 59 60
	@echo "hackily rename some of these chaps.."
	$(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile-bin.in $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/Makefile.in 
	$(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/configure-bin.in $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/configure.in 
	@echo "Generating a shippable configure script.."
sof's avatar
sof committed
61
	#-(cd $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME); autoconf )
62 63 64

#
# Creating and copying the documentation into the bin-dist tree.
sof's avatar
sof committed
65 66 67 68
# (this tries to be oh-so-general about copyng docs, but isn't really
# suited for anything else than ghc/)
#
# Needless to say, the rule below could be cleaned up somewhat.
69 70
#
binary-dist::
sof's avatar
sof committed
71 72 73
	@$(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/html/$(GhcProjectNameShort)-$(GhcProjectVersion)
	@$(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/dvi/$(GhcProjectNameShort)-$(GhcProjectVersion)
	@$(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/info/$(GhcProjectNameShort)-$(GhcProjectVersion)
74
	@echo "Making html documentation.."
sof's avatar
sof committed
75
	@echo "For fptools.."
sof's avatar
sof committed
76
	#$(MAKE) -C docs --no-print-directory $(MFLAGS) html
sof's avatar
sof committed
77
	#cp -f docs/html/* docs/*.html $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/html/$(GhcProjectNameShort)-$(GhcProjectVersion)
sof's avatar
sof committed
78 79 80
	#@echo "Done."
	#@for i in $(BIN_DIST_DIRS); do \
	#   echo "For $$i.."; \
sof's avatar
sof committed
81 82 83 84
	#   echo cp -f $$i/docs/users_guide/html/* $$i/docs/users_guide/*.html $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/html/$(GhcProjectNameShort)-$(GhcProjectVersion); \
	#   cp -f $$i/docs/users_guide/html/* $$i/docs/users_guide/*.html $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/html/$(GhcProjectNameShort)-$(GhcProjectVersion); \
	#   echo cp -f $$i/docs/html/* $$i/docs/*.html $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/html/$(GhcProjectNameShort)-$(GhcProjectVersion); \
	#   cp -f $$i/docs/html/* $$i/docs/*.html $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/html/$(GhcProjectNameShort)-$(GhcProjectVersion); \
sof's avatar
sof committed
85 86 87 88 89
	#   echo "Done."; \
	#done
	##@echo "Making dvi files.."
	#@echo "For fptools.."
	#-$(MAKE) -C docs --no-print-directory $(MFLAGS) dvi
sof's avatar
sof committed
90
	#-cp -f docs/*.dvi  $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/dvi/$(GhcProjectNameShort)-$(GhcProjectVersion)
sof's avatar
sof committed
91 92 93
	#@echo "Done."
	#@for i in $(BIN_DIST_DIRS); do \
	#   echo "For $$i.."; \
sof's avatar
sof committed
94 95 96 97
	#   echo cp -f $$i/docs/users_guide/*.dvi $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/dvi/$(GhcProjectNameShort)-$(GhcProjectVersion); \
	#   cp -f $$i/docs/users_guide/*.dvi $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/dvi/$(GhcProjectNameShort)-$(GhcProjectVersion); \
	#   echo cp -f $$i/docs/*.dvi $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/dvi/$(GhcProjectNameShort)-$(GhcProjectVersion); \
	#   cp -f $$i/docs/*.dvi $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/dvi/$(GhcProjectNameShort)-$(GhcProjectVersion); \
sof's avatar
sof committed
98 99 100 101 102
	#   echo "Done."; \
	#done
	#@echo "Making info files.."
	#@echo "For fptools.."
	#-$(MAKE) -C docs --no-print-directory $(MFLAGS) info
sof's avatar
sof committed
103
	#-cp -f docs/*.info $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/info/$(GhcProjectNameShort)-$(GhcProjectVersion)/
sof's avatar
sof committed
104 105 106
	#@echo "Done."
	#@for i in $(BIN_DIST_DIRS); do \
	#   echo "For $$i docs.."; \
sof's avatar
sof committed
107 108 109 110
	#   echo cp -f $$i/docs/users_guide/*.info  $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/info/$(GhcProjectNameShort)-$(GhcProjectVersion); \
	#   cp -f $$i/docs/users_guide/*.info $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/info/$(GhcProjectNameShort)-$(GhcProjectVersion); \
	#   echo cp -f $$i/docs/*.info $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/info/$(GhcProjectNameShort)-$(GhcProjectVersion); \
	#   cp -f $$i/docs/*.info $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/info/$(GhcProjectNameShort)-$(GhcProjectVersion); \
sof's avatar
sof committed
111 112
	#   echo "Done."; \
	#done
sof's avatar
sof committed
113 114 115 116 117 118 119 120 121 122 123 124 125 126

#
# binary dist'ing hslibs/, hackily.
#
binary-dist ::
	@echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/hslibs;
	@$(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/hslibs;
	$(MAKE) -C hslibs $(MFLAGS) install \
		BIN_DIST=1 BIN_DIST_NAME=$(BIN_DIST_NAME) \
		prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
		exec_prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
		bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/ghc-$(ProjectVersion) \
		libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/hslibs \
		libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/hslibs \
sof's avatar
sof committed
127
		datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/ghc-$(ProjectVersion) ;
sof's avatar
sof committed
128 129 130 131 132 133 134 135 136 137 138

# Even more of a hack, but I'm too tired to fix this up right now..
BIN_DIST_SCRIPTS_NEEDING_RENAMING=ghc stat2resid hstags mkdependHS

binary-dist::
	@for i in $(BIN_DIST_SCRIPTS_NEEDING_RENAMING); do \
	     echo "Renaming $$i to $$i.prl"; \
	    $(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/$$i  $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/$$i.prl; \
	done
	@echo "Renaming hscpp to hscpp.prl"
	@$(MV) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/hscpp  $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/ghc-$(ProjectVersion)/hscpp.prl
139 140 141 142 143

dist :: dist-pre
include $(TOP)/mk/target.mk
dist :: dist-post

sof's avatar
sof committed
144 145
binary-dist::
	@echo "Mechanical and super-natty! Inspect the result and *if* happy; freeze, sell and get some sleep!"