@@ -183,16 +183,21 @@ uninstall-lib-doc:
183183 -rm -rf $(LIBDOCPATH)/html
184184 -rmdir $(LIBDOCPATH)
185185
186−# Program only installation.
187−.PHONY: install-exec uninstall-exec
188−install-exec: build-exec
189− $(INSTALL) -d $(BINPATH); \
190− for f in $(PROGS); do \
186+# Helper to install the given files $(1) into the path $(2).
187+# It also has the ability to follow symlinks.
188+install-executable-files = \
189+ $(INSTALL) -d $(2); \
190+ for f in $(1); do \
191191 if [ -L $$f ]; then \
192192 f=$$(readlink $$f); \
193193 fi; \
194− $(INSTALL_PROGRAM) $$f $(BINPATH)/; \
194+ $(INSTALL_PROGRAM) $$f $(2)/; \
195195 done
196+
197+# Program only installation.
198+.PHONY: install-exec uninstall-exec
199+install-exec: build-exec
200+ $(call install-executable-files,$(PROGS),$(BINPATH))
196201uninstall-exec:
197202 -for f in $(notdir $(PROGS)); do rm -f $(BINPATH)/$$f; done ;
198203
@@ -203,7 +208,8 @@ uninstall-program: uninstall-exec uninstall-doc
203208
204209# Install everything.
205210.PHONY: install-all uninstall-all
206−install-all: install-doc install-lib-doc
211+install-all: build-exec install-doc install-lib-doc
212+ # Install the library (+ main executable) and register it.
207213 destdir=$(DESTDIR); \
208214 # Older Cabal versions have no '--destdir' option.
209215 if $(BUILDCMD) copy --help | grep -q '\-\-destdir'; then \
@@ -213,6 +219,9 @@ install-all: install-doc install-lib-doc
213219 fi; \
214220 $(BUILDCMD) copy $$opt; \
215221 $(BUILDCMD) register
222+ # Note that, we are in the position of having to install the wrappers
223+ # separately, as Cabal installs the main exec along with the library.
224+ $(call install-executable-files,$(WRAPPERS),$(BINPATH))
216225uninstall-all: uninstall-exec uninstall-doc uninstall-lib-doc
217226 -pkg_id="$(NAME)-$(VERSION)"; \
218227 libdir=$$($(GHC_PKG) field $$pkg_id library-dirs 2>/dev/null | \