Commit 9f0bed69 authored by Alejandro Mery's avatar Alejandro Mery
Browse files

lib: extend to create .so versions of the libraries


Signed-off-by: default avatarAlejandro Mery <amery@geeks.cl>
parent 834dd388
...@@ -8,23 +8,33 @@ O ?= $(srctree)/out ...@@ -8,23 +8,33 @@ O ?= $(srctree)/out
OBJDIR := $(O)/lib OBJDIR := $(O)/lib
DEPS := $(OBJDIR)/deps.mk DEPS := $(OBJDIR)/deps.mk
SRCS :=
INCLUDES = -I$(srctree)/include INCLUDES = -I$(srctree)/include
CFLAGS = -O2 CFLAGS = -O2
CFLAGS += -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200112L CFLAGS += -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200112L
CFLAGS += -fPIC
CFLAGS += $(INCLUDES) CFLAGS += $(INCLUDES)
SRCS :=
all: libs all: libs
include libfex/Makefile include libfex/Makefile
# *.a # libraries
%.a: libs: $(LIBS) $(SOLIBS)
$(LIBS):
@mkdir -vp $(@D) @mkdir -vp $(@D)
$(AR) rcs $@ $^ $(AR) rcs $@ $^
$(SOLIBS):
@mkdir -vp $(@D)
$(CC) -shared -Wl,-soname,$(@F) -o $@ $^
x=$@; while [ "$$x" = "$${x%.so}" ]; do \
x=$${x%.*}; \
ln -snvf $(@F) $$x; \
done
# *.o # *.o
%.o: SRC=$(patsubst $(OBJDIR)/%.o,%.c,$@) %.o: SRC=$(patsubst $(OBJDIR)/%.o,%.c,$@)
%.o: %.o:
......
libfex_SOURCES := $(wildcard libfex/*.c) libfex_SOURCES := $(wildcard libfex/*.c)
libfex_OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(libfex_SOURCES)) libfex_OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(libfex_SOURCES))
libfex_LIB := $(O)/libfex.a libfex_LIB := $(O)/libfex.a
libfex_SO := $(O)/libfex.so.1.0
SRCS += $(libfex_SOURCES) SRCS += $(libfex_SOURCES)
OBJS += $(libfex_OBJS) OBJS += $(libfex_OBJS)
libs: $(libfex_LIB) LIBS += $(libfex_LIB)
$(libfex_LIB): $(libfex_OBJS) $(libfex_LIB): $(libfex_OBJS)
SOLIBS += $(libfex_SO)
$(libfex_SO): $(libfex_OBJS)
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