Skip to content

Commit

Permalink
[ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao committed Jun 18, 2015
1 parent a6edfc4 commit 730afa1
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 34 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,9 @@ add_subdirectory(contrib)
add_subdirectory(src)
add_subdirectory(doc)
add_subdirectory(ui)
add_subdirectory(base)

add_custom_target(julia ALL
DEPENDS libccalltest stringreplace julia-ui julia_symlink
DEPENDS libccalltest stringreplace julia-ui julia_symlink julia-copy-all-base
COMMAND make ${jl_make_flags}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ CORE_SRCS := base/boot.jl base/coreimg.jl \
BASE_SRCS := $(wildcard base/*.jl base/*/*.jl base/*/*/*.jl)

$(build_private_libdir)/inference0.o: $(CORE_SRCS)
@$(call PRINT_JULIA, cd base && \
@$(call PRINT_JULIA, cd $(CMAKE_BINARY_DIR)/base && \
$(call spawn,$(JULIA_EXECUTABLE)) -C $(JULIA_CPU_TARGET) --build $(call cygpath_w,$(build_private_libdir)/inference0) -f \
coreimg.jl)

$(build_private_libdir)/inference.o: $(build_private_libdir)/inference0.$(SHLIB_EXT)
@$(call PRINT_JULIA, cd base && \
@$(call PRINT_JULIA, cd $(CMAKE_BINARY_DIR)/base && \
$(call spawn,$(JULIA_EXECUTABLE)) -C $(JULIA_CPU_TARGET) --build $(call cygpath_w,$(build_private_libdir)/inference) -f \
-J $(call cygpath_w,$(build_private_libdir)/inference0.ji) coreimg.jl)

COMMA:=,
$(build_private_libdir)/sys.o: VERSION $(BASE_SRCS) $(build_docdir)/helpdb.jl $(build_private_libdir)/inference.$(SHLIB_EXT)
@$(call PRINT_JULIA, cd base && \
@$(call PRINT_JULIA, cd $(CMAKE_BINARY_DIR)/base && \
$(call spawn,$(JULIA_EXECUTABLE)) -C $(JULIA_CPU_TARGET) --build $(call cygpath_w,$(build_private_libdir)/sys) -f \
-J $(call cygpath_w,$(build_private_libdir)/inference.ji) sysimg.jl \
|| { echo '*** This error is usually fixed by running `make clean`. If the error persists$(COMMA) try `make cleanall`. ***' && false; } )
Expand Down
252 changes: 252 additions & 0 deletions base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
#

add_custom_target(julia-copy-all-base)

function(copy_jl src)
if("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
return()
endif()
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${src}"
COMMAND "${CMAKE_COMMAND}" -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/${src}"
"${CMAKE_CURRENT_BINARY_DIR}/${src}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
# TODO maybe handle other invalid target names too
string(REPLACE "/" "-" target "${src}")
add_custom_target(julia-copy-base-${target}
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${src}")
add_dependencies(julia-copy-all-base julia-copy-base-${target})
endfunction()

set(core_img_SRCS
coreimg.jl
essentials.jl
reflection.jl
options.jl
promotion.jl
tuple.jl
range.jl
expr.jl
error.jl
bool.jl
number.jl
int.jl
operators.jl
pointer.jl
abstractarray.jl
array.jl
hashing.jl
nofloat_hashing.jl
functors.jl
reduce.jl
intset.jl
dict.jl
iterator.jl
inference.jl)

# Not including duplicated ones in coreimg
set(sys_img_SRCS
Dates.jl
Enums.jl
LineEdit.jl
REPL.jl
REPLCompletions.jl
Terminals.jl
abstractarraymath.jl
arraymath.jl
ascii.jl
base.jl
base64.jl
basedocs.jl
bitarray.jl
boot.jl
broadcast.jl
c.jl
cartesian.jl
char.jl
client.jl
collections.jl
combinatorics.jl
complex.jl
constants.jl
dSFMT.jl
datafmt.jl
dates/accessors.jl
dates/adjusters.jl
dates/arithmetic.jl
dates/conversions.jl
dates/io.jl
dates/periods.jl
dates/query.jl
dates/ranges.jl
dates/types.jl
deepcopy.jl
deprecated.jl
docs.jl
dsp.jl
emoji_symbols.jl
env.jl
errno.jl
exports.jl
fastmath.jl
fftw.jl
file.jl
float.jl
float16.jl
floatfuncs.jl
fs.jl
gmp.jl
grisu.jl
grisu/bignum.jl
grisu/bignums.jl
grisu/fastfixed.jl
grisu/fastprecision.jl
grisu/fastshortest.jl
grisu/float.jl
hashing2.jl
help.jl
i18n.jl
interactiveutil.jl
intfuncs.jl
io.jl
iobuffer.jl
iostream.jl
latex_symbols.jl
libc.jl
libdl.jl
linalg.jl
linalg/arnoldi.jl
linalg/arpack.jl
linalg/bidiag.jl
linalg/bitarray.jl
linalg/blas.jl
linalg/bunchkaufman.jl
linalg/cholesky.jl
linalg/dense.jl
linalg/diagonal.jl
linalg/eigen.jl
linalg/exceptions.jl
linalg/factorization.jl
linalg/generic.jl
linalg/givens.jl
linalg/lapack.jl
linalg/ldlt.jl
linalg/lu.jl
linalg/matmul.jl
linalg/qr.jl
linalg/rectfullpacked.jl
linalg/schur.jl
linalg/special.jl
linalg/svd.jl
linalg/symmetric.jl
linalg/triangular.jl
linalg/tridiag.jl
linalg/uniformscaling.jl
loading.jl
lock.jl
managers.jl
markdown/Common/Common.jl
markdown/Common/block.jl
markdown/Common/inline.jl
markdown/GitHub/GitHub.jl
markdown/GitHub/table.jl
markdown/IPython/IPython.jl
markdown/Julia/Julia.jl
markdown/Julia/interp.jl
markdown/Markdown.jl
markdown/parse/config.jl
markdown/parse/parse.jl
markdown/parse/util.jl
markdown/render/html.jl
markdown/render/latex.jl
markdown/render/plain.jl
markdown/render/rich.jl
markdown/render/terminal/formatting.jl
markdown/render/terminal/render.jl
math.jl
meta.jl
methodshow.jl
mmap.jl
mpfr.jl
multi.jl
multidimensional.jl
multimedia.jl
nullable.jl
ordering.jl
osutils.jl
path.jl
pcre.jl
pkg.jl
pkg/cache.jl
pkg/dir.jl
pkg/entry.jl
pkg/generate.jl
pkg/git.jl
pkg/github.jl
pkg/query.jl
pkg/read.jl
pkg/reqs.jl
pkg/resolve.jl
pkg/resolve/fieldvalue.jl
pkg/resolve/interface.jl
pkg/resolve/maxsum.jl
pkg/resolve/versionweight.jl
pkg/types.jl
pkg/write.jl
poll.jl
precompile.jl
primes.jl
printf.jl
process.jl
profile.jl
quadgk.jl
random.jl
rational.jl
reducedim.jl
refpointer.jl
regex.jl
replutil.jl
rounding.jl
serialize.jl
set.jl
sharedarray.jl
show.jl
simdloop.jl
socket.jl
sort.jl
sparse.jl
sparse/abstractsparse.jl
sparse/cholmod.jl
sparse/cholmod_h.jl
sparse/csparse.jl
sparse/linalg.jl
sparse/sparsematrix.jl
sparse/spqr.jl
sparse/umfpack.jl
sparse/umfpack_h.jl
special/bessel.jl
special/erf.jl
special/gamma.jl
special/log.jl
special/trig.jl
stat.jl
statistics.jl
stream.jl
string.jl
subarray.jl
sysimg.jl
sysinfo.jl
task.jl
test.jl
utf16.jl
utf32.jl
utf8.jl
utf8proc.jl
utferror.jl
utftypes.jl
util.jl
version.jl)

foreach(jl_file ${core_img_SRCS} ${sys_img_SRCS})
copy_jl(${jl_file})
endforeach()
52 changes: 22 additions & 30 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ else
CPP_STDOUT = $(CPP) -E
endif

all: pcre_h.jl errno_h.jl build_h.jl.phony fenv_constants.jl file_constants.jl uv_constants.jl version_git.jl.phony
all: $(CMAKE_BINARY_DIR)/base/pcre_h.jl \
$(CMAKE_BINARY_DIR)/base/errno_h.jl \
$(CMAKE_BINARY_DIR)/base/build_h.jl.phony \
$(CMAKE_BINARY_DIR)/base/fenv_constants.jl \
$(CMAKE_BINARY_DIR)/base/file_constants.jl \
$(CMAKE_BINARY_DIR)/base/uv_constants.jl \
$(CMAKE_BINARY_DIR)/base/version_git.jl.phony

PCRE_CONST = 0x[0-9a-fA-F]+|[0-9]+
ifeq ($(USE_SYSTEM_PCRE), 1)
Expand All @@ -17,22 +23,22 @@ else
PCRE_INCL_PATH = $(build_includedir)/pcre2.h
endif

pcre_h.jl:
$(CMAKE_BINARY_DIR)/base/pcre_h.jl:
@$(call PRINT_PERL, $(CPP) -D PCRE2_CODE_UNIT_WIDTH=8 -dM $(PCRE_INCL_PATH) | perl -nle '/^\s*#define\s+PCRE2_(\w*)\s*\(?($(PCRE_CONST))\)?u?\s*$$/ and print "const $$1 = UInt32($$2)"' | sort > $@)

errno_h.jl:
$(CMAKE_BINARY_DIR)/base/errno_h.jl:
@$(call PRINT_PERL, echo '#include "errno.h"' | $(CPP) -dM - | perl -nle 'print "const $$1 = Int32($$2)" if /^#define\s+(E\w+)\s+(\d+)\s*$$/' | sort > $@)

fenv_constants.jl: ../src/fenv_constants.h
$(CMAKE_BINARY_DIR)/base/fenv_constants.jl: ../src/fenv_constants.h
@$(PRINT_PERL) $(CPP_STDOUT) -DJULIA -I../deps/openlibm/include ../src/fenv_constants.h | tail -n 8 | perl -ple 's/\sFE_UN\w+/ 0x10/g; s/\sFE_O\w+/ 0x08/g; s/\sFE_DI\w+/ 0x04/g; s/\sFE_INV\w+/ 0x01/g; s/\sFE_TON\w+/ 0x00/g; s/\sFE_UP\w+/ 0x800/g; s/\sFE_DO\w+/ 0x400/g; s/\sFE_TOW\w+/ 0xc00/g' > $@

file_constants.jl: ../src/file_constants.h
$(CMAKE_BINARY_DIR)/base/file_constants.jl: ../src/file_constants.h
@$(call PRINT_PERL, $(CPP_STDOUT) -DJULIA ../src/file_constants.h | perl -nle 'print "$$1 0o$$2" if /^(\s*const\s+[A-z_]+\s+=)\s+(0[0-9]*)\s*$$/; print "$$1" if /^\s*(const\s+[A-z_]+\s+=\s+([1-9]|0x)[0-9A-z]*)\s*$$/' > $@)

uv_constants.jl: ../src/uv_constants.h $(build_includedir)/uv-errno.h
$(CMAKE_BINARY_DIR)/base/uv_constants.jl: ../src/uv_constants.h $(build_includedir)/uv-errno.h
@$(call PRINT_PERL, $(CPP_STDOUT) "-I$(LIBUV_INC)" -DJULIA ../src/uv_constants.h | tail -n 16 > $@)

build_h.jl.phony:
$(CMAKE_BINARY_DIR)/base/build_h.jl.phony:
@echo "# This file is automatically generated in base/Makefile" > $@
@echo "const ARCH = :$(ARCH)" >> $@
ifeq ($(XC_HOST),)
Expand Down Expand Up @@ -64,48 +70,34 @@ endif

@# This to ensure that we always rebuild this file, but only when it is modified do we touch build_h.jl,
@# ensuring we rebuild the system image as infrequently as possible
@if ! cmp -s $@ build_h.jl; then \
@if ! cmp -s $@ $(CMAKE_BINARY_DIR)/base/build_h.jl; then \
$(call PRINT_PERL,) \
mv $@ build_h.jl; \
mv $@ $(CMAKE_BINARY_DIR)/base/build_h.jl; \
else \
rm -f $@; \
fi

version_git.jl.phony:
$(CMAKE_BINARY_DIR)/base/version_git.jl.phony:
ifneq ($(NO_GIT), 1)
@sh version_git.sh > $@
@# This to avoid touching git_version.jl when it is not modified,
@# so that the system image does not need to be rebuilt.
@if ! cmp -s $@ version_git.jl; then \
@if ! cmp -s $@ $(CMAKE_BINARY_DIR)/base/version_git.jl; then \
$(call PRINT_PERL,) \
mv $@ version_git.jl; \
mv $@ $(CMAKE_BINARY_DIR)/base/version_git.jl; \
else \
rm -f $@; \
fi
else
ifeq ($(shell [ -f version_git.jl ] && echo "true"), true)
ifeq ($(shell [ -f $(CMAKE_BINARY_DIR)/base/version_git.jl ] && echo "true"), true)
@# Give warning if boilerplate git is used
@if grep -q "Default output if git is not available" version_git.jl; then \
@if grep -q "Default output if git is not available" $(CMAKE_BINARY_DIR)/base/version_git.jl; then \
echo "WARNING: Using boilerplate git version info" >&2; \
fi
else
$(warning "WARNING: Generating boilerplate git version info")
@sh version_git.sh NO_GIT > version_git.jl
@sh version_git.sh NO_GIT > $(CMAKE_BINARY_DIR)/base/version_git.jl
endif
endif

.PHONY: build_h.jl.phony version_git.jl.phony



clean:
rm -f *# *~
rm -f pcre_h.jl
rm -f errno_h.jl
rm -f build_h.jl
rm -f build_h.jl.phony
rm -f fenv_constants.jl
rm -f uv_constants.jl
rm -f file_constants.jl
rm -f version_git.jl
rm -f version_git.jl.phony
.PHONY: $(CMAKE_BINARY_DIR)/base/build_h.jl.phony $(CMAKE_BINARY_DIR)/base/version_git.jl.phony

0 comments on commit 730afa1

Please sign in to comment.