-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
112 lines (88 loc) · 3.12 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# NOTE:
#
# This Makefile is very much tailored to the maintainer's environment.
# It might work for you, but don't expect much.
# Implementation notes:
#
# The "test" and "build" targets simply build mellon-web, as it
# depends on both of the other packages. Testing/building just this
# package ensures that everything is built only once under Nix,
# whereas building each package separately causes each dependent
# "mellon" package to be built (and tested) again, needlessly.
SUBPROJECTS = mellon-core \
mellon-gpio \
mellon-web
NIXPKGS := $(shell nix eval -f nix/lib/fetch-nixpkgs.nix pkgs.path)
nix-build-testing-attr = nix-build --no-out-link nix/jobsets/testing.nix -I nixpkgs=$(NIXPKGS) -A $(1)
nix-build-testing = nix-build --no-out-link nix/jobsets/testing.nix -I nixpkgs=$(NIXPKGS)
nix-build-attr = nix-build --no-out-link nix/jobsets/release.nix -I nixpkgs=$(NIXPKGS) -A $(1)
nix-build = nix-build --no-out-link nix/jobsets/release.nix -I nixpkgs=$(NIXPKGS)
mellon: nix
$(call nix-build-testing)
mellon-%: nix
$(call nix-build-testing-attr,mellon-$*)
nixpkgs: nix
$(call nix-build-attr,nixpkgs)
release: nix
$(call nix-build)
test: build
$(MAKE) -C mellon-web test
build: nix
$(MAKE) -C mellon-web build
help:
@echo "Targets:"
@echo
@echo "(Default is 'mellon')"
@echo
@echo "Cabal/Nix:"
@echo
@echo "The following targets assume that you are running Nix with some version"
@echo "of cabal and GHC in your environment."
@echo
@echo " mellon - build all mellon packages against nixpkgs using nix-build (quick)"
@echo " mellon-core - build just mellon-core against nixpkgs using nix-build (quick)"
@echo " mellon-gpio - build just mellon-gpio against nixpkgs using nix-build (quick)"
@echo " mellon-web - build just mellon-web against nixpkgs using nix-build (quick)"
@echo " nixpkgs - build mellon against nixpkgs using nix-build"
@echo " release - Run nix-build on all release.nix targets"
@echo
@echo " test - configure and build the package, then run the tests (cabal)"
@echo " build - configure and build the package (cabal)"
@echo " configure - configure the package (cabal)"
@echo
@echo "Stack/Nix:"
@echo
@echo "The following targets build and test the package with Stack, using the"
@echo "given version of Stackage LTS as configured by the file stack-<target>.yaml."
@echo
@echo " stack-lts [build all supported LTS targets]"
@echo
@echo "General:"
@echo
@echo " clean - remove all targets"
@echo " help - show this message"
nix:
@for proj in $(SUBPROJECTS); do \
$(MAKE) -C $$proj nix; \
done
doc:
@for proj in $(SUBPROJECTS); do \
$(MAKE) -C $$proj doc; \
done
sdist: check doc
@for proj in $(SUBPROJECTS); do \
$(MAKE) -C $$proj sdist; \
done
check:
@for proj in $(SUBPROJECTS); do \
$(MAKE) -C $$proj check; \
done
clean:
@for proj in $(SUBPROJECTS); do \
$(MAKE) -C $$proj clean; \
done
nix-stack = nix-shell -p stack-env zlib libiconv ncurses --run 'stack test --stack-yaml $(1)'
stack-lts: stack-lts-13
stack-lts-%: nix
$(call nix-stack, stack-lts-$*.yaml)
.PHONY: clean nix nix-build