Commit 823584fb authored by Michael Hanus's avatar Michael Hanus
Browse files

Makefile of spicey improved

parent 10cf57ff
......@@ -7,7 +7,7 @@ import SpiceyScaffolding
import Distribution
systemBanner =
let bannerText = "Spicey Web Framework (Version of 16/07/14)"
let bannerText = "Spicey Web Framework (Version of 30/07/14)"
bannerLine = take (length bannerText) (repeat '-')
in bannerLine ++ "\n" ++ bannerText ++ "\n" ++ bannerLine
......@@ -25,7 +25,7 @@ data DirTree =
| GeneratedFromERD (String -> String -> String -> String -> IO ())
-- takes an operation to generate code from ERD specification
structure =
spiceyStructure =
Directory "." [
ResourceFile NoExec "README.txt",
ResourcePatchFile NoExec "Makefile" replaceCurryDir,
......@@ -140,7 +140,7 @@ createStructure target_path generator_path term_path db_path
(GeneratedFromERD generatorFunction) = do
putStrLn $ "Generating from term file " ++ term_path ++ " ..."
generatorFunction generator_path term_path target_path db_path
--- The main operation to start the scaffolding.
--- The argument is the directory containing the project generator.
main generatordir = do
......@@ -149,9 +149,14 @@ main generatordir = do
args <- getArgs
case args of
["--dbpath",dbpath,termfile] ->
createStructure curdir generatordir termfile dbpath structure
[termfile] -> createStructure curdir generatordir termfile "." structure
createStructure curdir generatordir termfile dbpath spiceyStructure
[termfile] ->
createStructure curdir generatordir termfile "." spiceyStructure
_ -> putStrLn ("Wrong argument!\n" ++ helpText) >> exitWith 1
putStrLn $ take 70 (repeat '-')
putStrLn "Source files for the application generated.\n"
putStrLn "IMPORTANT NOTE: Before you deploy your web application (by 'make deploy'),"
putStrLn "you should define the variable WEBSERVERDIR in the Makefile!"
helpText =
"Usage: spiceup [--dbpath <dirpath>] <ERD term file>\n" ++
......
# Generic Makefile for Spicey applications
# Target directory where the compiled cgi programs, style sheets, etc
# should be stored:
WEBSERVERDIR=$(HOME)/public_html
# 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,21 +12,12 @@ export CURRYSYSTEM=XXXCURRYSYSTEMXXX
# The root directory of the sources of the Spicey application:
SRCDIR := $(CURDIR)
# The load path for the Spicey application:
export CURRYPATH := $(SRCDIR)/views:$(SRCDIR)/controllers:$(SRCDIR)/models:$(SRCDIR)/system:$(SRCDIR)/config:$(SRCDIR)/helpers
export CURRYPATH := $(SRCDIR)/views:$(SRCDIR)/controllers:$(SRCDIR)/models:$(SRCDIR)/system:$(SRCDIR)/config
.PHONY: all
all:
@echo "make: deploy compile load run clean?"
# Deploy the generated Spicey application, i.e., install it in the
# web pages:
.PHONY: deploy
deploy:
$(CURRYBIN)/makecurrycgi -standalone -m main -o $(WEBSERVERDIR)/spicey.cgi Main.curry
# copy other files (style sheets, images,...)
cp -r $(SRCDIR)/public/* $(WEBSERVERDIR)
chmod -R go+rX $(WEBSERVERDIR)
# Compile the generated Spicey application:
.PHONY: compile
compile:
......@@ -44,6 +35,16 @@ load:
run:
$(CURRYBIN)/$(CURRYSYSTEM) :load Main :eval main :quit
# Deploy the generated Spicey application, i.e., install it in the
# web directory WEBSERVERDIR:
.PHONY: deploy
deploy:
mkdir -p $(WEBSERVERDIR)
$(CURRYBIN)/makecurrycgi -standalone -m main -o $(WEBSERVERDIR)/spicey.cgi Main.curry
# copy other files (style sheets, images,...)
cp -r $(SRCDIR)/public/* $(WEBSERVERDIR)
chmod -R go+rX $(WEBSERVERDIR)
# clean up generated programs
.PHONY: clean
clean:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment