forked from wslutilities/wslu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (43 loc) · 1.31 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
AUTOMAKE_OPTIONS = foreign
HEADER = src/wslu-header
OUTPATH = out
CURPATH = $(shell pwd)
SOURCES := $(wildcard src/*.sh)
ETCFILES := $(wildcard src/etc/*)
OUTFILES := $(wildcard out/*)
MANFILES := $(wildcard docs/*)
INSTEDEXES := $(wildcard /usr/bin/wsl*)
INSTEDMANS := $(wildcard /usr/share/man/man1/wsl*)
all:
[ -d $(OUTPATH) ] || mkdir $(OUTPATH)
for file in $(SOURCES); do \
cat $(HEADER) $$file > $(OUTPATH)/`basename $$file`; \
mv $(OUTPATH)/`basename $$file` $(OUTPATH)/`basename $$file .sh`; \
done
chmod +x $(OUTPATH)/*
link:
for file in $(OUTFILES); do \
ln -s $(CURPATH)/$$file /usr/bin/`basename $$file`; \
done
for file in $(MANFILES); do \
ln -s $(CURPATH)/$$file /usr/share/man/man1/`basename $$file`; \
done
ln -s $(CURPATH)/src/etc /usr/share/wslu
install:
install -m755 out/* /usr/bin
install -m555 docs/* /usr/share/man/man1
[ -d /usr/share/wslu ] || mkdir -p /usr/share/wslu
cp src/etc/* /usr/share/wslu
uninstall:
for f in $(INSTEDEXES); do \
rm -f $$f; \
done
for f in $(INSTEDMANS); do \
rm -f $$f; \
done
rm -rf /usr/share/wslu
clean:
rm -rf $(OUTPATH)
test:
PATH="$$CURRENT_PATH/src:$$CURRENT_PATH/out:$$PATH"
extras/bats/libexec/bats tests/header.bats tests/wslsys.bats tests/wslusc.bats tests/wslupath.bats tests/wslvar.bats tests/wslfetch.bats tests/wslview.bats