Skip to content

Commit

Permalink
fixed soname
Browse files Browse the repository at this point in the history
  • Loading branch information
Kareem Zidane committed Sep 30, 2018
1 parent 84c91e2 commit 9b9aa98
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION := 8.1.1
VERSION := 8.1.2
MAJOR_VERSION := $(shell echo $(VERSION) | head -c 1)

# installation directory (/usr/local by default)
Expand All @@ -18,7 +18,7 @@ ifeq ($(OS),Linux)
LIB_BASE := libcs50.so
LIB_MAJOR := libcs50.so.$(MAJOR_VERSION)
LIB_VERSION := libcs50.so.$(VERSION)
LINKER_FLAGS := -Wl,-soname,$(LIB_VERSION)
LINKER_FLAGS := -Wl,-soname,$(LIB_MAJOR)
# Mac
else ifeq ($(OS),Darwin)
LIB_BASE := libcs50.dylib
Expand All @@ -34,12 +34,11 @@ all: $(LIBS) $(MANS)

$(LIBS): $(SRC) $(INCLUDE) Makefile
$(CC) $(CFLAGS) -fPIC -shared $(LINKER_FLAGS) -o $(LIB_VERSION) $(SRC)
ln -s $(LIB_VERSION) $(LIB_MAJOR)
ln -s $(LIB_MAJOR) $(LIB_BASE)
ln -sf $(LIB_MAJOR) $(LIB_BASE)
mkdir -p $(addprefix build/, include lib src)
install -m 644 $(SRC) build/src
install -m 644 $(INCLUDE) build/include
mv $(LIB_VERSION) $(LIB_MAJOR) $(LIB_BASE) build/lib
mv $(LIB_VERSION) $(LIB_BASE) build/lib

.PHONY: install
install: all
Expand Down

1 comment on commit 9b9aa98

@tomty89
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kzidane

[root@localhost ~]# ls -Al /usr/local/lib/
total 0
[root@localhost ~]# cd libcs50/
[root@localhost libcs50]# make install
cc -Wall -Wextra -Werror -pedantic -std=c99 -fPIC -shared -Wl,-soname,libcs50.so.8 -o libcs50.so.8.1.2 src/cs50.c
ln -sf libcs50.so.8 libcs50.so
mkdir -p build/include build/lib build/src
install -m 644 src/cs50.c build/src
install -m 644 src/cs50.h build/include
mv libcs50.so.8.1.2 libcs50.so build/lib
cc -Wall -Wextra -Werror -pedantic -std=c99 -fPIC -shared -Wl,-soname,libcs50.so.8 -o libcs50.so.8.1.2 src/cs50.c
ln -sf libcs50.so.8 libcs50.so
mkdir -p build/include build/lib build/src
install -m 644 src/cs50.c build/src
install -m 644 src/cs50.h build/include
mv libcs50.so.8.1.2 libcs50.so build/lib
mkdir -p /usr/local/src /usr/local/lib /usr/local/include /usr/local/share/man/man3
cp -r build/src build/include build/lib /usr/local
cp -r docs/get_double.3 docs/get_long.3 docs/get_string.3 docs/get_long_long.3 docs/get_int.3 docs/eprintf.3 docs/get_char.3 docs/get_float.3 /usr/local/share/man/man3
ldconfig
[root@localhost libcs50]# ls -Al /usr/local/lib/
total 20
lrwxrwxrwx 1 root root    12 Nov 20 13:28 libcs50.so -> libcs50.so.8
-rwxr-xr-x 1 root root 18400 Nov 20 13:28 libcs50.so.8.1.2
[root@localhost libcs50]#

Please sign in to comment.