1 # SPDX-FileCopyrightText: 2022 Frank Doepper
3 # SPDX-License-Identifier: GPL-3.0-only
7 flavour = $(shell if stack --version >/dev/null 2>&1; then echo stack; elif cabal --version >/dev/null 2>&1; then echo cabal; else echo simple; fi)
8 parallel = $(filter -j%, $(MAKEFLAGS))
9 nix = $(if $(findstring nix,$(shell realpath `which stack`)),--nix,)
11 build: build-$(flavour)
12 $(MAKE) -C doc DESTDIR=$(DESTDIR) pfx=$(pfx) build
14 install: install-$(flavour) install-common
20 install-stack: build-stack
21 install -d -m755 $(DESTDIR)$(pfx)/bin
22 stack $(nix) --local-bin-path $(DESTDIR)$(pfx)/bin/ install
25 install -d -m755 $(DESTDIR)$(pfx)/lib/haskell-amqp-utils
26 install -m755 callback copy-to-hotfolder $(DESTDIR)$(pfx)/lib/haskell-amqp-utils/
27 install -m644 callback.config.sh $(DESTDIR)$(pfx)/lib/haskell-amqp-utils/
28 $(MAKE) -C doc DESTDIR=$(DESTDIR) pfx=$(pfx) install
32 cabal install --only-dependencies $(CONSTRAINTS)
34 cabal build $(parallel)
37 install-cabal: build-cabal
38 cabal install --prefix=$(DESTDIR)$(pfx)
41 ./Setup configure --prefix=$(pfx)
42 ./Setup build $(parallel)
44 install-simple: build-simple
45 ./Setup copy --destdir=$(DESTDIR)
47 all: $(subst .hs,,$(wildcard *.hs))
54 $(MAKE) -C doc ../README.md
57 rm -f Network/AMQP/Utils/*.hi Network/AMQP/Utils/*.o *.hi *.o $(subst .hs,,$(wildcard *.hs))
62 rm -f $(DESTDIR)$(pfx)/lib/haskell-amqp-utils/callback
63 rm -f $(DESTDIR)$(pfx)/lib/haskell-amqp-utils/copy-to-hotfolder
64 rm -f $(DESTDIR)$(pfx)/lib/haskell-amqp-utils/callback.config.sh
65 rm -f $(DESTDIR)$(pfx)/bin/konsum
66 rm -f $(DESTDIR)$(pfx)/bin/agitprop
67 rm -f $(DESTDIR)$(pfx)/bin/arbeite
68 rm -f $(DESTDIR)$(pfx)/bin/plane
69 -rmdir $(DESTDIR)$(pfx)/lib/haskell-amqp-utils