forked from SWI-Prolog/swish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
81 lines (61 loc) · 2 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
# Copyright: VU University of Amsterdam, CWI Amsterdam
# License: Simplified BSD license
BOWER_ARCHIVE=swish-bower-components.zip
BOWER_URL=http://www.swi-prolog.org/download/swish/${BOWER_ARCHIVE}
SWIPL=swipl
# Packs to download and configure. Run `git submodule` to see the
# available packs.
PACKS=profile rserve_client smtp pcache
all:
@echo "Targets"
@echo
@echo " bower-zip -- Download zip with bower dependencies"
@echo " bower -- Install dependencies using bower"
@echo " src -- Prepare bower dependencies for execution"
@echo " min -- Create minimized CSS and JavaScript"
@echo " clean -- Clean minimized CSS and JavaScript"
@echo " packs -- Download and configure packs"
@echo
bower::
bower install
@$(MAKE) src
src::
@$(MAKE) -C web patch
@$(MAKE) -C web/js src
# Build and clean minimized versions
min:: css js
css::
@$(MAKE) -C web/css
js::
@$(MAKE) -C web/js
clean::
@$(MAKE) -C web/css clean
@$(MAKE) -C web/js clean
# Install dependencies from downloaded zip holding bower components
bower-zip: .bower-senitel
.bower-senitel: $(BOWER_ARCHIVE)
unzip -q -u $(BOWER_ARCHIVE)
touch $@
$(BOWER_ARCHIVE)::
@if [ -e $(BOWER_ARCHIVE) ]; then \
curl -o $(BOWER_ARCHIVE) -z $(BOWER_ARCHIVE) $(BOWER_URL) ; \
else \
curl -o $(BOWER_ARCHIVE) $(BOWER_URL) ;\
fi
# Create the above
upload::
rm -f $(BOWER_ARCHIVE)
zip -r $(BOWER_ARCHIVE) web/bower_components
rsync $(BOWER_ARCHIVE) ops:/home/swipl/web/download/swish/$(BOWER_ARCHIVE)
################
# PACKS
PACKFILES=$(addprefix pack/, $(addsuffix /pack.pl, $(PACKS)))
ATTACH_PACKDIR=-g 'attach_packs(pack,[duplicate(replace),search(first)])'
packs: $(PACKFILES)
$(PACKFILES)::
@echo "Checking $(shell dirname $@) ..."
@if [ ! "`git submodule status $(shell dirname $@) | head -c 1`" = " " ]; then \
echo " Updating $(shell dirname $@) ..." ; \
git submodule update --init $(shell dirname $@) ; \
$(SWIPL) $(ATTACH_PACKDIR) -g 'pack_rebuild($(shell basename $$(dirname $@)))' -t halt ;\
fi