Commit 47493e60 authored by thomie's avatar thomie

Build system: simplify install.mk.in

This will allow fixing #1851 more easily
("make install-strip" should work).

This reverts 57e2a81c:
  "On Cygwin, use a Cygwin-style path for /bin/install's destination"

Update submodule haddock and hsc2hs.
parent 2f29ebbb
......@@ -49,9 +49,9 @@ install: install_man
.PHONY: install_man
install_man: $(MAN_PATH)
$(call INSTALL_DIR,"$(DESTDIR)$(mandir)")
$(call INSTALL_DIR,"$(DESTDIR)$(mandir)/man$(MAN_SECTION)")
$(call INSTALL_MAN,$(INSTALL_OPTS),$(MAN_PATH),"$(DESTDIR)$(mandir)/man$(MAN_SECTION)")
$(INSTALL_DIR) "$(DESTDIR)$(mandir)"
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man$(MAN_SECTION)"
$(INSTALL_MAN) $(INSTALL_OPTS) $(MAN_PATH) "$(DESTDIR)$(mandir)/man$(MAN_SECTION)"
endif
$(eval $(call clean-target,docs/man,,$(MAN_PATH) docs/man/flags.xsl docs/man/flags.xml))
......
......@@ -18,7 +18,7 @@ install: install_driver_ghci
.PHONY: install_driver_ghci
install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/ghci-$(ProjectVersion)
install_driver_ghci:
$(call INSTALL_DIR,"$(DESTDIR)$(bindir)")
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
$(call removeFiles, "$(WRAPPER)")
$(CREATE_SCRIPT) "$(WRAPPER)"
echo '#!$(SHELL)' >> "$(WRAPPER)"
......@@ -54,7 +54,7 @@ install : install_driver_ghcii
install_driver_ghcii: GHCII_SCRIPT=$(DESTDIR)$(bindir)/ghcii.sh
install_driver_ghcii: GHCII_SCRIPT_VERSIONED = $(DESTDIR)$(bindir)/ghcii-$(ProjectVersion).sh
install_driver_ghcii:
$(call INSTALL_DIR,$(DESTDIR)$(bindir))
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
$(call removeFiles,"$(GHCII_SCRIPT)")
echo "#!$(SHELL)" >> $(GHCII_SCRIPT)
echo 'exec "$$(dirname "$$0")"/ghc --interactive "$$@"' >> $(GHCII_SCRIPT)
......
......@@ -807,29 +807,29 @@ endif
define installLibsTo
# $1 = libraries to install
# $2 = directory to install to
$(call INSTALL_DIR,$2)
$(INSTALL_DIR) $2
for i in $1; do \
case $$i in \
*.a) \
$(call INSTALL_DATA,$(INSTALL_OPTS),$$i,$2); \
$(INSTALL_DATA) $(INSTALL_OPTS) $$i $2; \
$(RANLIB_CMD) $2/`basename $$i` ;; \
*.dll) \
$(call INSTALL_PROGRAM,$(INSTALL_OPTS),$$i,$2) ; \
$(INSTALL_PROGRAM) $(INSTALL_OPTS) $$i $2 ; \
$(STRIP_CMD) $2/`basename $$i` ;; \
*.so) \
$(call INSTALL_SHLIB,$(INSTALL_OPTS),$$i,$2) ;; \
$(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $2 ;; \
*.dylib) \
$(call INSTALL_SHLIB,$(INSTALL_OPTS),$$i,$2);; \
$(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $2;; \
*) \
$(call INSTALL_DATA,$(INSTALL_OPTS),$$i,$2); \
$(INSTALL_DATA) $(INSTALL_OPTS) $$i $2; \
esac; \
done
endef
install_bins: $(INSTALL_BINS)
$(call INSTALL_DIR,"$(DESTDIR)$(bindir)")
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
for i in $(INSTALL_BINS); do \
$(call INSTALL_PROGRAM,$(INSTALL_BIN_OPTS),$$i,"$(DESTDIR)$(bindir)") ; \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(bindir)" ; \
done
install_libs: $(INSTALL_LIBS)
......@@ -839,9 +839,9 @@ install_libexecs: $(INSTALL_LIBEXECS)
ifeq "$(INSTALL_LIBEXECS)" ""
@:
else
$(call INSTALL_DIR,"$(DESTDIR)$(ghclibexecdir)/bin")
$(INSTALL_DIR) "$(DESTDIR)$(ghclibexecdir)/bin"
for i in $(INSTALL_LIBEXECS); do \
$(call INSTALL_PROGRAM,$(INSTALL_BIN_OPTS),$$i,"$(DESTDIR)$(ghclibexecdir)/bin"); \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(ghclibexecdir)/bin"; \
done
# We rename ghc-stage2, so that the right program name is used in error
# messages etc.
......@@ -849,32 +849,32 @@ else
endif
install_topdirs: $(INSTALL_TOPDIRS)
$(call INSTALL_DIR,"$(DESTDIR)$(topdir)")
$(INSTALL_DIR) "$(DESTDIR)$(topdir)"
for i in $(INSTALL_TOPDIRS); do \
$(call INSTALL_PROGRAM,$(INSTALL_BIN_OPTS),$$i,"$(DESTDIR)$(topdir)"); \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(topdir)"; \
done
install_docs: $(INSTALL_DOCS)
$(call INSTALL_DIR,"$(DESTDIR)$(docdir)")
$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
ifneq "$(INSTALL_DOCS)" ""
for i in $(INSTALL_DOCS); do \
$(call INSTALL_DOC,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(docdir)"); \
$(INSTALL_DOC) $(INSTALL_OPTS) $$i "$(DESTDIR)$(docdir)"; \
done
endif
$(call INSTALL_DIR,"$(DESTDIR)$(docdir)/html")
$(call INSTALL_DOC,$(INSTALL_OPTS),docs/index.html,"$(DESTDIR)$(docdir)/html")
$(INSTALL_DIR) "$(DESTDIR)$(docdir)/html"
$(INSTALL_DOC) $(INSTALL_OPTS) docs/index.html "$(DESTDIR)$(docdir)/html"
ifneq "$(INSTALL_LIBRARY_DOCS)" ""
$(call INSTALL_DIR,"$(DESTDIR)$(docdir)/html/libraries")
$(INSTALL_DIR) "$(DESTDIR)$(docdir)/html/libraries"
for i in $(INSTALL_LIBRARY_DOCS); do \
$(call INSTALL_DOC,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(docdir)/html/libraries/"); \
$(INSTALL_DOC) $(INSTALL_OPTS) $$i "$(DESTDIR)$(docdir)/html/libraries/"; \
done
$(call INSTALL_DATA,$(INSTALL_OPTS),libraries/prologue.txt,"$(DESTDIR)$(docdir)/html/libraries/")
$(call INSTALL_SCRIPT,$(INSTALL_OPTS),libraries/gen_contents_index,"$(DESTDIR)$(docdir)/html/libraries/")
$(INSTALL_DATA) $(INSTALL_OPTS) libraries/prologue.txt "$(DESTDIR)$(docdir)/html/libraries/"
$(INSTALL_SCRIPT) $(INSTALL_OPTS) libraries/gen_contents_index "$(DESTDIR)$(docdir)/html/libraries/"
endif
ifneq "$(INSTALL_HTML_DOC_DIRS)" ""
for i in $(INSTALL_HTML_DOC_DIRS); do \
$(call INSTALL_DIR,"$(DESTDIR)$(docdir)/html/`basename $$i`"); \
$(call INSTALL_DOC,$(INSTALL_OPTS),$$i/*,"$(DESTDIR)$(docdir)/html/`basename $$i`"); \
$(INSTALL_DIR) "$(DESTDIR)$(docdir)/html/`basename $$i`"; \
$(INSTALL_DOC) $(INSTALL_OPTS) $$i/* "$(DESTDIR)$(docdir)/html/`basename $$i`"; \
done
endif
......@@ -898,10 +898,10 @@ INSTALL_DISTDIR_compiler = stage2
# Now we can do the installation
install_packages: install_libexecs
install_packages: rts/dist/package.conf.install
$(call INSTALL_DIR,"$(DESTDIR)$(topdir)")
$(INSTALL_DIR) "$(DESTDIR)$(topdir)"
$(call removeTrees,"$(INSTALLED_PACKAGE_CONF)")
$(call INSTALL_DIR,"$(INSTALLED_PACKAGE_CONF)")
$(call INSTALL_DIR,"$(DESTDIR)$(topdir)/rts")
$(INSTALL_DIR) "$(INSTALLED_PACKAGE_CONF)"
$(INSTALL_DIR) "$(DESTDIR)$(topdir)/rts"
$(call installLibsTo, $(RTS_INSTALL_LIBS), "$(DESTDIR)$(topdir)/rts")
$(foreach p, $(INSTALL_PACKAGES), \
$(call make-command, \
......
......@@ -226,10 +226,10 @@ install: install_includes
.PHONY: install_includes
install_includes :
$(call INSTALL_DIR,"$(DESTDIR)$(ghcheaderdir)")
$(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)"
$(foreach d,$(includes_H_SUBDIRS), \
$(call INSTALL_DIR,"$(DESTDIR)$(ghcheaderdir)/$d") && \
$(call INSTALL_HEADER,$(INSTALL_OPTS),includes/$d/*.h,"$(DESTDIR)$(ghcheaderdir)/$d/") && \
$(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)/$d" && \
$(INSTALL_HEADER) $(INSTALL_OPTS) includes/$d/*.h "$(DESTDIR)$(ghcheaderdir)/$d/" && \
) true
$(call INSTALL_HEADER,$(INSTALL_OPTS),$(includes_H_CONFIG) $(includes_H_PLATFORM) $(includes_H_VERSION) $(includes_DERIVEDCONSTANTS),"$(DESTDIR)$(ghcheaderdir)/")
$(INSTALL_HEADER) $(INSTALL_OPTS) $(includes_H_CONFIG) $(includes_H_PLATFORM) $(includes_H_VERSION) $(includes_DERIVEDCONSTANTS) "$(DESTDIR)$(ghcheaderdir)/"
......@@ -132,21 +132,15 @@ INSTALL_GROUP =
#
CREATE_SCRIPT = create () { touch "$$1" && chmod 755 "$$1" ; } && create
CREATE_DATA = create () { touch "$$1" && chmod 644 "$$1" ; } && create
# These takes 3 arguments:
# $1 = flags
# $2 = files
# $3 = dest
INSTALL_PROGRAM = $(INSTALL) -m 755 $1 $2 $(call MK_INSTALL_DEST,$3)
INSTALL_SCRIPT = $(INSTALL) -m 755 $1 $2 $(call MK_INSTALL_DEST,$3)
INSTALL_SHLIB = $(INSTALL) -m 755 $1 $2 $(call MK_INSTALL_DEST,$3)
INSTALL_DATA = $(INSTALL) -m 644 $1 $2 $(call MK_INSTALL_DEST,$3)
INSTALL_HEADER = $(INSTALL) -m 644 $1 $2 $(call MK_INSTALL_DEST,$3)
INSTALL_MAN = $(INSTALL) -m 644 $1 $2 $(call MK_INSTALL_DEST,$3)
INSTALL_DOC = $(INSTALL) -m 644 $1 $2 $(call MK_INSTALL_DEST,$3)
# Only 1 argument, the directory to create:
INSTALL_DIR = $(INSTALL) -m 755 -d $(call MK_INSTALL_DEST,$1)
MK_INSTALL_DEST = $1
INSTALL_PROGRAM = $(INSTALL) -m 755
INSTALL_SCRIPT = $(INSTALL) -m 755
INSTALL_SHLIB = $(INSTALL) -m 755
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_HEADER = $(INSTALL) -m 644
INSTALL_MAN = $(INSTALL) -m 644
INSTALL_DOC = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -m 755 -d
# runhaskell and hsc2hs are special, in that other compilers besides
# GHC might provide them. Systems with a package manager often come
......
......@@ -578,8 +578,8 @@ endif
.PHONY: install_libffi_headers
install_libffi_headers :
$(call INSTALL_DIR,"$(DESTDIR)$(ghcheaderdir)")
$(call INSTALL_HEADER,$(INSTALL_OPTS),$(libffi_HEADERS),"$(DESTDIR)$(ghcheaderdir)/")
$(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)"
$(INSTALL_HEADER) $(INSTALL_OPTS) $(libffi_HEADERS) "$(DESTDIR)$(ghcheaderdir)/"
# -----------------------------------------------------------------------------
# cleaning
......
......@@ -77,7 +77,7 @@ install: install_$1_$2_wrapper
.PHONY: install_$1_$2_wrapper
install_$1_$2_wrapper: WRAPPER=$$(DESTDIR)$$(bindir)/$(CrossCompilePrefix)$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)
install_$1_$2_wrapper:
$$(call INSTALL_DIR,"$$(DESTDIR)$$(bindir)")
$$(INSTALL_DIR) "$$(DESTDIR)$$(bindir)"
$$(call removeFiles, "$$(WRAPPER)")
$$(CREATE_SCRIPT) "$$(WRAPPER)"
echo '#!$$(SHELL)' >> "$$(WRAPPER)"
......
......@@ -78,7 +78,7 @@ install: install_utils/ghc-pkg_link
.PHONY: install_utils/ghc-pkg_link
install_utils/ghc-pkg_link:
$(call INSTALL_DIR,"$(DESTDIR)$(bindir)")
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
$(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc-pkg")
$(LN_S) $(CrossCompilePrefix)ghc-pkg-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc-pkg"
endif
Subproject commit 62f3a12863121fa5b6c2787185e62cfa3f44bdd6
Subproject commit 6a1d4a65010932a660ceacda93c8c20fb5e1399d
Subproject commit a281856375beaf9082010c445599446faad6beb9
Subproject commit 293f41c78e956b78363ede463e7ff52eb6bc997d
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment