From 558b0646c5580454dd35a6bdee07bcc711db134e Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 31 May 2023 22:27:40 -0400 Subject: refactor: neaten makefile --- makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'makefile') diff --git a/makefile b/makefile index d435c7c..80753a3 100644 --- a/makefile +++ b/makefile @@ -1,8 +1,16 @@ +srcfiles := forth.c optable.c stack.c + +nativeexe := ./forth + +ifneq (, $(shell which clang)) + CC := clang +endif + build: - clang forth.c optable.c stack.c -o ./forth -Wall + ${CC} ${srcfiles} -o ${nativeexe} -Wall run: - ./forth + ${nativeexe} run-rlwrap: - rlwrap -r -f rlwrapcompletions.forth ./forth + rlwrap -r -f rlwrapcompletions.forth ${nativeexe} build-wasm: - emcc forth.c optable.c stack.c -Wall -o forthlib.js -s NO_EXIT_RUNTIME=1 -s "EXPORTED_RUNTIME_METHODS=['ccall']" + emcc ${srcfiles} -Wall -o forthlib.js -s NO_EXIT_RUNTIME=1 -s "EXPORTED_RUNTIME_METHODS=['ccall']" -- cgit v1.2.3