aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordan <[email protected]>2023-05-31 22:27:40 -0400
committerdan <[email protected]>2023-05-31 22:27:40 -0400
commit558b0646c5580454dd35a6bdee07bcc711db134e (patch)
tree03261d9d270c946feb68e046dd3cd2b8ab98b8fe
parentc737bfb388a0bc591e6f677b714e28ab7f3799d8 (diff)
downloadforth-558b0646c5580454dd35a6bdee07bcc711db134e.tar.gz
forth-558b0646c5580454dd35a6bdee07bcc711db134e.tar.bz2
forth-558b0646c5580454dd35a6bdee07bcc711db134e.zip
refactor: neaten makefile
-rw-r--r--makefile16
1 files changed, 12 insertions, 4 deletions
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']"