1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 11:09:54 +00:00

Merge core.janet into boot.janet

This simplifies the build machinery a bit.
core.janet is never actually included in the final
binary, it is just used to generate an image file.
This commit is contained in:
Calvin Rose 2019-03-22 18:34:50 -04:00
parent 25aa7a26c5
commit 7f1b5d4d70
6 changed files with 1756 additions and 1782 deletions

View File

@ -66,7 +66,6 @@ all: $(JANET_TARGET) $(JANET_LIBRARY)
JANET_BOOT_SOURCES=$(sort $(wildcard src/boot/*.c))
JANET_BOOT_OBJECTS=$(patsubst src/%.c,build/%.boot.o,$(JANET_CORE_SOURCES) $(JANET_BOOT_SOURCES)) \
build/core.gen.o \
build/boot.gen.o
build/%.boot.o: src/%.c $(JANET_HEADERS) $(JANET_LOCAL_HEADERS)
@ -138,8 +137,6 @@ emscripten: $(JANET_EMTARGET)
build/xxd: tools/xxd.c
$(CC) $< -o $@
build/core.gen.c: src/core/core.janet build/xxd
build/xxd $< $@ janet_gen_core
build/init.gen.c: src/mainclient/init.janet build/xxd
build/xxd $< $@ janet_gen_init
build/webinit.gen.c: src/webclient/webinit.janet build/xxd

View File

@ -31,16 +31,12 @@ mkdir build\boot
@if errorlevel 1 goto :BUILDFAIL
@rem Generate the embedded sources
@build\xxd.exe src\core\core.janet build\core.gen.c janet_gen_core
@if errorlevel 1 goto :BUILDFAIL
@build\xxd.exe src\mainclient\init.janet build\init.gen.c janet_gen_init
@if errorlevel 1 goto :BUILDFAIL
@build\xxd.exe src\boot\boot.janet build\boot.gen.c janet_gen_boot
@if errorlevel 1 goto :BUILDFAIL
@rem Build the generated sources
@%JANET_COMPILE% /Fobuild\boot\core.gen.obj build\core.gen.c
@if errorlevel 1 goto :BUILDFAIL
@%JANET_COMPILE% /Fobuild\mainclient\init.gen.obj build\init.gen.c
@if errorlevel 1 goto :BUILDFAIL
@%JANET_COMPILE% /Fobuild\boot\boot.gen.obj build\boot.gen.c

View File

@ -36,7 +36,6 @@ xxd = executable('xxd', 'tools/xxd.c')
gen = generator(xxd,
output : '@BASENAME@.gen.c',
arguments : ['@INPUT@', '@OUTPUT@', '@EXTRA_ARGS@'])
core_gen = gen.process('src/core/core.janet', extra_args: 'janet_gen_core')
boot_gen = gen.process('src/boot/boot.janet', extra_args: 'janet_gen_boot')
init_gen = gen.process('src/mainclient/init.janet', extra_args: 'janet_gen_init')
@ -94,7 +93,7 @@ mainclient_src = [
]
# Build boot binary
janet_boot = executable('janet_boot', core_src, boot_src, core_gen, boot_gen,
janet_boot = executable('janet_boot', core_src, boot_src, boot_gen,
c_args : '-DJANET_BOOTSTRAP',
dependencies : [m_dep, dl_dep])
@ -103,7 +102,7 @@ core_image = custom_target('core_image',
input : [janet_boot],
output : 'core_image.gen.c',
command : [janet_boot, '@OUTPUT@',
'JANET_PATH', join_paths(get_option('libdir'), 'janet')])
'JANET_PATH', join_paths(get_option('prefix'), get_option('datadir'), 'janet')])
libjanet = shared_library('janet', core_src, core_image,
dependencies : [m_dep, dl_dep],
@ -134,7 +133,7 @@ install_man('janet.1')
install_headers('src/include/janet.h', 'src/include/janetconf.h')
janet_libs = [
'src/include/janet.h',
'src/include/janetconf.h'
'src/include/janetconf.h',
'tools/bars.janet',
'tools/cook.janet',
'tools/highlight.janet'

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -28,10 +28,7 @@
#endif
/* Generated bytes */
#ifdef JANET_BOOTSTRAP
extern const unsigned char *janet_gen_core;
extern int32_t janet_gen_core_size;
#else
#ifndef JANET_BOOTSTRAP
extern const unsigned char *janet_core_image;
extern size_t janet_core_image_size;
#endif
@ -831,10 +828,7 @@ JanetTable *janet_core_env(JanetTable *replacements) {
janet_lib_inttypes(env);
#endif
#ifdef JANET_BOOTSTRAP
/* Run bootstrap source */
janet_dobytes(env, janet_gen_core, janet_gen_core_size, "core.janet", NULL);
#else
#ifndef JANET_BOOTSTRAP
/* Unmarshal from core image */
Janet marsh_out = janet_unmarshal(
janet_core_image,