Skip to content

Commit

Permalink
Set library SONAME with version
Browse files Browse the repository at this point in the history
  • Loading branch information
aleasto committed Jan 26, 2024
1 parent 40556b3 commit 8d8ad8e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

default: build/debug/mujs build/debug/mujs-pp

SOVERSION = 1

CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter

OPTIM = -O3
Expand Down Expand Up @@ -84,7 +86,8 @@ build/sanitize/mujs: main.c one.c $(SRCS) $(HDRS)

build/debug/libmujs.$(SO): one.c $(SRCS) $(HDRS)
@mkdir -p $(@D)
$(CC) $(CFLAGS) -g -fPIC -shared -o $@ one.c -lm
$(CC) $(CFLAGS) -g -fPIC -shared -Wl,-soname,libmujs.so.$(SOVERSION) -o $@.$(SOVERSION) one.c -lm
ln -sf libmujs.so.$(SOVERSION) $@
build/debug/libmujs.o: one.c $(SRCS) $(HDRS)
@mkdir -p $(@D)
$(CC) $(CFLAGS) -g -c -o $@ one.c
Expand All @@ -97,7 +100,8 @@ build/debug/mujs-pp: pp.c build/debug/libmujs.o

build/release/libmujs.$(SO): one.c $(SRCS) $(HDRS)
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(OPTIM) -fPIC -shared -o $@ one.c -lm
$(CC) $(CFLAGS) $(OPTIM) -fPIC -shared -Wl,-soname,libmujs.so.$(SOVERSION) -o $@.$(SOVERSION) one.c -lm
ln -sf libmujs.so.$(SOVERSION) $@
build/release/libmujs.o: one.c $(SRCS) $(HDRS)
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(OPTIM) -c -o $@ one.c
Expand Down Expand Up @@ -132,6 +136,7 @@ install-static: install-common build/release/libmujs.a

install-shared: install-common build/release/libmujs.$(SO)
install -m 755 build/release/libmujs.$(SO) $(DESTDIR)$(libdir)
install -m 755 build/release/libmujs.$(SO).$(SOVERSION) $(DESTDIR)$(libdir)

install: install-static

Expand All @@ -142,6 +147,7 @@ uninstall:
rm -f $(DESTDIR)$(libdir)/pkgconfig/mujs.pc
rm -f $(DESTDIR)$(libdir)/libmujs.a
rm -f $(DESTDIR)$(libdir)/libmujs.$(SO)
rm -f $(DESTDIR)$(libdir)/libmujs.$(SO).$(SOVERSION)

tarball:
git archive --format=zip --prefix=mujs-$(VERSION)/ HEAD > mujs-$(VERSION).zip
Expand Down

0 comments on commit 8d8ad8e

Please sign in to comment.