Fix normal native building and make test-install.

Add executable generation testing to make test-install.
This commit is contained in:
Calvin Rose 2019-07-27 09:50:44 -05:00
parent efc38b87de
commit cc07ff987d
6 changed files with 12 additions and 4 deletions

View File

@ -329,7 +329,8 @@ clean:
-rm -rf build vgcore.* callgrind.*
test-install:
cd test/install && rm -rf build && jpm build && jpm test
cd test/install && jpm --verbose clean && jpm --verbose build && jpm --verbose test \
&& build/testexec
build/embed_janet.o: build/janet.c $(JANET_HEADERS)
$(CC) $(CFLAGS) -c $< -o $@

View File

@ -258,8 +258,8 @@
[opts src dest &opt static?]
(def cc (opt opts :compiler default-compiler))
(def cflags [;(getcflags opts) ;(if static? [] dynamic-cflags)])
(def entry-defines (if-let [n (opts :name)]
[(string "janet_module_entry_" (filepath-replace n))]
(def entry-defines (if-let [n (opts :entry-name)]
[(make-define "JANET_ENTRY_NAME" (string "janet_module_entry_" (filepath-replace n)))]
[]))
(def defines [;(make-defines (opt opts :defines {})) ;entry-defines])
(def headers (or (opts :headers) []))
@ -530,6 +530,7 @@ int main(int argc, const char **argv) {
# Make static module
(unless (or is-win (dyn :nostatic))
(def opts (merge @{:entry-name name} opts))
(def sname (string "build" sep name statext))
(def sobjext (string ".static" objext))
(def sjobjext (string ".janet" sobjext))

View File

@ -1,2 +1,4 @@
/build
.cache
.manifest
json.*

View File

@ -1 +0,0 @@
/home/calvin/code/janet/test/install/json.so

View File

@ -5,3 +5,6 @@
:name "testmod"
:source @["testmod.c"])
(declare-executable
:name "testexec"
:entry "testexec.janet")

View File

@ -0,0 +1,2 @@
(defn main [&]
(print "Hello from executable!"))