ref: d592c785c0b2f9fea982ac3fe7b88fdd7c4817fc
parent: 11385152552eac0cd03252b8d7012fac85464049
author: Ismael Luceno <ismael@iodev.co.uk>
date: Fri Mar 18 14:51:28 EDT 2022
Enable choice of library version for shell Default behavior is unchanged, but enables to chose the dynamic version by passing "libmujs=libmujs.so" to make.
--- a/Makefile
+++ b/Makefile
@@ -90,13 +90,15 @@
@ mkdir -p $(@D)
$(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -shared $(LDFLAGS) -o $@ $< -lm
-$(OUT)/mujs: $(OUT)/libmujs.o $(OUT)/main.o
+libmujs ?= libmujs.a
+
+$(OUT)/mujs: $(OUT)/main.o $(OUT)/$(libmujs)
@ mkdir -p $(@D)
- $(CC) $(LDFLAGS) -o $@ $^ $(LIBREADLINE) -lm
+ $(CC) $(LDFLAGS) -o $@ $< -L$(OUT) -l:$(libmujs) $(LIBREADLINE) -lm
-$(OUT)/mujs-pp: $(OUT)/libmujs.o $(OUT)/pp.o
+$(OUT)/mujs-pp: $(OUT)/pp.o $(OUT)/$(libmujs)
@ mkdir -p $(@D)
- $(CC) $(LDFLAGS) -o $@ $^ -lm
+ $(CC) $(LDFLAGS) -o $@ $< -L$(OUT) -l:$(libmujs) -lm
.PHONY: $(OUT)/mujs.pc
$(OUT)/mujs.pc: