blob: 517759a85e2f293c32f55ebb40c96288257a033b (
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
|
################################################################################
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_BIN))
SANDBOX := cabal.sandbox.config
XMINAD := dist/build/xminad/xminad
CABAL_FLAGS := --enable-optimization=2
CABAL_ADD_SOURCE ?=
DO_CHECK ?= NO
XMONAD ?= $(shell which xmonad)
DISPLAY ?= :0
################################################################################
.PHONEY: all install restart clean realclean
################################################################################
all: $(XMINAD)
################################################################################
install: $(TARGET)
################################################################################
restart: install
export DISPLAY=$(DISPLAY)
$(XMONAD) --restart
################################################################################
clean:
rm -rf dist $(XMINAD) $(CHECK) $(SANDBOX)
################################################################################
realclean:
rm -rf .cabal-sandbox
################################################################################
ifeq ($(DO_CHECK),YES)
CHECK = dist/build/checkrc/checkrc
else
CHECK = :
endif
################################################################################
$(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
|