-
Notifications
You must be signed in to change notification settings - Fork 108
/
globalmakevars
55 lines (37 loc) · 1.29 KB
/
globalmakevars
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
# this file is a -*- makefile -*-
#
# Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
#
# SPDX-License-Identifier: BSD-2-Clause
#
ifndef GLOBAL_MAKES_INCLUDED
GLOB_PFX := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
# user can use the globalmakevars.local file to provide their own definitions for
# variables
-include $(GLOB_PFX)/globalmakevars.local
CC ?= gcc
SML_COMPILER ?= mlton
#ifndef SML_COMPILER
#SML_COMPILER := $(if $(shell which mlton),mlton,poly)
#endif
ifndef ML_HOME
ML_HOME := $(shell $(GLOB_PFX)/../../isabelle/bin/isabelle getenv ML_HOME | perl -ne 'print (substr($$_,8))')
endif
ifndef LIBPOLY_DIR
LIBPOLY_DIR := $(ML_HOME)
endif
OS := $(shell uname)
MACOSP := $(findstring Darwin,$(OS))
DYLIB := $(if $(MACOSP),DYLD_LIBRARY_PATH,LD_LIBRARY_PATH)
DYLIB_SFX := $(if $(MACOSP),dylib,so)
POLY_MACHINE_LDFLAGS := $(if $(MACOSP),-segprot POLY rwx rwx,)
POLYCC := $(CC) $(POLY_CC_FLAGS) -L$(LIBPOLY_DIR) -lgmp -lpolymain -lpolyml -lstdc++ -lpthread -ldl $(POLY_MACHINE_LDFLAGS)
ifndef LIBPOLYML
LIBPOLYML := $(LIBPOLY_DIR)/libpolyml.$(DYLIB_SFX)
endif
DYLIB_VAL := $($(DYLIB))
SETDYLIB := $(DYLIB)=$(LIBPOLY_DIR)$(if $(DYLIB_VAL),:$(DYLIB_VAL),)
TOOLRUN_PFX := $(if $(findstring poly,$(SML_COMPILER)),$(SETDYLIB) ,)
POLY := $(SETDYLIB) $(ML_HOME)/poly
GLOBAL_MAKES_INCLUDED=true
endif