Commit 35dd4e73 authored by Michael Hanus 's avatar Michael Hanus
Browse files

Makefiles updated so that the front end can be constructed and all...

Makefiles updated so that the front end can be constructed and all Haskell-specific stuff is removed from PAKCS Makefile
parent 6cdae068
The PAKCS (Portland Aachen Kiel Curry System) License
Copyright (c) 2015, University of Kiel
Copyright (c) 2000-2016, Michael Hanus (University of Kiel)
All rights reserved.
Redistribution and use in source and binary forms, with or without
......@@ -29,10 +29,3 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
NOTE:
This software contains a modified version of the front end of
the Muenster Curry Compiler (see subdirectory "frontend") which
is copyrighted by Wolfgang Lux (see the LICENSE file there for details).
The corresponding copyright notice must be retained in redistributions.
......@@ -36,6 +36,8 @@ export CURRYSYSTEM=pakcs
export ROOT=$(CURDIR)
# binary directory and executables
export BINDIR=$(ROOT)/bin
# Directory where the front end is located
export FRONTENDDIR = $(ROOT)/frontend
# Directory where the libraries are located
export LIBDIR = $(ROOT)/lib
# Directory where the documentation files are located
......@@ -44,10 +46,6 @@ export DOCDIR = $(ROOT)/docs
C2PVERSION=$(ROOT)/curry2prolog/pakcsversion.pl
# The version information file for the manual:
MANUALVERSION=$(DOCDIR)/src/version.tex
# Directory where local package installations are stored
export LOCALPKG = $(ROOT)/pkg
# The path to the package database
export PKGDB = $(LOCALPKG)/pakcs.conf.d
# Various executables used in the installation
# --------------------------------------------
......@@ -56,7 +54,7 @@ export PKGDB = $(LOCALPKG)/pakcs.conf.d
export REPL = $(BINDIR)/$(CURRYSYSTEM)
# The default options for the REPL
export REPL_OPTS = --noreadline :set -time
# The frontend binary
# The front end binary
export CYMAKE = $(BINDIR)/cymake
# The cleancurry binary
export CLEANCURRY = $(BINDIR)/cleancurry
......@@ -64,39 +62,6 @@ export CLEANCURRY = $(BINDIR)/cleancurry
# Logfile for make:
MAKELOG=make.log
# GHC and CABAL configuration (for installing the front end)
# ----------------------------------------------------------
# The path to the Glasgow Haskell Compiler and Cabal
export GHC := $(shell which ghc)
export GHC-PKG := $(shell dirname "$(GHC)")/ghc-pkg
export CABAL = cabal
# Because of an API change in GHC 7.6,
# we need to distinguish GHC < 7.6 and GHC >= 7.6.
# GHC 7.6 renamed the option "package-conf" to "package-db".
# extract GHC version
ifdef GHC
GHC_MAJOR := $(shell "$(GHC)" --numeric-version | cut -d. -f1)
GHC_MINOR := $(shell "$(GHC)" --numeric-version | cut -d. -f2)
# Is the GHC version >= 7.6 ?
GHC_GEQ_76 = $(shell test $(GHC_MAJOR) -gt 7 -o \( $(GHC_MAJOR) -eq 7 \
-a $(GHC_MINOR) -ge 6 \) ; echo $$?)
# package-db (>= 7.6) or package-conf (< 7.6)?
ifeq ($(GHC_GEQ_76),0)
GHC_PKG_OPT = package-db
else
GHC_PKG_OPT = package-conf
endif
endif
# Command to unregister a package
export GHC_UNREGISTER = "$(GHC-PKG)" unregister --$(GHC_PKG_OPT)="$(PKGDB)"
# Command to install missing packages using cabal
export CABAL_INSTALL = "$(CABAL)" install --with-compiler="$(GHC)" \
--with-hc-pkg="$(GHC-PKG)" --prefix="$(LOCALPKG)" \
--global --package-db="$(PKGDB)" -O2
########################################################################
# The targets
########################################################################
......@@ -121,7 +86,7 @@ install: installscripts copylibs
@echo "PAKCS installation configuration (file pakcsinitrc):"
@cat pakcsinitrc
# install front end (if sources are present):
@if [ -d frontend ] ; then $(MAKE) frontend ; fi
@if [ -d $(FRONTENDDIR) ] ; then $(MAKE) frontend ; fi
# pre-compile all libraries:
@cd lib && $(MAKE) fcy
# install the Curry2Prolog compiler as a saved system:
......@@ -164,21 +129,12 @@ cleanscripts:
copylibs:
@if [ -d lib-trunk ] ; then cd lib-trunk && $(MAKE) -f Makefile.$(CURRYSYSTEM).install ; fi
# create package database
$(PKGDB):
"$(GHC-PKG)" init $@
$(CABAL) update
# install front end (if sources are present):
.PHONY: frontend
frontend:
ifdef GHC
$(MAKE) $(PKGDB)
cd frontend && $(MAKE)
else
@echo "GHC missing, cannot build front end!"
@exit 1
endif
rm -f $(CYMAKE)
cd $(FRONTENDDIR) && $(MAKE)
ln -s $(FRONTENDDIR)/bin/cymake $(CYMAKE)
# compile the tools:
.PHONY: tools
......@@ -253,7 +209,7 @@ clean: $(CLEANCURRY)
if [ -d $(DOCDIR)/src ] ; then cd $(DOCDIR)/src && $(MAKE) clean ; fi
cd bin && rm -f sicstusprolog swiprolog
cd scripts && $(MAKE) clean
if [ -d frontend ] ; then cd frontend && $(MAKE) clean ; fi
if [ -d $(FRONTENDDIR) ] ; then cd $(FRONTENDDIR) && $(MAKE) clean ; fi
# Clean the generated PAKCS tools
.PHONY: cleantools
......@@ -269,9 +225,8 @@ cleantools: $(CLEANCURRY)
.PHONY: cleanall
cleanall: clean
rm -rf $(LIBDIR)
rm -rf $(LOCALPKG)
-cd frontend && $(MAKE) cleanall
if [ -d frontend ]; then rm -rf $(BINDIR); fi
-cd $(FRONTENDDIR) && $(MAKE) cleanall
if [ -d $(FRONTENDDIR) ]; then rm -rf $(BINDIR); fi
rm -f pakcsinitrc pakcsinitrc.bak
......@@ -320,7 +275,7 @@ cleandist:
rm -rf .git .gitmodules .gitignore
rm -rf lib-trunk
rm -rf currytools/.git currytools/.gitignore
cd frontend/curry-base && rm -rf .git .gitignore dist
cd frontend/curry-frontend && rm -rf .git .gitignore dist
cd $(FRONTENDDIR)/curry-base && rm -rf .git .gitignore dist
cd $(FRONTENDDIR)/curry-frontend && rm -rf .git .gitignore dist
rm -rf docs/src
rm -f KNOWN_BUGS CHANGELOG.html
Subproject commit 6a9ae3fd54f435fd20404fdaee717c880dcb11e9
Subproject commit 5d908e8b3b016d59b7e1666dab6fd90216aeb145
# intermediate files
*~
*.bak
# binaries
bin/
Copyright (c) 1998-2004, Wolfgang Lux
Copyright (c) 2005-2016, Michael Hanus
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- None of the names of the copyright holders and contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
##############################################################################
# Installation of frontend
# Makefile for installing the Curry front end
##############################################################################
# the root directory of the installation
export ROOT=$(CURDIR)
# binary directory and executables
export BINDIR=$(ROOT)/bin
# The frontend binary
export CYMAKE = $(BINDIR)/cymake
# GHC and CABAL configuration (for installing the front end)
# ----------------------------------------------------------
# The path to the Glasgow Haskell Compiler and Cabal
export GHC := $(shell which ghc)
export GHC-PKG := $(shell dirname "$(GHC)")/ghc-pkg
export CABAL = cabal
# Because of an API change in GHC 7.6,
# we need to distinguish GHC < 7.6 and GHC >= 7.6.
# GHC 7.6 renamed the option "package-conf" to "package-db".
# extract GHC version
ifdef GHC
GHC_MAJOR := $(shell "$(GHC)" --numeric-version | cut -d. -f1)
GHC_MINOR := $(shell "$(GHC)" --numeric-version | cut -d. -f2)
# Is the GHC version >= 7.6 ?
GHC_GEQ_76 = $(shell test $(GHC_MAJOR) -gt 7 -o \( $(GHC_MAJOR) -eq 7 \
-a $(GHC_MINOR) -ge 6 \) ; echo $$?)
# package-db (>= 7.6) or package-conf (< 7.6)?
ifeq ($(GHC_GEQ_76),0)
GHC_PKG_OPT = package-db
else
GHC_PKG_OPT = package-conf
endif
endif
# Command to unregister a package
export GHC_UNREGISTER = "$(GHC-PKG)" unregister --$(GHC_PKG_OPT)="$(PKGDB)"
# Command to install missing packages using cabal
export CABAL_INSTALL = "$(CABAL)" install --with-compiler="$(GHC)" \
--with-hc-pkg="$(GHC-PKG)" --prefix="$(LOCALPKG)" \
--global --package-db="$(PKGDB)" -O2
# Directory where local package installations are stored
export LOCALPKG = $(ROOT)/pkg
# The path to the package database
export PKGDB = $(LOCALPKG)/pakcs.conf.d
##############################################################################
# Retrieve all Haskell modules as dependencies for cymake
DEPS := $(shell find curry-base/src/ curry-frontend/src/ -type f)
# install front end (if sources are present):
.PHONY: frontend
frontend:
ifdef GHC
$(MAKE) $(PKGDB)
$(MAKE) $(CYMAKE)
else
@echo "GHC missing, cannot build front end!"
@exit 1
endif
# create package database
$(PKGDB):
"$(GHC-PKG)" init $@
$(CABAL) update
# install the sources of the front end from its repository
$(CYMAKE): $(DEPS)
$(MAKE) unregister
......@@ -34,3 +96,4 @@ clean:
cleanall:
cd curry-base && rm -rf dist/
cd curry-frontend && rm -rf dist/
rm -rf $(LOCALPKG)
Curry Front End
===============
This directory contains a front end (lexer, parser, type checker etc)
for the programming language Curry.
It is used in the Curry distributions PAKCS and KiCS2.
The front end translates a Curry program into various
intermediate formats, like FlatCurry (used for program analyzers
and back ends), AbstractCurry (used for program manipulation tools),
or HTML (used for program documentation).
Subproject commit ed5b65669f2ef15da56db7796359219496675258
Subproject commit c9acf7c2abb13785624ae09c6ea5da89374a4a0b
Subproject commit 95a841fd4cb2a7edca4c66d60984edf0fba43e42
Subproject commit 0a3e19a0e8bd37df4f0d06bba7daa29e7c23bf52
Subproject commit 9a41db926ec2abb0dac6b088824165fc4626189c
Subproject commit 6131c210fd3bd919f9ef4a118df140644a3ce1dd
Markdown is supported
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