Makefile 1.88 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
# 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 = $(error "Define variable WEBSERVERDIR!")

# Definition of the Curry installation bin directory to be used:
export CURRYBIN=XXXCURRYBINXXX

12
# Executable of the Curry Package Manager CPM:
Michael Hanus 's avatar
Michael Hanus committed
13
CPM := $(CURRYBIN)/cypm
14

15
# The root directory of the sources of the Spicey application:
16 17
SRCDIR := $(CURDIR)/src

18
# The load path for the Spicey application:
19
export CURRYPATH := $(SRCDIR):$(SRCDIR)/Model
20 21 22

.PHONY: all
all:
23 24 25 26 27 28
	@echo "make: deploy install compile load run clean?"

# Install the packages required by the generated Spicey application:
.PHONY: install
install:
	$(CPM) install
29 30 31 32

# Compile the generated Spicey application:
.PHONY: compile
compile:
33
	$(CPM) exec $(CURRYBIN)/curry $(CURRYOPTIONS) :load Main :quit
34 35 36 37 38

# Load the generated Spicey application into the Curry system so that
# one can evaluate some expressions:
.PHONY: load
load:
39
	$(CPM) exec $(CURRYBIN)/curry $(CURRYOPTIONS) :load Main
40 41 42 43 44

# 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:
45
	$(CPM) exec $(CURRYBIN)/curry $(CURRYOPTIONS) :load Main :eval main :q
46 47 48 49 50 51

# Deploy the generated Spicey application, i.e., install it in the
# web directory WEBSERVERDIR:
.PHONY: deploy
deploy:
	mkdir -p $(WEBSERVERDIR)
52
	$(CPM) exec $(CURRYBIN)/curry makecgi -standalone -m main -o $(WEBSERVERDIR)/spicey.cgi Main.curry
53
	# copy other files (style sheets, images,...)
54
	cp -r public/* $(WEBSERVERDIR)
55 56
	chmod -R go+rX $(WEBSERVERDIR)

57
# clean up generated the package directory
58 59
.PHONY: clean
clean: 
60 61 62 63 64 65 66
	$(CPM) clean

# clean everything, including the deployed files (be sure to save the
# database files first!)
.PHONY: cleanall
cleanall: clean
	/bin/rm -rf $(WEBSERVERDIR)