-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
110 lines (87 loc) · 3.02 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Generic Makefile for Spicey applications
CURRYOPTIONS=:set -time
# Target directory where the compiled cgi programs, style sheets, etc
# should be stored, e.g.: $(HOME)/public_html
WEBSERVERDIR=$(HOME)/public_html/SAMHANUS/SAM/wine
# Directory containing wine data:
DATADIR=$(WEBSERVERDIR)/../wineData
# Definition of the root of the Curry system to be used:
#export SYSTEM=/opt/pakcs
export SYSTEM=/opt/kics2
# Curry bin directory to be used:
export CURRYBIN=$(SYSTEM)/bin
CURRYOPTIONS=:set -time
# Executable of the Curry Package Manager CPM:
CPM := $(CURRYBIN)/cypm
# The root directory of the sources of the Spicey application:
SRCDIR := $(CURDIR)/src
# Executable of the curry2cgi:
CURRY2CGI := $(shell which curry2cgi)
############################################################################
.PHONY: all
all:
@echo "make: deploy install compile load run save restore clean?"
# Install the packages required by the generated Spicey application:
.PHONY: install
install:
$(CPM) install
# check presence of tools required for deployment and install them:
.PHONY: checkdeploy
checkdeploy:
@if [ ! -x "$(CURRY2CGI)" ] ; then \
echo "Installing required executable 'curry2cgi'..." ; \
$(CPM) install html2 ; fi
# Compile the generated Spicey application:
.PHONY: compile
compile:
$(CURRYBIN)/curry $(CURRYOPTIONS) :load Main :quit
# Load the generated Spicey application into the Curry system so that
# one can evaluate some expressions:
.PHONY: load
load:
$(CURRYBIN)/curry $(CURRYOPTIONS) :load Main
# Runs the generated Spicey application by evaluating the main expression.
# This might be useful to test only the initial web page without a web server
.PHONY: run
run:
$(CURRYBIN)/curry $(CURRYOPTIONS) :load Main :eval main :q
# Deploy the generated Spicey application, i.e., install it in the
# web directory WEBSERVERDIR:
.PHONY: deploy
deploy: checkdeploy
mkdir -p $(WEBSERVERDIR)
$(MAKE) $(WEBSERVERDIR)/spicey.cgi
# copy other files (style sheets, images,...)
cp -r public/* $(WEBSERVERDIR)
chmod -R go+rX $(WEBSERVERDIR)
# be sure that the data directory exists:
mkdir -p $(DATADIR)
chmod 700 $(DATADIR)
# recreate directory for storing local session data:
/bin/rm -rf $(WEBSERVERDIR)/sessiondata
mkdir -p $(WEBSERVERDIR)/sessiondata
chmod 700 $(WEBSERVERDIR)/sessiondata
.PHONY: cgi
cgi: $(WEBSERVERDIR)/spicey.cgi
$(WEBSERVERDIR)/spicey.cgi: src/*.curry src/*/*.curry
$(CURRY2CGI) --cpm="$(CPM)" --system="$(SYSTEM)" \
-i Controller.Category \
-i Controller.SpiceySystem \
-i Controller.Wine \
-o $@ Main.curry
# Save the current database in term files
.PHONY: save
save:
cd $(SRCDIR)/Model && $(CURRYBIN)/curry $(CURRYOPTIONS) :load Wine :eval saveDB :q
# Restore the current database from term files
.PHONY: save
restore:
cd $(SRCDIR)/Model && $(CURRYBIN)/curry $(CURRYOPTIONS) :load Wine :eval restoreDB :q
# clean up generated the package directory
.PHONY: clean
clean:
$(CPM) clean
# clean everything, including the deployed files
.PHONY: cleanall
cleanall: clean
/bin/rm -rf $(WEBSERVERDIR)