Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ endif
#CONFIG_WIN32=y
# use link time optimization (smaller and faster executables but slower build)
#CONFIG_LTO=y
# also build libquickjs as a shared library
#CONFIG_SHARED=y
# consider warnings as errors (for development)
#CONFIG_WERROR=y
# force 32 bit build for some utilities
Expand Down Expand Up @@ -205,6 +207,10 @@ PROGS+=libquickjs.a
ifdef CONFIG_LTO
PROGS+=libquickjs.lto.a
endif
ifdef CONFIG_SHARED
SO_VERSION=$(shell sed 's/-/./g' VERSION)
PROGS+=libquickjs.so.$(SO_VERSION)
endif

# examples
ifeq ($(CROSS_PREFIX),)
Expand Down Expand Up @@ -289,6 +295,11 @@ libquickjs.a: $(patsubst %.o, %.nolto.o, $(QJS_LIB_OBJS))
$(AR) rcs $@ $^
endif # CONFIG_LTO

ifdef CONFIG_SHARED
libquickjs.so.$(SO_VERSION): $(patsubst %.o, %.pic.o, $(QJS_LIB_OBJS))
$(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $^
endif # CONFIG_SHARED

repl.c: $(QJSC) repl.js
$(QJSC) -c -o $@ -m repl.js

Expand Down Expand Up @@ -362,6 +373,10 @@ install: all
install -m644 libquickjs.a "$(DESTDIR)$(PREFIX)/lib/quickjs"
ifdef CONFIG_LTO
install -m644 libquickjs.lto.a "$(DESTDIR)$(PREFIX)/lib/quickjs"
endif
ifdef CONFIG_SHARED
install -Dm755 libquickjs.so.$(SO_VERSION) "$(DESTDIR)$(PREFIX)/lib"
ln -s libquickjs.so.$(SO_VERSION) "$(DESTDIR)$(PREFIX)/lib/libquickjs.so"
endif
mkdir -p "$(DESTDIR)$(PREFIX)/include/quickjs"
install -m644 quickjs.h quickjs-libc.h "$(DESTDIR)$(PREFIX)/include/quickjs"
Expand Down