Commit 208be821 authored by Federico Vaga's avatar Federico Vaga

sw:lib: install libraries

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent c847680c
...@@ -8,11 +8,16 @@ REPO_PARENT ?= ../.. ...@@ -8,11 +8,16 @@ REPO_PARENT ?= ../..
-include $(REPO_PARENT)/parent_common.mk -include $(REPO_PARENT)/parent_common.mk
GIT_VERSION := $(shell git describe --dirty --long --tags) GIT_VERSION := $(shell git describe --dirty --long --tags)
SO_VERSION := $(shell git describe --abbrev=0 | grep -o -E "[0-9]+\.[0-9]+\.[0-9]")
PREFIX ?= /usr/local
DESTLIBDIR ?= $(PREFIX)/lib
TRTL ?= ../.. TRTL ?= ../..
TRTL_SW = $(TRTL)/software TRTL_SW = $(TRTL)/software
LIBS = libmockturtle.so LIBS = libmockturtle.so
LIBSV = $(LIBS).$(SO_VERSION)
LIB = libmockturtle.a LIB = libmockturtle.a
LOBJ := libmockturtle.o LOBJ := libmockturtle.o
LOBJ += libmockturtle-rt-msg.o LOBJ += libmockturtle-rt-msg.o
...@@ -32,15 +37,27 @@ modules all: $(LIB) $(LIBS) ...@@ -32,15 +37,27 @@ modules all: $(LIB) $(LIBS)
$(LIB): $(LOBJ) $(LIB): $(LOBJ)
$(AR) $(ARFLAGS) $@ $^ $(AR) $(ARFLAGS) $@ $^
$(LIBS): $(LIB) $(LIBSV): $(LIB)
$(CC) -shared -o $@ -Wl,--whole-archive,-soname,$@ $^ -Wl,--no-whole-archive $(CC) -shared -o $@ -Wl,--whole-archive,-soname,$@ $^ -Wl,--no-whole-archive
$(LIBS): $(LIBSV)
ln -s $@ $(shell echo $@ | grep -o -E ".*\.so")
clean: clean:
rm -f $(LIB) $(LIBS) .depend *.o *~ rm -f $(LIB) $(LIBS) $(LIBSV) .depend *.o *~
.depend: Makefile $(wildcard *.c *.h) .depend: Makefile $(wildcard *.c *.h)
$(CC) $(CFLAGS) -M $(LOBJ:.o=.c) -o $@ $(CC) $(CFLAGS) -M $(LOBJ:.o=.c) -o $@
install modules_install: install:
install -d $(DESTLIBDIR)
install -D $(LIB) $(DESTLIBDIR)
install -D $(LIBSV) $(DESTLIBDIR)
ln -sf $(LIBSV) $(DESTLIBDIR)/$(LIBS)
uninstall:
rm -f $(DESTLIBDIR)/$(LIB) $(DESTLIBDIR)/$(LIBS) $(DESTLIBDIR)/$(LIBSV)
rmdir --ignore-fail-on-non-empty $(DESTLIBDIR)
modules_install:
-include .depend -include .depend
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment