forked from merces/bashacks
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
29 lines (25 loc) · 785 Bytes
/
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
INTERNAL = $(shell find src/internal -type f -name '*.sh')
PLUGINS = $(shell find src/ -type f -name '*.sh' -not -path 'src/internal/*')
OUTFILE = bashacks.sh
BASHRCFILE = ~/.profile
BASHACKS = `pwd`/$(OUTFILE)
all:
if [ -e "$(OUTFILE)" ]; then \
cp -vi "$(OUTFILE)" "$(OUTFILE).$$(date +%Y%m%d)"; \
echo -n > "$(OUTFILE)"; \
fi
for file in $(INTERNAL) $(PLUGINS); do \
cat $$file >> $(OUTFILE); \
echo >> $(OUTFILE); \
done
tr -d \\r < $(OUTFILE) > $(OUTFILE).tmp
mv $(OUTFILE).tmp $(OUTFILE)
install:
ifeq ("$(wildcard $(OUTFILE))","")
$(error $(OUTFILE) not found. Try: make)
endif
echo -e "\n[[ -e $(shell pwd)/$(OUTFILE) ]] && source $(shell pwd)/$(OUTFILE)" >> $(BASHRCFILE)
clean:
rm -f bashacks.sh
uninstall:
sed -i .bak "/bashacks\.sh/d" $(BASHRCFILE)