blob: 944972a2eb7b1f9babe0b8f57c61c0864352c882 (
plain)
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
|
################################################################################
ARCH := $(shell uname -m)
OS := $(shell uname -s | tr '[A-Z]' '[a-z]')
TARGET := $(HOME)/.xmonad/xmonad-$(ARCH)-$(OS)
SRC := $(shell find . -type f -name '*.hs')
CABAL_BIN ?= $(shell which cabal)
SANDBOX := cabal.sandbox.config
XMINAD := dist/build/xminad/xminad
CABAL_FLAGS := --enable-optimization=2
CABAL_ADD_SOURCE ?=
DO_CHECK ?= YES
XMONAD ?= $(shell which xmonad)
DISPLAY ?= :0
################################################################################
.PHONY: all build install restart clean realclean check pic
################################################################################
all: build
################################################################################
install: $(TARGET)
sed 's!{{DATA_DIR}}!$(HOME)/.local/share/xminad!' config/xmobar.config > $(HOME)/.xmobarrc
make -C pic install
################################################################################
build: $(XMINAD)
################################################################################
pic:
make -C pic
################################################################################
restart: install
export DISPLAY=$(DISPLAY)
$(XMONAD) --restart
################################################################################
clean:
rm -rf dist $(XMINAD) $(CHECK) $(SANDBOX)
make -C pic clean
################################################################################
realclean:
rm -rf .cabal-sandbox
################################################################################
check: build
$(CHECK)
cabal check
################################################################################
ifeq ($(DO_CHECK),YES)
CHECK = dist/build/checkrc/checkrc
else
CHECK = :
endif
################################################################################
build: $(XMINAD)
################################################################################
$(XMINAD): $(SRC) $(SANDBOX)
ghc -V
$(CABAL_BIN) build
$(CHECK)
################################################################################
$(SANDBOX):
$(CABAL_BIN) sandbox init
$(if $(CABAL_ADD_SOURCE),$(CABAL_BIN) sandbox add-source $(CABAL_ADD_SOURCE),)
$(CABAL_BIN) install $(CABAL_FLAGS) xmonad-extras -fwith_mpd -f-with_hint
$(CABAL_BIN) install --only-dependencies $(CABAL_FLAGS)
$(CABAL_BIN) configure $(CABAL_FLAGS)
touch $@
################################################################################
$(TARGET): $(XMINAD)
mkdir -p $(dir $@)
if [ -r $@ ]; then mv $@ $@.prev; fi
cp -p $? $@
cd $(dir $@) && ln -nfs $(notdir $@) xminad
|