mirror of
https://github.com/janet-lang/janet
synced 2024-12-26 00:10:27 +00:00
Add shell.c to the amalgamation.
This allows easy builds of the full interpreter with no build system. 1. Get janet.c, janet.h, janetconf.h, and shell.c in a directory. Edit janetconf.h as desired. 2. gcc shell.c janet.c -lm -ldl -O2 -o janet (on GNU-Linux for example) 3. ./janet -h (Yay!)
This commit is contained in:
parent
46e09e4c71
commit
280dca3998
8
Makefile
8
Makefile
@ -213,12 +213,16 @@ build/boot.gen.c: src/boot/boot.janet build/xxd
|
|||||||
##### Amalgamation #####
|
##### Amalgamation #####
|
||||||
########################
|
########################
|
||||||
|
|
||||||
amalg: build/janet.c build/janet.h build/core_image.c
|
amalg: build/shell.c build/janet.c build/janet.h build/core_image.c
|
||||||
|
|
||||||
AMALG_SOURCE=$(JANET_LOCAL_HEADERS) $(JANET_CORE_SOURCES) build/core_image.c
|
AMALG_SOURCE=$(JANET_LOCAL_HEADERS) $(JANET_CORE_SOURCES) build/core_image.c
|
||||||
build/janet.c: $(AMALG_SOURCE) tools/amalg.janet $(JANET_TARGET)
|
build/janet.c: $(AMALG_SOURCE) tools/amalg.janet $(JANET_TARGET)
|
||||||
$(JANET_TARGET) tools/amalg.janet $(AMALG_SOURCE) > $@
|
$(JANET_TARGET) tools/amalg.janet $(AMALG_SOURCE) > $@
|
||||||
|
|
||||||
|
AMALG_SHELL_SOURCE=src/mainclient/line.h src/mainclient/line.c src/mainclient/main.c
|
||||||
|
build/shell.c: $(JANET_TARGET) tools/amalg.janet $(AMALG_SHELL_SOURCE)
|
||||||
|
$(JANET_TARGET) tools/amalg.janet $(AMALG_SHELL_SOURCE) > $@
|
||||||
|
|
||||||
build/janet.h: src/include/janet.h
|
build/janet.h: src/include/janet.h
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
||||||
@ -257,7 +261,7 @@ dist: build/janet-dist.tar.gz
|
|||||||
build/janet-%.tar.gz: $(JANET_TARGET) \
|
build/janet-%.tar.gz: $(JANET_TARGET) \
|
||||||
src/include/janet.h src/conf/janetconf.h \
|
src/include/janet.h src/conf/janetconf.h \
|
||||||
jpm.1 janet.1 LICENSE CONTRIBUTING.md $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) \
|
jpm.1 janet.1 LICENSE CONTRIBUTING.md $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) \
|
||||||
build/doc.html README.md build/janet.c
|
build/doc.html README.md build/janet.c build/shell.c
|
||||||
$(eval JANET_DIST_DIR = "janet-$(shell basename $*)")
|
$(eval JANET_DIST_DIR = "janet-$(shell basename $*)")
|
||||||
mkdir -p build/$(JANET_DIST_DIR)
|
mkdir -p build/$(JANET_DIST_DIR)
|
||||||
cp -r $^ build/$(JANET_DIST_DIR)/
|
cp -r $^ build/$(JANET_DIST_DIR)/
|
||||||
|
@ -42,6 +42,9 @@ artifacts:
|
|||||||
- name: janetconf.h
|
- name: janetconf.h
|
||||||
path: dist\janetconf.h
|
path: dist\janetconf.h
|
||||||
type: File
|
type: File
|
||||||
|
- name: shell.c
|
||||||
|
path: dist\shell.c
|
||||||
|
type: File
|
||||||
- name: "janet-$(janet_outname)-windows"
|
- name: "janet-$(janet_outname)-windows"
|
||||||
path: dist
|
path: dist
|
||||||
type: Zip
|
type: Zip
|
||||||
|
@ -96,6 +96,10 @@ for %%f in (src\core\*.c) do (
|
|||||||
janet.exe tools\amalg.janet src\core\util.h src\core\state.h src\core\gc.h src\core\vector.h src\core\fiber.h src\core\regalloc.h src\core\compile.h src\core\emit.h src\core\symcache.h %amalg_files% build\core_image.c > build\janet.c
|
janet.exe tools\amalg.janet src\core\util.h src\core\state.h src\core\gc.h src\core\vector.h src\core\fiber.h src\core\regalloc.h src\core\compile.h src\core\emit.h src\core\symcache.h %amalg_files% build\core_image.c > build\janet.c
|
||||||
janet.exe tools\removecr.janet build\janet.c
|
janet.exe tools\removecr.janet build\janet.c
|
||||||
|
|
||||||
|
@rem Gen shell.c
|
||||||
|
janet.exe tools\amalg.janet src\mainclient\line.h src\mainclient\line.c src\mainclient\main.c > build\shell.c
|
||||||
|
janet.exe tools\removecr.janet build\shell.c
|
||||||
|
|
||||||
echo === Successfully built janet.exe for Windows ===
|
echo === Successfully built janet.exe for Windows ===
|
||||||
echo === Run 'build_win test' to run tests. ==
|
echo === Run 'build_win test' to run tests. ==
|
||||||
echo === Run 'build_win clean' to delete build artifacts. ===
|
echo === Run 'build_win clean' to delete build artifacts. ===
|
||||||
@ -137,6 +141,7 @@ janet.exe tools\gendoc.janet > dist\doc.html
|
|||||||
janet.exe tools\removecr.janet dist\doc.html
|
janet.exe tools\removecr.janet dist\doc.html
|
||||||
|
|
||||||
copy build\janet.c dist\janet.c
|
copy build\janet.c dist\janet.c
|
||||||
|
copy build\shell.c dist\shell.c
|
||||||
copy janet.exe dist\janet.exe
|
copy janet.exe dist\janet.exe
|
||||||
copy LICENSE dist\LICENSE
|
copy LICENSE dist\LICENSE
|
||||||
copy README.md dist\README.md
|
copy README.md dist\README.md
|
||||||
|
@ -213,6 +213,12 @@ amalg = custom_target('amalg',
|
|||||||
output : ['janet.c'],
|
output : ['janet.c'],
|
||||||
capture : true,
|
capture : true,
|
||||||
command : [janet_nativeclient, '@INPUT@'])
|
command : [janet_nativeclient, '@INPUT@'])
|
||||||
|
amalg_shell = custom_target('amalg-shell',
|
||||||
|
input : ['tools/amalg.janet', 'src/mainclient/line.h',
|
||||||
|
'src/mainclient/line.c', 'src/mainlcient/main.c'],
|
||||||
|
output : ['shell.c'],
|
||||||
|
capture : true,
|
||||||
|
command : [janet_nativeclient, '@INPUT@'])
|
||||||
|
|
||||||
# Amalgamated client
|
# Amalgamated client
|
||||||
janet_amalgclient = executable('janet-amalg', amalg, mainclient_src,
|
janet_amalgclient = executable('janet-amalg', amalg, mainclient_src,
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef JANET_AMALG
|
||||||
#include "line.h"
|
#include "line.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Common */
|
/* Common */
|
||||||
Janet janet_line_getter(int32_t argc, Janet *argv) {
|
Janet janet_line_getter(int32_t argc, Janet *argv) {
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
#ifndef JANET_LINE_H_defined
|
#ifndef JANET_LINE_H_defined
|
||||||
#define JANET_LINE_H_defined
|
#define JANET_LINE_H_defined
|
||||||
|
|
||||||
|
#ifndef JANET_AMALG
|
||||||
#include <janet.h>
|
#include <janet.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void janet_line_init();
|
void janet_line_init();
|
||||||
void janet_line_deinit();
|
void janet_line_deinit();
|
||||||
|
@ -20,8 +20,10 @@
|
|||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef JANET_AMALG
|
||||||
#include <janet.h>
|
#include <janet.h>
|
||||||
#include "line.h"
|
#include "line.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user