diff --git a/Makefile b/Makefile index dfd42c62..907009b4 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ PREFIX?=/usr/local -INCLUDEDIR=$(PREFIX)/include/janet +INCLUDEDIR=$(PREFIX)/include BINDIR=$(PREFIX)/bin JANET_BUILD?="\"$(shell git log --pretty=format:'%h' -n 1)\"" CLIBS=-lm @@ -51,7 +51,7 @@ endif $(shell mkdir -p build/core build/mainclient build/webclient build/boot) # Source headers -JANET_HEADERS=$(sort $(wildcard src/include/janet/*.h)) +JANET_HEADERS=$(sort $(wildcard src/include/*.h)) JANET_LOCAL_HEADERS=$(sort $(wildcard src/*/*.h)) # Source files @@ -77,7 +77,7 @@ build/janet_boot: $(JANET_BOOT_OBJECTS) # Now the reason we bootstrap in the first place build/core_image.c: build/janet_boot - JANET_PATH=$(JANET_PATH) build/janet_boot + JANET_PATH=$(JANET_PATH) JANET_INCLUDEDIR=$(INCLUDEDIR) build/janet_boot ########################################################## ##### The main interpreter program and shared object ##### @@ -156,7 +156,7 @@ amalg: build/janet.c build/janet.h build/core_image.c build/janet.c: $(JANET_LOCAL_HEADERS) $(JANET_CORE_SOURCES) tools/amalg.janet $(JANET_TARGET) $(JANET_TARGET) tools/amalg.janet > $@ -build/janet.h: src/include/janet/janet.h +build/janet.h: src/include/janet.h cp $< $@ ################### @@ -191,7 +191,7 @@ callgrind: $(JANET_TARGET) dist: build/janet-dist.tar.gz -build/janet-%.tar.gz: $(JANET_TARGET) src/include/janet/janet.h \ +build/janet-%.tar.gz: $(JANET_TARGET) src/include/janet.h \ janet.1 LICENSE CONTRIBUTING.md $(JANET_LIBRARY) \ build/doc.html README.md build/janet.c tar -czvf $@ $^ @@ -221,6 +221,9 @@ install: $(JANET_TARGET) cp $(JANET_TARGET) $(BINDIR)/janet mkdir -p $(INCLUDEDIR) cp $(JANET_HEADERS) $(INCLUDEDIR) + # For compatibility + mkdir -p $(INCLUDEDIR)/janet + ln -sf $(INCLUDEDIR)/janet.h $(INCLUDEDIR)/janet/janet.h mkdir -p $(JANET_PATH) cp tools/cook.janet $(JANET_PATH) cp tools/highlight.janet $(JANET_PATH) diff --git a/build_win.bat b/build_win.bat index 826885f4..2bc04507 100644 --- a/build_win.bat +++ b/build_win.bat @@ -123,7 +123,7 @@ copy LICENSE dist\LICENSE copy README.md dist\README.md copy janet.lib dist\janet.lib copy janet.exp dist\janet.exp -copy src\include\janet\janet.h dist\janet.h +copy src\include\janet.h dist\janet.h copy tools\cook.janet dist\cook.janet copy tools\highlight.janet dist\highlight.janet exit /b 0 diff --git a/ctest/array_test.c b/ctest/array_test.c index 656e51ad..9b7a8fcc 100644 --- a/ctest/array_test.c +++ b/ctest/array_test.c @@ -20,7 +20,7 @@ * IN THE SOFTWARE. */ -#include +#include #include int main() { diff --git a/ctest/buffer_test.c b/ctest/buffer_test.c index 2275a0aa..a4345f0c 100644 --- a/ctest/buffer_test.c +++ b/ctest/buffer_test.c @@ -20,7 +20,7 @@ * IN THE SOFTWARE. */ -#include +#include #include int main() { diff --git a/ctest/number_test.c b/ctest/number_test.c index 5a682274..89c755a5 100644 --- a/ctest/number_test.c +++ b/ctest/number_test.c @@ -20,7 +20,7 @@ * IN THE SOFTWARE. */ -#include +#include #include #include #include diff --git a/ctest/system_test.c b/ctest/system_test.c index 3413c27e..91faf70e 100644 --- a/ctest/system_test.c +++ b/ctest/system_test.c @@ -20,7 +20,7 @@ * IN THE SOFTWARE. */ -#include +#include #include #include diff --git a/ctest/table_test.c b/ctest/table_test.c index fad51830..af9567cf 100644 --- a/ctest/table_test.c +++ b/ctest/table_test.c @@ -20,7 +20,7 @@ * IN THE SOFTWARE. */ -#include +#include #include int main() { diff --git a/examples/numarray/numarray.c b/examples/numarray/numarray.c index 5a5beb63..6163ebd9 100644 --- a/examples/numarray/numarray.c +++ b/examples/numarray/numarray.c @@ -1,5 +1,5 @@ #include -#include +#include typedef struct { double * data; diff --git a/src/boot/boot.c b/src/boot/boot.c index 019d84bb..622d992d 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -20,7 +20,7 @@ * IN THE SOFTWARE. */ -#include +#include extern const unsigned char *janet_gen_boot; extern int32_t janet_gen_boot_size; diff --git a/src/boot/boot.janet b/src/boot/boot.janet index dd8fcdc0..3f3ec3e9 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -29,7 +29,7 @@ (def image-file (file/open "build/core_image.c" :w)) (file/write image-file "#ifndef JANET_AMALG\n" - "#include \n" + "#include \n" "#endif\n" "static const unsigned char janet_core_image_bytes[] = {\n") (loop [line :in (partition 10 chunks)] diff --git a/src/core/abstract.c b/src/core/abstract.c index 89dd60a1..ff123fbf 100644 --- a/src/core/abstract.c +++ b/src/core/abstract.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "gc.h" #endif diff --git a/src/core/array.c b/src/core/array.c index 44f0a3f5..8f5aa328 100644 --- a/src/core/array.c +++ b/src/core/array.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "gc.h" #include "util.h" #endif diff --git a/src/core/asm.c b/src/core/asm.c index b0672e30..616d075b 100644 --- a/src/core/asm.c +++ b/src/core/asm.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "util.h" #endif diff --git a/src/core/buffer.c b/src/core/buffer.c index 33e067d1..119067ea 100644 --- a/src/core/buffer.c +++ b/src/core/buffer.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "gc.h" #include "util.h" #endif diff --git a/src/core/bytecode.c b/src/core/bytecode.c index 1906e177..a80630cb 100644 --- a/src/core/bytecode.c +++ b/src/core/bytecode.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "gc.h" #endif diff --git a/src/core/capi.c b/src/core/capi.c index 192f8f63..17cb4ba2 100644 --- a/src/core/capi.c +++ b/src/core/capi.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "state.h" #include "fiber.h" #endif diff --git a/src/core/cfuns.c b/src/core/cfuns.c index 1e76d856..1e487fe4 100644 --- a/src/core/cfuns.c +++ b/src/core/cfuns.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "compile.h" #include "emit.h" #include "vector.h" diff --git a/src/core/compile.c b/src/core/compile.c index a5ffeb71..8068a263 100644 --- a/src/core/compile.c +++ b/src/core/compile.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "compile.h" #include "emit.h" #include "vector.h" diff --git a/src/core/compile.h b/src/core/compile.h index c24aaa41..c5941a3c 100644 --- a/src/core/compile.h +++ b/src/core/compile.h @@ -24,7 +24,7 @@ #define JANET_COMPILE_H #ifndef JANET_AMALG -#include +#include #include "regalloc.h" #endif diff --git a/src/core/core.janet b/src/core/core.janet index 9185512c..18e9f0cd 100644 --- a/src/core/core.janet +++ b/src/core/core.janet @@ -1605,6 +1605,10 @@ value, one key will be ignored." on Windows is C:/Janet/Library." (or (os/getenv "JANET_PATH") "")) +(var module/*headerpath* + "The path where janet/janet.h is located." + (or (os/getenv "JANET_INCLUDEDIR") "")) + (defn- fexists [path] (def f (file/open path)) (if f (do (file/close f) path))) diff --git a/src/core/corelib.c b/src/core/corelib.c index 546d2a32..aa9b8104 100644 --- a/src/core/corelib.c +++ b/src/core/corelib.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "compile.h" #include "state.h" #include "util.h" diff --git a/src/core/debug.c b/src/core/debug.c index e2dd0aff..a656f9d9 100644 --- a/src/core/debug.c +++ b/src/core/debug.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "gc.h" #include "state.h" #include "util.h" diff --git a/src/core/emit.c b/src/core/emit.c index e0e09341..6edbfcbc 100644 --- a/src/core/emit.c +++ b/src/core/emit.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "emit.h" #include "vector.h" #include "regalloc.h" diff --git a/src/core/fiber.c b/src/core/fiber.c index c5e16f0b..15737d43 100644 --- a/src/core/fiber.c +++ b/src/core/fiber.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "fiber.h" #include "state.h" #include "gc.h" diff --git a/src/core/fiber.h b/src/core/fiber.h index bc79f650..aaeaacf4 100644 --- a/src/core/fiber.h +++ b/src/core/fiber.h @@ -24,7 +24,7 @@ #define JANET_FIBER_H_defined #ifndef JANET_AMALG -#include +#include #endif extern JANET_THREAD_LOCAL JanetFiber *janet_vm_fiber; diff --git a/src/core/gc.c b/src/core/gc.c index fef9855f..a7386163 100644 --- a/src/core/gc.c +++ b/src/core/gc.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "state.h" #include "symcache.h" #include "gc.h" diff --git a/src/core/gc.h b/src/core/gc.h index db738c1c..a574bc38 100644 --- a/src/core/gc.h +++ b/src/core/gc.h @@ -24,7 +24,7 @@ #define JANET_GC_H #ifndef JANET_AMALG -#include +#include #endif /* The metadata header associated with an allocated block of memory */ diff --git a/src/core/io.c b/src/core/io.c index 4e010615..10b431dc 100644 --- a/src/core/io.c +++ b/src/core/io.c @@ -28,7 +28,7 @@ #include #ifndef JANET_AMALG -#include +#include #include "util.h" #endif diff --git a/src/core/marsh.c b/src/core/marsh.c index f8a04a0f..069e9675 100644 --- a/src/core/marsh.c +++ b/src/core/marsh.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "state.h" #include "vector.h" #include "gc.h" diff --git a/src/core/math.c b/src/core/math.c index d33778c5..86682978 100644 --- a/src/core/math.c +++ b/src/core/math.c @@ -23,7 +23,7 @@ #include #ifndef JANET_AMALG -#include +#include #include "util.h" #endif diff --git a/src/core/os.c b/src/core/os.c index 43b7add8..cb5f3e57 100644 --- a/src/core/os.c +++ b/src/core/os.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "util.h" #endif diff --git a/src/core/parse.c b/src/core/parse.c index d14a12e8..bc53a3f7 100644 --- a/src/core/parse.c +++ b/src/core/parse.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "util.h" #endif diff --git a/src/core/peg.c b/src/core/peg.c index 787408cf..c2d07c83 100644 --- a/src/core/peg.c +++ b/src/core/peg.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include #include "util.h" #include "vector.h" diff --git a/src/core/pp.c b/src/core/pp.c index f083c662..f03a81b7 100644 --- a/src/core/pp.c +++ b/src/core/pp.c @@ -24,7 +24,7 @@ #include #ifndef JANET_AMALG -#include +#include #include "util.h" #include "state.h" #endif diff --git a/src/core/regalloc.c b/src/core/regalloc.c index 0ac0dbb4..7a2eb699 100644 --- a/src/core/regalloc.c +++ b/src/core/regalloc.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "regalloc.h" #endif diff --git a/src/core/run.c b/src/core/run.c index eabd1f61..dd087546 100644 --- a/src/core/run.c +++ b/src/core/run.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "state.h" #endif diff --git a/src/core/specials.c b/src/core/specials.c index 4b1ce3c0..820da740 100644 --- a/src/core/specials.c +++ b/src/core/specials.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "compile.h" #include "util.h" #include "vector.h" diff --git a/src/core/string.c b/src/core/string.c index 9d42843b..f46efa8b 100644 --- a/src/core/string.c +++ b/src/core/string.c @@ -23,7 +23,7 @@ #include #ifndef JANET_AMALG -#include +#include #include "gc.h" #include "util.h" #include "state.h" diff --git a/src/core/strtod.c b/src/core/strtod.c index d6aaa71c..aa6c061b 100644 --- a/src/core/strtod.c +++ b/src/core/strtod.c @@ -44,7 +44,7 @@ #include #ifndef JANET_AMALG -#include +#include #endif /* Lookup table for getting values of characters when parsing numbers. Handles diff --git a/src/core/struct.c b/src/core/struct.c index bd3afae6..19d6efca 100644 --- a/src/core/struct.c +++ b/src/core/struct.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "gc.h" #include "util.h" #include diff --git a/src/core/symcache.c b/src/core/symcache.c index c605b623..2a489147 100644 --- a/src/core/symcache.c +++ b/src/core/symcache.c @@ -26,10 +26,11 @@ * whole program. Equality is then just a pointer check. */ #ifndef JANET_AMALG -#include +#include #include "state.h" #include "gc.h" #include "util.h" +#include "symcache.h" #endif /* Cache state */ diff --git a/src/core/symcache.h b/src/core/symcache.h index 0e729754..3b8247d4 100644 --- a/src/core/symcache.h +++ b/src/core/symcache.h @@ -24,7 +24,7 @@ #define JANET_SYMCACHE_H_defined #ifndef JANET_AMALG -#include +#include #endif /* Initialize the cache (allocate cache memory) */ diff --git a/src/core/table.c b/src/core/table.c index c03bfa2b..95730714 100644 --- a/src/core/table.c +++ b/src/core/table.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "gc.h" #include "util.h" #include diff --git a/src/core/tuple.c b/src/core/tuple.c index 800106bc..310fd4d1 100644 --- a/src/core/tuple.c +++ b/src/core/tuple.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "symcache.h" #include "gc.h" #include "util.h" diff --git a/src/core/util.c b/src/core/util.c index ef4f68c2..9b3f2f9b 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -23,7 +23,7 @@ #include #ifndef JANET_AMALG -#include +#include #include "util.h" #include "state.h" #include "gc.h" diff --git a/src/core/util.h b/src/core/util.h index 27c0f01f..f4d96a0f 100644 --- a/src/core/util.h +++ b/src/core/util.h @@ -24,7 +24,7 @@ #define JANET_UTIL_H_defined #ifndef JANET_AMALG -#include +#include #endif /* Omit docstrings in some builds */ diff --git a/src/core/value.c b/src/core/value.c index 54ad73fe..f6f8ed81 100644 --- a/src/core/value.c +++ b/src/core/value.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #endif /* diff --git a/src/core/vector.h b/src/core/vector.h index 0852e113..d52c954a 100644 --- a/src/core/vector.h +++ b/src/core/vector.h @@ -24,7 +24,7 @@ #define JANET_VECTOR_H_defined #ifndef JANET_AMALG -#include +#include #endif /* diff --git a/src/core/vm.c b/src/core/vm.c index afb80ac5..86d47e05 100644 --- a/src/core/vm.c +++ b/src/core/vm.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #include "state.h" #include "fiber.h" #include "gc.h" diff --git a/src/core/wrap.c b/src/core/wrap.c index 40c37566..203604e8 100644 --- a/src/core/wrap.c +++ b/src/core/wrap.c @@ -21,7 +21,7 @@ */ #ifndef JANET_AMALG -#include +#include #endif void *janet_memalloc_empty(int32_t count) { diff --git a/src/include/janet/janet.h b/src/include/janet.h similarity index 100% rename from src/include/janet/janet.h rename to src/include/janet.h diff --git a/src/mainclient/line.h b/src/mainclient/line.h index 51b134bb..03699a90 100644 --- a/src/mainclient/line.h +++ b/src/mainclient/line.h @@ -23,7 +23,7 @@ #ifndef JANET_LINE_H_defined #define JANET_LINE_H_defined -#include +#include void janet_line_init(); void janet_line_deinit(); diff --git a/src/mainclient/main.c b/src/mainclient/main.c index 0f4ce7a4..688ee976 100644 --- a/src/mainclient/main.c +++ b/src/mainclient/main.c @@ -20,7 +20,7 @@ * IN THE SOFTWARE. */ -#include +#include #include "line.h" extern const unsigned char *janet_gen_init; diff --git a/src/webclient/main.c b/src/webclient/main.c index 651f8808..576d1caf 100644 --- a/src/webclient/main.c +++ b/src/webclient/main.c @@ -20,7 +20,7 @@ * IN THE SOFTWARE. */ -#include +#include #include extern const unsigned char *janet_gen_webinit;