Skip to content

Commit

Permalink
support O= output directory on toplevel make
Browse files Browse the repository at this point in the history
respects both $(JULIAHOME)/Make.user and $(O)/Make.user
  • Loading branch information
vtjnash committed Sep 11, 2015
1 parent df4a918 commit 16d3812
Show file tree
Hide file tree
Showing 21 changed files with 313 additions and 250 deletions.
24 changes: 22 additions & 2 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Note:
## It is generally preferable to change these options, for
## your local machine, in a file named `Make.user` in this directory
## your local machine, in a file named `Make.user` in the toplevel
## and build directories

# OPENBLAS build options
OPENBLAS_TARGET_ARCH=
Expand Down Expand Up @@ -71,10 +72,26 @@ WITH_GC_DEBUG_ENV = 0
# Prevent picking up $ARCH from the environment variables
ARCH=

# pick up BUILDROOT from O= if it isn't already set (from recursive make)
ifeq ($(BUILDROOT),)
ifeq ("$(origin O)", "command line")
BUILDROOT := $(abspath $O)
BUILDDIR := $(abspath $(BUILDROOT)/$(shell $(JULIAHOME)/contrib/relative_path.sh $(JULIAHOME) $(SRCDIR)))
$(info $(shell printf '\033[32;1mBuilding into $(BUILDROOT)\033[0m')) # use printf to expand the escape sequences
else
BUILDROOT:=$(JULIAHOME)
endif
endif
export BUILDROOT

# we include twice to pickup user definitions better
# include from JULIAHOME first so that BUILDROOT can override
ifeq (exists, $(shell [ -e $(JULIAHOME)/Make.user ] && echo exists ))
include $(JULIAHOME)/Make.user
endif
ifeq (exists, $(shell [ -e $(BUILDROOT)/Make.user ] && echo exists ))
include $(BUILDROOT)/Make.user
endif

# disable automatic Makefile rules
.SUFFIXES:
Expand Down Expand Up @@ -110,7 +127,7 @@ includedir = $(prefix)/include
sysconfdir = $(prefix)/etc

# Directories where things get built into
build_prefix = $(JULIAHOME)/usr
build_prefix = $(BUILDROOT)/usr
build_staging = $(build_prefix)-staging
build_bindir = $(build_prefix)/bin
build_libdir = $(build_prefix)/lib
Expand Down Expand Up @@ -399,6 +416,9 @@ endif
ifeq (exists, $(shell [ -e $(JULIAHOME)/Make.user ] && echo exists ))
include $(JULIAHOME)/Make.user
endif
ifeq (exists, $(shell [ -e $(BUILDROOT)/Make.user ] && echo exists ))
include $(BUILDROOT)/Make.user
endif

ifeq ($(SANITIZE),1)
ifeq ($(SANITIZE_MEMORY),1)
Expand Down
219 changes: 116 additions & 103 deletions Makefile

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion base/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SRCDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
BUILDDIR := .
JULIAHOME := $(abspath $(SRCDIR)/..)
BUILDDIR ?= .
include $(JULIAHOME)/deps/Versions.make
include $(JULIAHOME)/Make.inc

Expand Down
2 changes: 2 additions & 0 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ function _atreplinit(repl)
end

function _start()
empty!(ARGS)
append!(ARGS, Core.ARGS)
opts = JLOptions()
try
(quiet,repl,startup,color_set,history_file) = process_options(opts,copy(ARGS))
Expand Down
2 changes: 1 addition & 1 deletion base/fs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export File,
import Base: uvtype, uvhandle, eventloop, fd, position, stat, close, write, read, read!, readbytes, isopen,
_sizeof_uv_fs, uv_error

include("file_constants.jl")
include(string(length(Core.ARGS)>=2?Core.ARGS[2]:"","file_constants.jl")) # include($BUILDROOT/base/file_constants.jl)

abstract AbstractFile <: IO

Expand Down
2 changes: 1 addition & 1 deletion base/libc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export FILE, TmStruct, strftime, strptime, getpid, gethostname, free, malloc, ca
errno, strerror, flush_cstdio, systemsleep, time
@windows_only export GetLastError, FormatMessage

include("errno.jl")
include(string(length(Core.ARGS)>=2?Core.ARGS[2]:"","errno_h.jl")) # include($BUILDROOT/base/errno_h.jl)

## RawFD ##

Expand Down
2 changes: 1 addition & 1 deletion base/pcre.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module PCRE

include("pcre_h.jl")
include(string(length(Core.ARGS)>=2?Core.ARGS[2]:"","pcre_h.jl")) # include($BUILDROOT/base/pcre_h.jl)

const PCRE_LIB = "libpcre2-8"

Expand Down
6 changes: 3 additions & 3 deletions base/rounding.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is a part of Julia. License is MIT: http:https://julialang.org/license

module Rounding
include("fenv_constants.jl")
include(UTF8String(vcat(length(Core.ARGS)>=2?Core.ARGS[2].data:"".data, "fenv_constants.jl".data))) # include($BUILDROOT/base/fenv_constants.jl)

export
RoundingMode, RoundNearest, RoundToZero, RoundUp, RoundDown, RoundFromZero,
Expand Down Expand Up @@ -41,8 +41,8 @@ function from_fenv(r::Integer)
end
end

set_rounding_raw{T<:Union{Float32,Float64}}(::Type{T},i::Integer) = ccall(:fesetround, Cint, (Cint,), i)
get_rounding_raw{T<:Union{Float32,Float64}}(::Type{T}) = ccall(:fegetround, Cint, ())
set_rounding_raw{T<:Union{Float32,Float64}}(::Type{T},i::Integer) = ccall(:fesetround, Int32, (Int32,), i)
get_rounding_raw{T<:Union{Float32,Float64}}(::Type{T}) = ccall(:fegetround, Int32, ())

set_rounding{T<:Union{Float32,Float64}}(::Type{T},r::RoundingMode) = set_rounding_raw(T,to_fenv(r))
get_rounding{T<:Union{Float32,Float64}}(::Type{T}) = from_fenv(get_rounding_raw(T))
Expand Down
3 changes: 1 addition & 2 deletions base/stream.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This file is a part of Julia. License is MIT: http:https://julialang.org/license

#TODO: Move stdio detection from C to Julia (might require some Clang magic)
include("uv_constants.jl")
include(string(length(Core.ARGS)>=2?Core.ARGS[2]:"","uv_constants.jl")) # include($BUILDROOT/base/uv_constants.jl)

import .Libc: RawFD, dup
@windows_only import .Libc: WindowsRawSocket
Expand Down
8 changes: 4 additions & 4 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ include("essentials.jl")
include("docs/bootstrap.jl")
include("base.jl")
include("reflection.jl")
include("build_h.jl")
include("version_git.jl")
include("c.jl")
include("options.jl")

# core operations & types
Expand Down Expand Up @@ -81,7 +78,10 @@ include("dict.jl")
include("set.jl")
include("iterator.jl")

# For OS specific stuff in I/O
# For OS specific stuff
include(UTF8String(vcat(length(Core.ARGS)>=2?Core.ARGS[2].data:"".data, "build_h.jl".data))) # include($BUILDROOT/base/build_h.jl)
include(UTF8String(vcat(length(Core.ARGS)>=2?Core.ARGS[2].data:"".data, "version_git.jl".data))) # include($BUILDROOT/base/version_git.jl)
include("c.jl")
include("osutils.jl")

# strings & printing
Expand Down
1 change: 1 addition & 0 deletions contrib/windows/msys_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ done
for i in share/julia/base/pcre_h.jl; do
$SEVENZIP e -y julia-installer.exe "\$_OUTDIR/$i" -obase >> get-deps.log
done
echo "override PCRE_INCL_PATH =" >> Make.user
# suppress "bash.exe: warning: could not find /tmp, please create!"
mkdir -p usr/Git/tmp
# Remove libjulia.dll if it was copied from downloaded binary
Expand Down
Loading

0 comments on commit 16d3812

Please sign in to comment.