Date: | 2013-01-07 12:21:00 (11 years 2 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 64c14fb709eeb0243a20dcf18f95a7e0cbdd9ac2 |
Message: | libubb/Makefile: build also a shared version of libubb; better
cleanup The improved cleanup removes the library after a partially successful build. |
Files: |
libubb/Makefile (2 diffs) |
Change Details
libubb/Makefile | ||
---|---|---|
1 | 1 | # |
2 | 2 | # libubb/Makefile - Build the UBB library |
3 | 3 | # |
4 | # Written 2012 by Werner Almesberger | |
5 | # Copyright 2012 Werner Almesberger | |
4 | # Written 2012-2013 by Werner Almesberger | |
5 | # Copyright 2012-2013 Werner Almesberger | |
6 | 6 | # |
7 | 7 | # This program is free software; you can redistribute it and/or modify |
8 | 8 | # it under the terms of the GNU General Public License as published by |
... | ... | |
13 | 13 | |
14 | 14 | TARGET = mipsel-openwrt-linux- |
15 | 15 | CC = $(TARGET)gcc |
16 | LD = $(TARGET)ld | |
16 | 17 | |
17 | CFLAGS = -g -Wall -Iinclude | |
18 | CFLAGS = -g -Wall -fPIC -Iinclude | |
18 | 19 | LIB = libubb.a |
20 | SHLIB = libubb.so | |
21 | LIBVERSION = 0.0.0 | |
19 | 22 | |
20 | 23 | OBJS = ubb.o swuart.o |
21 | 24 | HDRS = ubb/ubb.h ubb/regbase.h ubb/regs4740.h ubb/swuart.h |
22 | 25 | |
23 | 26 | .PHONY: all clean spotless |
24 | 27 | |
25 | all: $(LIB) | |
28 | all: $(SHLIB).$(LIBVERSION) | |
29 | ||
30 | $(SHLIB).$(LIBVERSION): $(SHLIB) | |
31 | /sbin/ldconfig -n . | |
32 | ||
33 | $(SHLIB): $(LIB) | |
34 | $(LD) -shared -soname $@.$(LIBVERSION) -o $@ \ | |
35 | --whole-archive $^ || { rm -f $@; exit 1; } | |
26 | 36 | |
27 | 37 | $(LIB): $(OBJS) |
28 | $(AR) cr $@ $^ | |
38 | $(AR) cr $@ $^ || { rm -f $@; exit 1; } | |
29 | 39 | |
30 | 40 | clean: |
31 | 41 | rm -f $(OBJS) |
32 | 42 | |
33 | 43 | spotless: clean |
34 | rm -f $(LIB) | |
44 | rm -f $(LIB) $(SHLIB) $(SHLIB).$(LIBVERSION) |
Branches:
master