2019-01-24 05:26:57 +00:00
|
|
|
# Copyright (c) 2019 Calvin Rose
|
2018-12-08 19:17:03 +00:00
|
|
|
#
|
2018-03-18 18:03:26 +00:00
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to
|
|
|
|
# deal in the Software without restriction, including without limitation the
|
|
|
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
# sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
2018-12-08 19:17:03 +00:00
|
|
|
#
|
2018-03-18 18:03:26 +00:00
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
# all copies or substantial portions of the Software.
|
2018-12-08 19:17:03 +00:00
|
|
|
#
|
2018-03-18 18:03:26 +00:00
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
# IN THE SOFTWARE.
|
|
|
|
|
|
|
|
################################
|
|
|
|
##### Set global variables #####
|
|
|
|
################################
|
|
|
|
|
2018-09-10 18:21:08 +00:00
|
|
|
PREFIX?=/usr/local
|
2018-05-15 01:52:51 +00:00
|
|
|
|
2019-02-19 01:13:35 +00:00
|
|
|
INCLUDEDIR=$(PREFIX)/include
|
2018-03-18 18:03:26 +00:00
|
|
|
BINDIR=$(PREFIX)/bin
|
2019-04-28 20:02:05 +00:00
|
|
|
LIBDIR=$(PREFIX)/lib
|
2018-12-08 19:17:03 +00:00
|
|
|
JANET_BUILD?="\"$(shell git log --pretty=format:'%h' -n 1)\""
|
2019-02-16 00:02:14 +00:00
|
|
|
CLIBS=-lm
|
2018-12-09 22:37:11 +00:00
|
|
|
JANET_TARGET=build/janet
|
|
|
|
JANET_LIBRARY=build/libjanet.so
|
2019-05-16 02:38:18 +00:00
|
|
|
JANET_STATIC_LIBRARY=build/libjanet.a
|
2019-02-18 18:46:35 +00:00
|
|
|
JANET_PATH?=$(PREFIX)/lib/janet
|
|
|
|
MANPATH?=$(PREFIX)/share/man/man1/
|
2019-05-24 23:36:07 +00:00
|
|
|
PKG_CONFIG_PATH?=$(PREFIX)/lib/pkgconfig
|
2018-03-18 18:03:26 +00:00
|
|
|
DEBUGGER=gdb
|
|
|
|
|
2019-06-20 20:33:28 +00:00
|
|
|
CFLAGS=-std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fpic -O2 -fvisibility=hidden \
|
2019-02-18 19:48:29 +00:00
|
|
|
-DJANET_BUILD=$(JANET_BUILD)
|
2019-03-03 23:55:10 +00:00
|
|
|
LDFLAGS=-rdynamic
|
2019-02-18 18:46:35 +00:00
|
|
|
|
2019-09-18 17:20:59 +00:00
|
|
|
# For installation
|
2019-09-20 18:13:05 +00:00
|
|
|
LDCONFIG:=ldconfig "$(LIBDIR)"
|
2019-09-18 17:20:59 +00:00
|
|
|
|
2019-03-03 23:55:10 +00:00
|
|
|
# Check OS
|
2018-11-29 00:56:58 +00:00
|
|
|
UNAME:=$(shell uname -s)
|
2018-12-08 19:17:03 +00:00
|
|
|
ifeq ($(UNAME), Darwin)
|
2019-02-16 00:02:14 +00:00
|
|
|
CLIBS:=$(CLIBS) -ldl
|
2019-09-20 18:13:05 +00:00
|
|
|
LDCONFIG:=
|
2019-03-03 23:55:10 +00:00
|
|
|
else ifeq ($(UNAME), Linux)
|
2019-02-16 00:02:14 +00:00
|
|
|
CLIBS:=$(CLIBS) -lrt -ldl
|
2018-11-29 00:56:58 +00:00
|
|
|
endif
|
2019-03-04 17:16:49 +00:00
|
|
|
# For other unix likes, add flags here!
|
2019-05-14 10:41:33 +00:00
|
|
|
ifeq ($(UNAME),Haiku)
|
|
|
|
LDFLAGS=-Wl,--export-dynamic
|
|
|
|
endif
|
2018-05-22 02:08:16 +00:00
|
|
|
|
2019-02-08 05:44:30 +00:00
|
|
|
$(shell mkdir -p build/core build/mainclient build/webclient build/boot)
|
2019-05-16 02:38:18 +00:00
|
|
|
all: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY)
|
2018-12-09 22:37:11 +00:00
|
|
|
|
2019-03-23 17:50:50 +00:00
|
|
|
######################
|
|
|
|
##### Name Files #####
|
|
|
|
######################
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2019-06-20 20:33:28 +00:00
|
|
|
JANET_HEADERS=src/include/janet.h src/conf/janetconf.h
|
2019-03-23 17:50:50 +00:00
|
|
|
|
|
|
|
JANET_LOCAL_HEADERS=src/core/util.h \
|
|
|
|
src/core/state.h \
|
|
|
|
src/core/gc.h \
|
|
|
|
src/core/vector.h \
|
|
|
|
src/core/fiber.h \
|
|
|
|
src/core/regalloc.h \
|
|
|
|
src/core/compile.h \
|
|
|
|
src/core/emit.h \
|
|
|
|
src/core/symcache.h
|
|
|
|
|
|
|
|
JANET_CORE_SOURCES=src/core/abstract.c \
|
|
|
|
src/core/array.c \
|
|
|
|
src/core/asm.c \
|
|
|
|
src/core/buffer.c \
|
|
|
|
src/core/bytecode.c \
|
|
|
|
src/core/capi.c \
|
|
|
|
src/core/cfuns.c \
|
|
|
|
src/core/compile.c \
|
|
|
|
src/core/corelib.c \
|
|
|
|
src/core/debug.c \
|
|
|
|
src/core/emit.c \
|
|
|
|
src/core/fiber.c \
|
|
|
|
src/core/gc.c \
|
|
|
|
src/core/inttypes.c \
|
|
|
|
src/core/io.c \
|
|
|
|
src/core/marsh.c \
|
|
|
|
src/core/math.c \
|
|
|
|
src/core/os.c \
|
|
|
|
src/core/parse.c \
|
|
|
|
src/core/peg.c \
|
|
|
|
src/core/pp.c \
|
|
|
|
src/core/regalloc.c \
|
|
|
|
src/core/run.c \
|
|
|
|
src/core/specials.c \
|
|
|
|
src/core/string.c \
|
|
|
|
src/core/strtod.c \
|
|
|
|
src/core/struct.c \
|
|
|
|
src/core/symcache.c \
|
|
|
|
src/core/table.c \
|
|
|
|
src/core/tuple.c \
|
|
|
|
src/core/typedarray.c \
|
|
|
|
src/core/util.c \
|
|
|
|
src/core/value.c \
|
|
|
|
src/core/vector.c \
|
|
|
|
src/core/vm.c \
|
|
|
|
src/core/wrap.c
|
|
|
|
|
|
|
|
JANET_BOOT_SOURCES=src/boot/array_test.c \
|
|
|
|
src/boot/boot.c \
|
|
|
|
src/boot/buffer_test.c \
|
|
|
|
src/boot/number_test.c \
|
|
|
|
src/boot/system_test.c \
|
|
|
|
src/boot/table_test.c
|
|
|
|
|
|
|
|
JANET_MAINCLIENT_SOURCES=src/mainclient/line.c src/mainclient/main.c
|
|
|
|
|
|
|
|
JANET_WEBCLIENT_SOURCES=src/webclient/main.c
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2019-02-08 05:44:30 +00:00
|
|
|
##################################################################
|
|
|
|
##### The bootstrap interpreter that compiles the core image #####
|
|
|
|
##################################################################
|
|
|
|
|
2019-02-21 16:22:29 +00:00
|
|
|
JANET_BOOT_OBJECTS=$(patsubst src/%.c,build/%.boot.o,$(JANET_CORE_SOURCES) $(JANET_BOOT_SOURCES)) \
|
2019-02-08 05:44:30 +00:00
|
|
|
build/boot.gen.o
|
|
|
|
|
2019-03-22 18:31:20 +00:00
|
|
|
build/%.boot.o: src/%.c $(JANET_HEADERS) $(JANET_LOCAL_HEADERS)
|
2019-02-08 05:44:30 +00:00
|
|
|
$(CC) $(CFLAGS) -DJANET_BOOTSTRAP -o $@ -c $<
|
|
|
|
|
|
|
|
build/janet_boot: $(JANET_BOOT_OBJECTS)
|
|
|
|
$(CC) $(CFLAGS) -DJANET_BOOTSTRAP -o $@ $^ $(CLIBS)
|
|
|
|
|
|
|
|
# Now the reason we bootstrap in the first place
|
|
|
|
build/core_image.c: build/janet_boot
|
2019-08-27 23:10:03 +00:00
|
|
|
build/janet_boot $@ JANET_PATH '$(JANET_PATH)' JANET_HEADERPATH '$(INCLUDEDIR)/janet'
|
2019-02-08 05:44:30 +00:00
|
|
|
|
2018-05-15 01:52:51 +00:00
|
|
|
##########################################################
|
|
|
|
##### The main interpreter program and shared object #####
|
|
|
|
##########################################################
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2019-02-08 05:44:30 +00:00
|
|
|
JANET_CORE_OBJECTS=$(patsubst src/%.c,build/%.o,$(JANET_CORE_SOURCES)) build/core_image.o
|
2018-12-09 22:37:11 +00:00
|
|
|
JANET_MAINCLIENT_OBJECTS=$(patsubst src/%.c,build/%.o,$(JANET_MAINCLIENT_SOURCES)) build/init.gen.o
|
2018-05-15 01:52:51 +00:00
|
|
|
|
2019-02-08 05:44:30 +00:00
|
|
|
# Compile the core image generated by the bootstrap build
|
|
|
|
build/core_image.o: build/core_image.c $(JANET_HEADERS) $(JANET_LOCAL_HEADERS)
|
2018-12-09 22:37:11 +00:00
|
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2018-12-09 22:37:11 +00:00
|
|
|
build/%.o: src/%.c $(JANET_HEADERS) $(JANET_LOCAL_HEADERS)
|
2018-05-10 15:11:18 +00:00
|
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2018-12-09 22:37:11 +00:00
|
|
|
$(JANET_TARGET): $(JANET_CORE_OBJECTS) $(JANET_MAINCLIENT_OBJECTS)
|
2019-03-03 23:55:10 +00:00
|
|
|
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(CLIBS)
|
2018-05-15 01:52:51 +00:00
|
|
|
|
2018-09-06 02:18:42 +00:00
|
|
|
$(JANET_LIBRARY): $(JANET_CORE_OBJECTS)
|
2019-03-03 23:55:10 +00:00
|
|
|
$(CC) $(LDFLAGS) $(CFLAGS) -shared -o $@ $^ $(CLIBS)
|
2018-10-17 03:08:26 +00:00
|
|
|
|
2019-05-16 02:38:18 +00:00
|
|
|
$(JANET_STATIC_LIBRARY): $(JANET_CORE_OBJECTS)
|
|
|
|
$(AR) rcs $@ $^
|
|
|
|
|
2018-10-17 03:08:26 +00:00
|
|
|
######################
|
|
|
|
##### Emscripten #####
|
|
|
|
######################
|
|
|
|
|
|
|
|
EMCC=emcc
|
2019-06-24 21:23:01 +00:00
|
|
|
EMCFLAGS=-std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -O2 \
|
2018-11-15 23:56:06 +00:00
|
|
|
-s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap"]' \
|
2018-11-26 14:02:07 +00:00
|
|
|
-s ALLOW_MEMORY_GROWTH=1 \
|
|
|
|
-s AGGRESSIVE_VARIABLE_ELIMINATION=1 \
|
2018-12-08 19:17:03 +00:00
|
|
|
-DJANET_BUILD=$(JANET_BUILD)
|
2018-12-09 22:37:11 +00:00
|
|
|
JANET_EMTARGET=build/janet.js
|
2018-10-17 03:08:26 +00:00
|
|
|
JANET_WEB_SOURCES=$(JANET_CORE_SOURCES) $(JANET_WEBCLIENT_SOURCES)
|
2018-12-09 22:37:11 +00:00
|
|
|
JANET_EMOBJECTS=$(patsubst src/%.c,build/%.bc,$(JANET_WEB_SOURCES)) \
|
2019-02-08 16:04:33 +00:00
|
|
|
build/webinit.gen.bc build/core_image.bc
|
2018-12-09 22:37:11 +00:00
|
|
|
|
|
|
|
%.gen.bc: %.gen.c
|
|
|
|
$(EMCC) $(EMCFLAGS) -o $@ -c $<
|
2019-02-08 16:04:33 +00:00
|
|
|
|
|
|
|
build/core_image.bc: build/core_image.c $(JANET_HEADERS) $(JANET_LOCAL_HEADERS)
|
|
|
|
$(EMCC) $(EMCFLAGS) -o $@ -c $<
|
2018-10-17 03:08:26 +00:00
|
|
|
|
2018-12-09 22:37:11 +00:00
|
|
|
build/%.bc: src/%.c $(JANET_HEADERS) $(JANET_LOCAL_HEADERS)
|
|
|
|
$(EMCC) $(EMCFLAGS) -o $@ -c $<
|
2018-10-17 03:08:26 +00:00
|
|
|
|
|
|
|
$(JANET_EMTARGET): $(JANET_EMOBJECTS)
|
2018-12-09 22:37:11 +00:00
|
|
|
$(EMCC) $(EMCFLAGS) -shared -o $@ $^
|
|
|
|
|
|
|
|
emscripten: $(JANET_EMTARGET)
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2018-12-06 19:30:11 +00:00
|
|
|
#############################
|
|
|
|
##### Generated C files #####
|
|
|
|
#############################
|
|
|
|
|
2019-02-08 05:44:30 +00:00
|
|
|
%.gen.o: %.gen.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
|
|
|
|
2018-12-09 22:49:00 +00:00
|
|
|
build/xxd: tools/xxd.c
|
2018-12-06 19:30:11 +00:00
|
|
|
$(CC) $< -o $@
|
|
|
|
|
2018-12-09 22:37:11 +00:00
|
|
|
build/init.gen.c: src/mainclient/init.janet build/xxd
|
|
|
|
build/xxd $< $@ janet_gen_init
|
|
|
|
build/webinit.gen.c: src/webclient/webinit.janet build/xxd
|
|
|
|
build/xxd $< $@ janet_gen_webinit
|
2019-02-08 05:44:30 +00:00
|
|
|
build/boot.gen.c: src/boot/boot.janet build/xxd
|
|
|
|
build/xxd $< $@ janet_gen_boot
|
2018-12-06 19:30:11 +00:00
|
|
|
|
2019-01-24 05:15:58 +00:00
|
|
|
########################
|
|
|
|
##### Amalgamation #####
|
|
|
|
########################
|
|
|
|
|
2019-02-08 05:44:30 +00:00
|
|
|
amalg: build/janet.c build/janet.h build/core_image.c
|
2019-01-24 05:15:58 +00:00
|
|
|
|
2019-03-23 17:50:50 +00:00
|
|
|
AMALG_SOURCE=$(JANET_LOCAL_HEADERS) $(JANET_CORE_SOURCES) build/core_image.c
|
|
|
|
build/janet.c: $(AMALG_SOURCE) tools/amalg.janet $(JANET_TARGET)
|
|
|
|
$(JANET_TARGET) tools/amalg.janet $(AMALG_SOURCE) > $@
|
2019-01-24 05:15:58 +00:00
|
|
|
|
2019-02-19 01:13:35 +00:00
|
|
|
build/janet.h: src/include/janet.h
|
2019-01-24 05:15:58 +00:00
|
|
|
cp $< $@
|
|
|
|
|
2018-03-18 18:03:26 +00:00
|
|
|
###################
|
|
|
|
##### Testing #####
|
|
|
|
###################
|
|
|
|
|
2018-12-02 20:29:21 +00:00
|
|
|
TEST_SCRIPTS=$(wildcard test/suite*.janet)
|
2018-11-18 18:56:27 +00:00
|
|
|
|
2018-09-06 02:18:42 +00:00
|
|
|
repl: $(JANET_TARGET)
|
|
|
|
./$(JANET_TARGET)
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2018-09-06 02:18:42 +00:00
|
|
|
debug: $(JANET_TARGET)
|
|
|
|
$(DEBUGGER) ./$(JANET_TARGET)
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2019-01-06 17:32:44 +00:00
|
|
|
VALGRIND_COMMAND=valgrind --leak-check=full
|
|
|
|
|
2018-09-06 02:18:42 +00:00
|
|
|
valgrind: $(JANET_TARGET)
|
2019-01-06 17:32:44 +00:00
|
|
|
$(VALGRIND_COMMAND) ./$(JANET_TARGET)
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2018-11-18 18:56:27 +00:00
|
|
|
test: $(JANET_TARGET) $(TEST_PROGRAMS)
|
2019-03-13 18:50:25 +00:00
|
|
|
for f in test/suite*.janet; do ./$(JANET_TARGET) "$$f" || exit; done
|
2018-12-02 20:29:21 +00:00
|
|
|
|
2018-11-18 18:56:27 +00:00
|
|
|
valtest: $(JANET_TARGET) $(TEST_PROGRAMS)
|
2019-03-13 18:50:25 +00:00
|
|
|
for f in test/suite*.janet; do $(VALGRIND_COMMAND) ./$(JANET_TARGET) "$$f" || exit; done
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2019-01-07 02:49:24 +00:00
|
|
|
callgrind: $(JANET_TARGET)
|
2019-03-13 18:50:25 +00:00
|
|
|
for f in test/suite*.janet; do valgrind --tool=callgrind ./$(JANET_TARGET) "$$f" || exit; done
|
2019-01-07 02:49:24 +00:00
|
|
|
|
2018-12-09 22:37:11 +00:00
|
|
|
########################
|
|
|
|
##### Distribution #####
|
|
|
|
########################
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2018-12-09 22:37:11 +00:00
|
|
|
dist: build/janet-dist.tar.gz
|
2018-12-08 21:17:34 +00:00
|
|
|
|
2019-03-22 18:31:20 +00:00
|
|
|
build/janet-%.tar.gz: $(JANET_TARGET) \
|
2019-06-20 20:33:28 +00:00
|
|
|
src/include/janet.h src/conf/janetconf.h \
|
2019-09-05 17:28:11 +00:00
|
|
|
jpm.1 janet.1 LICENSE CONTRIBUTING.md $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) \
|
2019-01-28 16:50:33 +00:00
|
|
|
build/doc.html README.md build/janet.c
|
2019-09-09 11:30:16 +00:00
|
|
|
$(eval JANET_DIST_DIR = "janet-$(shell basename $*)")
|
|
|
|
mkdir -p build/$(JANET_DIST_DIR)
|
|
|
|
cp -r $^ build/$(JANET_DIST_DIR)/
|
|
|
|
cd build && tar -czvf ../$@ $(JANET_DIST_DIR)
|
2018-12-08 21:17:34 +00:00
|
|
|
|
2018-12-17 06:41:11 +00:00
|
|
|
#########################
|
|
|
|
##### Documentation #####
|
|
|
|
#########################
|
|
|
|
|
|
|
|
docs: build/doc.html
|
|
|
|
|
2018-12-25 22:37:52 +00:00
|
|
|
build/doc.html: $(JANET_TARGET) tools/gendoc.janet
|
|
|
|
$(JANET_TARGET) tools/gendoc.janet > build/doc.html
|
2018-12-17 06:41:11 +00:00
|
|
|
|
2019-05-24 23:36:07 +00:00
|
|
|
########################
|
|
|
|
##### Installation #####
|
|
|
|
########################
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2019-05-15 15:39:18 +00:00
|
|
|
SONAME=libjanet.so.1
|
2019-05-24 23:36:07 +00:00
|
|
|
|
2019-08-27 23:10:03 +00:00
|
|
|
.PHONY: build/janet.pc
|
|
|
|
build/janet.pc: $(JANET_TARGET)
|
2019-05-24 23:36:07 +00:00
|
|
|
echo 'prefix=$(PREFIX)' > $@
|
|
|
|
echo 'exec_prefix=$${prefix}' >> $@
|
|
|
|
echo 'includedir=$(INCLUDEDIR)/janet' >> $@
|
|
|
|
echo 'libdir=$(LIBDIR)' >> $@
|
|
|
|
echo "" >> $@
|
|
|
|
echo "Name: janet" >> $@
|
|
|
|
echo "Url: https://janet-lang.org" >> $@
|
|
|
|
echo "Description: Library for the Janet programming language." >> $@
|
|
|
|
$(JANET_TARGET) -e '(print "Version: " janet/version)' >> $@
|
|
|
|
echo 'Cflags: -I$${includedir}' >> $@
|
2019-05-24 23:58:52 +00:00
|
|
|
echo 'Libs: -L$${libdir} -ljanet $(LDFLAGS)' >> $@
|
2019-05-24 23:36:07 +00:00
|
|
|
echo 'Libs.private: $(CLIBS)' >> $@
|
|
|
|
|
2019-08-27 23:10:03 +00:00
|
|
|
install: $(JANET_TARGET) build/janet.pc
|
|
|
|
mkdir -p '$(BINDIR)'
|
|
|
|
cp $(JANET_TARGET) '$(BINDIR)/janet'
|
|
|
|
mkdir -p '$(INCLUDEDIR)/janet'
|
|
|
|
cp -rf $(JANET_HEADERS) '$(INCLUDEDIR)/janet'
|
|
|
|
mkdir -p '$(JANET_PATH)'
|
|
|
|
mkdir -p '$(LIBDIR)'
|
|
|
|
cp $(JANET_LIBRARY) '$(LIBDIR)/libjanet.so.$(shell $(JANET_TARGET) -e '(print janet/version)')'
|
|
|
|
cp $(JANET_STATIC_LIBRARY) '$(LIBDIR)/libjanet.a'
|
|
|
|
ln -sf $(SONAME) '$(LIBDIR)/libjanet.so'
|
2019-05-24 21:49:33 +00:00
|
|
|
ln -sf libjanet.so.$(shell $(JANET_TARGET) -e '(print janet/version)') $(LIBDIR)/$(SONAME)
|
2019-08-27 23:10:03 +00:00
|
|
|
cp -rf auxbin/* '$(BINDIR)'
|
|
|
|
mkdir -p '$(MANPATH)'
|
|
|
|
cp janet.1 '$(MANPATH)'
|
2019-09-05 17:28:11 +00:00
|
|
|
cp jpm.1 '$(MANPATH)'
|
2019-08-27 23:10:03 +00:00
|
|
|
mkdir -p '$(PKG_CONFIG_PATH)'
|
|
|
|
cp build/janet.pc '$(PKG_CONFIG_PATH)/janet.pc'
|
2019-09-20 18:13:05 +00:00
|
|
|
-$(LDCONFIG)
|
2018-03-18 18:03:26 +00:00
|
|
|
|
2019-06-24 12:21:07 +00:00
|
|
|
uninstall:
|
2019-08-27 23:10:03 +00:00
|
|
|
-rm '$(BINDIR)/janet'
|
|
|
|
-rm '$(BINDIR)/jpm'
|
|
|
|
-rm -rf '$(INCLUDEDIR)/janet'
|
|
|
|
-rm -rf '$(LIBDIR)'/libjanet.*
|
|
|
|
-rm '$(PKG_CONFIG_PATH)/janet.pc'
|
|
|
|
-rm '$(MANPATH)/janet.1'
|
2019-09-05 17:28:11 +00:00
|
|
|
-rm '$(MANPATH)/jpm.1'
|
2019-08-27 23:10:03 +00:00
|
|
|
# -rm -rf '$(JANET_PATH)'/* - err on the side of correctness here
|
2019-06-24 12:21:07 +00:00
|
|
|
|
2019-05-24 23:36:07 +00:00
|
|
|
#################
|
|
|
|
##### Other #####
|
|
|
|
#################
|
|
|
|
|
|
|
|
format:
|
|
|
|
tools/format.sh
|
|
|
|
|
|
|
|
grammar: build/janet.tmLanguage
|
|
|
|
build/janet.tmLanguage: tools/tm_lang_gen.janet $(JANET_TARGET)
|
|
|
|
$(JANET_TARGET) $< > $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
-rm -rf build vgcore.* callgrind.*
|
|
|
|
|
2019-03-03 19:48:17 +00:00
|
|
|
test-install:
|
2019-08-29 02:05:34 +00:00
|
|
|
cd test/install \
|
|
|
|
&& rm -rf build .cache .manifests \
|
|
|
|
&& jpm --verbose build \
|
|
|
|
&& jpm --verbose test \
|
|
|
|
&& build/testexec \
|
|
|
|
&& jpm --verbose --modpath=. install https://github.com/janet-lang/json.git
|
2019-03-03 19:48:17 +00:00
|
|
|
|
2019-05-23 14:34:01 +00:00
|
|
|
build/embed_janet.o: build/janet.c $(JANET_HEADERS)
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
build/embed_main.o: test/amalg/main.c $(JANET_HEADERS)
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
build/embed_test: build/embed_janet.o build/embed_main.o
|
|
|
|
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(CLIBS)
|
|
|
|
|
|
|
|
test-amalg: build/embed_test
|
|
|
|
./build/embed_test
|
|
|
|
|
2019-01-24 05:15:58 +00:00
|
|
|
.PHONY: clean install repl debug valgrind test amalg \
|
2019-02-24 19:25:04 +00:00
|
|
|
valtest emscripten dist uninstall docs grammar format
|