mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 07:33:01 +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:
		
							
								
								
									
										3
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Makefile
									
									
									
									
									
								
							| @@ -66,7 +66,6 @@ all: $(JANET_TARGET) $(JANET_LIBRARY) | |||||||
|  |  | ||||||
| JANET_BOOT_SOURCES=$(sort $(wildcard src/boot/*.c)) | JANET_BOOT_SOURCES=$(sort $(wildcard src/boot/*.c)) | ||||||
| JANET_BOOT_OBJECTS=$(patsubst src/%.c,build/%.boot.o,$(JANET_CORE_SOURCES) $(JANET_BOOT_SOURCES)) \ | 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.gen.o | ||||||
|  |  | ||||||
| build/%.boot.o: src/%.c $(JANET_HEADERS) $(JANET_LOCAL_HEADERS) | build/%.boot.o: src/%.c $(JANET_HEADERS) $(JANET_LOCAL_HEADERS) | ||||||
| @@ -138,8 +137,6 @@ emscripten: $(JANET_EMTARGET) | |||||||
| build/xxd: tools/xxd.c | build/xxd: tools/xxd.c | ||||||
| 	$(CC) $< -o $@ | 	$(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/init.gen.c: src/mainclient/init.janet build/xxd | ||||||
| 	build/xxd $< $@ janet_gen_init | 	build/xxd $< $@ janet_gen_init | ||||||
| build/webinit.gen.c: src/webclient/webinit.janet build/xxd | build/webinit.gen.c: src/webclient/webinit.janet build/xxd | ||||||
|   | |||||||
| @@ -31,16 +31,12 @@ mkdir build\boot | |||||||
| @if errorlevel 1 goto :BUILDFAIL | @if errorlevel 1 goto :BUILDFAIL | ||||||
|  |  | ||||||
| @rem Generate the embedded sources | @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 | @build\xxd.exe src\mainclient\init.janet build\init.gen.c janet_gen_init | ||||||
| @if errorlevel 1 goto :BUILDFAIL | @if errorlevel 1 goto :BUILDFAIL | ||||||
| @build\xxd.exe src\boot\boot.janet build\boot.gen.c janet_gen_boot | @build\xxd.exe src\boot\boot.janet build\boot.gen.c janet_gen_boot | ||||||
| @if errorlevel 1 goto :BUILDFAIL | @if errorlevel 1 goto :BUILDFAIL | ||||||
|  |  | ||||||
| @rem Build the generated sources | @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 | @%JANET_COMPILE% /Fobuild\mainclient\init.gen.obj build\init.gen.c | ||||||
| @if errorlevel 1 goto :BUILDFAIL | @if errorlevel 1 goto :BUILDFAIL | ||||||
| @%JANET_COMPILE% /Fobuild\boot\boot.gen.obj build\boot.gen.c | @%JANET_COMPILE% /Fobuild\boot\boot.gen.obj build\boot.gen.c | ||||||
|   | |||||||
| @@ -36,7 +36,6 @@ xxd = executable('xxd', 'tools/xxd.c') | |||||||
| gen = generator(xxd, | gen = generator(xxd, | ||||||
|   output : '@BASENAME@.gen.c', |   output : '@BASENAME@.gen.c', | ||||||
|   arguments : ['@INPUT@', '@OUTPUT@', '@EXTRA_ARGS@']) |   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') | 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') | init_gen = gen.process('src/mainclient/init.janet', extra_args: 'janet_gen_init') | ||||||
|  |  | ||||||
| @@ -94,7 +93,7 @@ mainclient_src = [ | |||||||
| ] | ] | ||||||
|  |  | ||||||
| # Build boot binary | # 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', |   c_args : '-DJANET_BOOTSTRAP', | ||||||
|   dependencies : [m_dep, dl_dep]) |   dependencies : [m_dep, dl_dep]) | ||||||
|  |  | ||||||
| @@ -103,7 +102,7 @@ core_image = custom_target('core_image', | |||||||
|   input : [janet_boot], |   input : [janet_boot], | ||||||
|   output : 'core_image.gen.c', |   output : 'core_image.gen.c', | ||||||
|   command : [janet_boot, '@OUTPUT@', |   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, | libjanet = shared_library('janet', core_src, core_image, | ||||||
|   dependencies : [m_dep, dl_dep], |   dependencies : [m_dep, dl_dep], | ||||||
| @@ -134,7 +133,7 @@ install_man('janet.1') | |||||||
| install_headers('src/include/janet.h', 'src/include/janetconf.h') | install_headers('src/include/janet.h', 'src/include/janetconf.h') | ||||||
| janet_libs = [ | janet_libs = [ | ||||||
|   'src/include/janet.h', |   'src/include/janet.h', | ||||||
|   'src/include/janetconf.h' |   'src/include/janetconf.h', | ||||||
|   'tools/bars.janet', |   'tools/bars.janet', | ||||||
|   'tools/cook.janet', |   'tools/cook.janet', | ||||||
|   'tools/highlight.janet' |   'tools/highlight.janet' | ||||||
|   | |||||||
							
								
								
									
										1773
									
								
								src/boot/boot.janet
									
									
									
									
									
								
							
							
						
						
									
										1773
									
								
								src/boot/boot.janet
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1741
									
								
								src/core/core.janet
									
									
									
									
									
								
							
							
						
						
									
										1741
									
								
								src/core/core.janet
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -28,10 +28,7 @@ | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /* Generated bytes */ | /* Generated bytes */ | ||||||
| #ifdef JANET_BOOTSTRAP | #ifndef JANET_BOOTSTRAP | ||||||
| extern const unsigned char *janet_gen_core; |  | ||||||
| extern int32_t janet_gen_core_size; |  | ||||||
| #else |  | ||||||
| extern const unsigned char *janet_core_image; | extern const unsigned char *janet_core_image; | ||||||
| extern size_t janet_core_image_size; | extern size_t janet_core_image_size; | ||||||
| #endif | #endif | ||||||
| @@ -831,10 +828,7 @@ JanetTable *janet_core_env(JanetTable *replacements) { | |||||||
|     janet_lib_inttypes(env); |     janet_lib_inttypes(env); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef JANET_BOOTSTRAP | #ifndef JANET_BOOTSTRAP | ||||||
|     /* Run bootstrap source */ |  | ||||||
|     janet_dobytes(env, janet_gen_core, janet_gen_core_size, "core.janet", NULL); |  | ||||||
| #else |  | ||||||
|     /* Unmarshal from core image */ |     /* Unmarshal from core image */ | ||||||
|     Janet marsh_out = janet_unmarshal( |     Janet marsh_out = janet_unmarshal( | ||||||
|                           janet_core_image, |                           janet_core_image, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose