1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-10-02 18:34:10 +03:00

libubb/Makefile: build also a shared version of libubb; better cleanup

The improved cleanup removes the library after a partially successful build.
This commit is contained in:
Werner Almesberger 2013-01-07 08:21:00 -03:00
parent ed192391ea
commit 64c14fb709

View File

@ -1,8 +1,8 @@
# #
# libubb/Makefile - Build the UBB library # libubb/Makefile - Build the UBB library
# #
# Written 2012 by Werner Almesberger # Written 2012-2013 by Werner Almesberger
# Copyright 2012 Werner Almesberger # Copyright 2012-2013 Werner Almesberger
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -13,22 +13,32 @@
TARGET = mipsel-openwrt-linux- TARGET = mipsel-openwrt-linux-
CC = $(TARGET)gcc CC = $(TARGET)gcc
LD = $(TARGET)ld
CFLAGS = -g -Wall -Iinclude CFLAGS = -g -Wall -fPIC -Iinclude
LIB = libubb.a LIB = libubb.a
SHLIB = libubb.so
LIBVERSION = 0.0.0
OBJS = ubb.o swuart.o OBJS = ubb.o swuart.o
HDRS = ubb/ubb.h ubb/regbase.h ubb/regs4740.h ubb/swuart.h HDRS = ubb/ubb.h ubb/regbase.h ubb/regs4740.h ubb/swuart.h
.PHONY: all clean spotless .PHONY: all clean spotless
all: $(LIB) all: $(SHLIB).$(LIBVERSION)
$(SHLIB).$(LIBVERSION): $(SHLIB)
/sbin/ldconfig -n .
$(SHLIB): $(LIB)
$(LD) -shared -soname $@.$(LIBVERSION) -o $@ \
--whole-archive $^ || { rm -f $@; exit 1; }
$(LIB): $(OBJS) $(LIB): $(OBJS)
$(AR) cr $@ $^ $(AR) cr $@ $^ || { rm -f $@; exit 1; }
clean: clean:
rm -f $(OBJS) rm -f $(OBJS)
spotless: clean spotless: clean
rm -f $(LIB) rm -f $(LIB) $(SHLIB) $(SHLIB).$(LIBVERSION)