Skip to content

Commit 2204209

Browse files
authored
Merge pull request #1656 from jpaquim/build-system-consistency
Minor adjustments to Makefile
2 parents db7f741 + 95abff3 commit 2204209

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ ensure a consistent code style for C.
6161

6262
## Janet style
6363

64-
All janet code in the project should be formatted similar to the code in core.janet.
64+
All janet code in the project should be formatted similar to the code in src/boot/boot.janet.
6565
The auto formatting from janet.vim will work well.
6666

6767
## Typo Fixing and One-Line changes

Makefile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -261,28 +261,34 @@ $(JANET_STATIC_LIBRARY): $(JANET_TARGET_OBJECTS)
261261
# Testing assumes HOSTCC=CC
262262

263263
TEST_SCRIPTS=$(wildcard test/suite*.janet)
264+
EXAMPLE_SCRIPTS=$(wildcard examples/*.janet)
264265

265266
repl: $(JANET_TARGET)
266267
$(RUN) ./$(JANET_TARGET)
267268

268269
debug: $(JANET_TARGET)
269270
$(DEBUGGER) ./$(JANET_TARGET)
270271

271-
VALGRIND_COMMAND=valgrind --leak-check=full --quiet
272+
VALGRIND_COMMAND=$(RUN) valgrind --leak-check=full --quiet
273+
CALLGRIND_COMMAND=$(RUN) valgrind --tool=callgrind
272274

273275
valgrind: $(JANET_TARGET)
274276
$(VALGRIND_COMMAND) ./$(JANET_TARGET)
275277

276-
test: $(JANET_TARGET) $(TEST_PROGRAMS)
278+
test: $(JANET_TARGET) $(TEST_SCRIPTS) $(EXAMPLE_SCRIPTS)
277279
for f in test/suite*.janet; do $(RUN) ./$(JANET_TARGET) "$$f" || exit; done
278280
for f in examples/*.janet; do $(RUN) ./$(JANET_TARGET) -k "$$f"; done
279281

280-
valtest: $(JANET_TARGET) $(TEST_PROGRAMS)
282+
valtest: $(JANET_TARGET) $(TEST_SCRIPTS) $(EXAMPLE_SCRIPTS)
281283
for f in test/suite*.janet; do $(VALGRIND_COMMAND) ./$(JANET_TARGET) "$$f" || exit; done
282-
for f in examples/*.janet; do ./$(JANET_TARGET) -k "$$f"; done
284+
for f in examples/*.janet; do $(VALGRIND_COMMAND) ./$(JANET_TARGET) -k "$$f"; done
283285

284286
callgrind: $(JANET_TARGET)
285-
for f in test/suite*.janet; do valgrind --tool=callgrind ./$(JANET_TARGET) "$$f" || exit; done
287+
$(CALLGRIND_COMMAND) ./$(JANET_TARGET)
288+
289+
calltest: $(JANET_TARGET) $(TEST_SCRIPTS) $(EXAMPLE_SCRIPTS)
290+
for f in test/suite*.janet; do $(CALLGRIND_COMMAND) ./$(JANET_TARGET) "$$f" || exit; done
291+
for f in examples/*.janet; do $(CALLGRIND_COMMAND) ./$(JANET_TARGET) -k "$$f"; done
286292

287293
########################
288294
##### Distribution #####
@@ -413,9 +419,6 @@ clean:
413419
-rm -rf build vgcore.* callgrind.*
414420
-rm -rf test/install/build test/install/modpath
415421

416-
test-install:
417-
echo "JPM has been removed from default install."
418-
419422
help:
420423
@echo
421424
@echo 'Janet: A Dynamic Language & Bytecode VM'
@@ -427,7 +430,8 @@ help:
427430
@echo ' make test Test a built Janet'
428431
@echo ' make valgrind Assess Janet with Valgrind'
429432
@echo ' make callgrind Assess Janet with Valgrind, using Callgrind'
430-
@echo ' make valtest Run the test suite with Valgrind to check for memory leaks'
433+
@echo ' make valtest Run the test suite and examples with Valgrind to check for memory leaks'
434+
@echo ' make calltest Run the test suite and examples with Callgrind'
431435
@echo ' make dist Create a distribution tarball'
432436
@echo ' make docs Generate documentation'
433437
@echo ' make debug Run janet with GDB or LLDB'
@@ -437,6 +441,9 @@ help:
437441
@echo " make format Format Janet's own source files"
438442
@echo ' make grammar Generate a TextMate language grammar'
439443
@echo
444+
@echo ' make install-jpm-git Install jpm into the current filesystem'
445+
@echo ' make install-spork-git Install spork into the current filesystem'
446+
@echo
440447

441-
.PHONY: clean install repl debug valgrind test \
442-
valtest dist uninstall docs grammar format help compile-commands
448+
.PHONY: clean install install-jpm-git install-spork-git repl debug valgrind test \
449+
valtest callgrind callgrind-test dist uninstall docs grammar format help compile-commands

src/boot/boot.janet

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4934,14 +4934,15 @@
49344934
"src/core/wrap.c"])
49354935

49364936
# Print janet.c to stdout
4937-
(print "/* Amalgamated build - DO NOT EDIT */")
4937+
(def image-only (has-value? boot/args "image-only"))
4938+
(print "/* " (if image-only "Image-only" "Amalgamated") " build - DO NOT EDIT */")
49384939
(print "/* Generated from janet version " janet/version "-" janet/build " */")
49394940
(print "#define JANET_BUILD \"" janet/build "\"")
49404941
(print ```#define JANET_AMALG```)
49414942

49424943
(defn do-one-file
49434944
[fname]
4944-
(unless (has-value? boot/args "image-only")
4945+
(unless image-only
49454946
(print "\n/* " fname " */")
49464947
(print "#line 0 \"" fname "\"\n")
49474948
(def source (slurp fname))

0 commit comments

Comments
 (0)