aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2019-06-13 00:41:20 -0400
committerCalvin Rose <calsrose@gmail.com>2019-06-13 00:41:20 -0400
commit82edc191377e990a3c72ca178b4b822ad2aff9e4 (patch)
tree2c47073f8e91b299b46a4fae27bfcdd359ad0071
parentAdd keyword flag utility for modules. (diff)
Update cook to take headers for natives.
This should help incremental building.
-rw-r--r--auxlib/cook.janet3
-rw-r--r--src/core/capi.c4
2 files changed, 6 insertions, 1 deletions
diff --git a/auxlib/cook.janet b/auxlib/cook.janet
index 9c104190..c996c54e 100644
--- a/auxlib/cook.janet
+++ b/auxlib/cook.janet
@@ -248,7 +248,8 @@
(def cc (opt opts :compiler COMPILER))
(def cflags (getcflags opts))
(def defines (interpose " " (make-defines (opt opts :defines {}))))
- (rule dest [src]
+ (def headers (or (opts :headers) []))
+ (rule dest [src ;headers]
(print "compiling " dest "...")
(if is-win
(shell cc ;defines "/c" ;cflags (string "/Fo" dest) src)
diff --git a/src/core/capi.c b/src/core/capi.c
index 2a97c4a3..a22ee850 100644
--- a/src/core/capi.c
+++ b/src/core/capi.c
@@ -262,8 +262,12 @@ uint64_t janet_getflags(const Janet *argv, int32_t n, const char *flags) {
for (int32_t i = 0; i < flen; i++) {
if (((uint8_t) flags[i]) == keyw[j]) {
ret |= 1ULL << i;
+ goto found;
}
}
+ janet_panicf("unexpected flag %c, expected one of \"%s\"", (char) keyw[j], flags);
+found:
+ ;
}
return ret;
}