Skip to content

Commit

Permalink
Default target changed to SONAME; The 'install' target will now symli…
Browse files Browse the repository at this point in the history
…nk from SONAME to NAME
  • Loading branch information
zear committed Oct 4, 2015
1 parent 6b6850a commit 4e03894
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ endif

CC ?= gcc
STRIP ?= strip
TARGET ?= libshake.so
NAME := libshake.so
SOVERSION := 0
SONAME := $(NAME).$(SOVERSION)
TARGET ?= $(SONAME)
SYSROOT := $(shell $(CC) --print-sysroot)
CFLAGS := -fPIC
SRCDIR := src
OBJDIR := obj
SRC := $(wildcard $(SRCDIR)/*.c)
OBJ := $(SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
SOVERSION := $(TARGET).0

ifdef DEBUG
CFLAGS += -ggdb -Wall -Werror
Expand All @@ -25,7 +27,7 @@ endif
all: $(TARGET)

$(TARGET): $(OBJ)
$(CC) -Wl,-soname,$(SOVERSION) -shared $(CFLAGS) $^ -o $@
$(CC) -Wl,-soname,$(SONAME) -shared $(CFLAGS) $^ -o $@
ifdef DO_STRIP
$(STRIP) $@
endif
Expand All @@ -42,3 +44,5 @@ clean:
install: $(TARGET)
cp include/*.h $(SYSROOT)/usr/include/
cp $(TARGET) $(SYSROOT)/usr/lib/
ln -sf $(SYSROOT)/usr/lib/$(TARGET) $(SYSROOT)/usr/lib/$(NAME)

0 comments on commit 4e03894

Please sign in to comment.