diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 234700846..2be36b1d8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,7 +61,7 @@ ensure a consistent code style for C. ## Janet style -All janet code in the project should be formatted similar to the code in core.janet. +All janet code in the project should be formatted similar to the code in src/boot/boot.janet. The auto formatting from janet.vim will work well. ## Typo Fixing and One-Line changes diff --git a/Makefile b/Makefile index 6e7033241..acacc0c42 100644 --- a/Makefile +++ b/Makefile @@ -261,6 +261,7 @@ $(JANET_STATIC_LIBRARY): $(JANET_TARGET_OBJECTS) # Testing assumes HOSTCC=CC TEST_SCRIPTS=$(wildcard test/suite*.janet) +EXAMPLE_SCRIPTS=$(wildcard examples/*.janet) repl: $(JANET_TARGET) $(RUN) ./$(JANET_TARGET) @@ -268,21 +269,26 @@ repl: $(JANET_TARGET) debug: $(JANET_TARGET) $(DEBUGGER) ./$(JANET_TARGET) -VALGRIND_COMMAND=valgrind --leak-check=full --quiet +VALGRIND_COMMAND=$(RUN) valgrind --leak-check=full --quiet +CALLGRIND_COMMAND=$(RUN) valgrind --tool=callgrind valgrind: $(JANET_TARGET) $(VALGRIND_COMMAND) ./$(JANET_TARGET) -test: $(JANET_TARGET) $(TEST_PROGRAMS) +test: $(JANET_TARGET) $(TEST_SCRIPTS) $(EXAMPLE_SCRIPTS) for f in test/suite*.janet; do $(RUN) ./$(JANET_TARGET) "$$f" || exit; done for f in examples/*.janet; do $(RUN) ./$(JANET_TARGET) -k "$$f"; done -valtest: $(JANET_TARGET) $(TEST_PROGRAMS) +valtest: $(JANET_TARGET) $(TEST_SCRIPTS) $(EXAMPLE_SCRIPTS) for f in test/suite*.janet; do $(VALGRIND_COMMAND) ./$(JANET_TARGET) "$$f" || exit; done - for f in examples/*.janet; do ./$(JANET_TARGET) -k "$$f"; done + for f in examples/*.janet; do $(VALGRIND_COMMAND) ./$(JANET_TARGET) -k "$$f"; done callgrind: $(JANET_TARGET) - for f in test/suite*.janet; do valgrind --tool=callgrind ./$(JANET_TARGET) "$$f" || exit; done + $(CALLGRIND_COMMAND) ./$(JANET_TARGET) + +calltest: $(JANET_TARGET) $(TEST_SCRIPTS) $(EXAMPLE_SCRIPTS) + for f in test/suite*.janet; do $(CALLGRIND_COMMAND) ./$(JANET_TARGET) "$$f" || exit; done + for f in examples/*.janet; do $(CALLGRIND_COMMAND) ./$(JANET_TARGET) -k "$$f"; done ######################## ##### Distribution ##### @@ -413,9 +419,6 @@ clean: -rm -rf build vgcore.* callgrind.* -rm -rf test/install/build test/install/modpath -test-install: - echo "JPM has been removed from default install." - help: @echo @echo 'Janet: A Dynamic Language & Bytecode VM' @@ -427,7 +430,8 @@ help: @echo ' make test Test a built Janet' @echo ' make valgrind Assess Janet with Valgrind' @echo ' make callgrind Assess Janet with Valgrind, using Callgrind' - @echo ' make valtest Run the test suite with Valgrind to check for memory leaks' + @echo ' make valtest Run the test suite and examples with Valgrind to check for memory leaks' + @echo ' make calltest Run the test suite and examples with Callgrind' @echo ' make dist Create a distribution tarball' @echo ' make docs Generate documentation' @echo ' make debug Run janet with GDB or LLDB' @@ -437,6 +441,9 @@ help: @echo " make format Format Janet's own source files" @echo ' make grammar Generate a TextMate language grammar' @echo + @echo ' make install-jpm-git Install jpm into the current filesystem' + @echo ' make install-spork-git Install spork into the current filesystem' + @echo -.PHONY: clean install repl debug valgrind test \ - valtest dist uninstall docs grammar format help compile-commands +.PHONY: clean install install-jpm-git install-spork-git repl debug valgrind test \ + valtest callgrind callgrind-test dist uninstall docs grammar format help compile-commands diff --git a/src/boot/boot.janet b/src/boot/boot.janet index fa21e55d2..9f7fd34ba 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -4934,14 +4934,15 @@ "src/core/wrap.c"]) # Print janet.c to stdout - (print "/* Amalgamated build - DO NOT EDIT */") + (def image-only (has-value? boot/args "image-only")) + (print "/* " (if image-only "Image-only" "Amalgamated") " build - DO NOT EDIT */") (print "/* Generated from janet version " janet/version "-" janet/build " */") (print "#define JANET_BUILD \"" janet/build "\"") (print ```#define JANET_AMALG```) (defn do-one-file [fname] - (unless (has-value? boot/args "image-only") + (unless image-only (print "\n/* " fname " */") (print "#line 0 \"" fname "\"\n") (def source (slurp fname))