libresman
view Makefile @ 10:4d18498a0078
moved the resource manager a bit further
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 05 Feb 2014 02:01:49 +0200 |
parents | 61d7ff6da54b |
children |
line source
1 # change this if you want to install elsewhere
2 PREFIX = /usr/local
4 src = $(wildcard src/*.c)
5 obj = $(src:.c=.o)
6 dep = $(obj:.o=.d)
8 name = resman
9 lib_a = lib$(name).a
11 api_major = 0
12 api_minor = 1
14 dbg = -g
16 CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic)
18 ifeq ($(shell uname -s), Darwin)
19 lib_so = lib$(name).dylib
20 shared = -dynamiclib
21 else
22 devlink = lib$(name).so
23 soname = lib$(name).so.$(api_major)
24 lib_so = lib$(name).so.$(api_major).$(api_minor)
25 shared = -shared -Wl,-soname,$(soname)
26 pic = -fPIC
27 endif
29 .PHONY: all
30 all: $(lib_so) $(lib_a)
32 $(lib_so): $(obj)
33 $(CC) -o $@ $(shared) $(obj) $(LDFLAGS)
35 $(lib_a): $(obj)
36 $(AR) rcs $@ $(obj)
38 -include $(dep)
40 %.d: %.c
41 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
43 .PHONY: clean
44 clean:
45 rm -f $(obj) $(lib_so) $(lib_a)
47 .PHONY: install
48 install: $(lib_a) $(lib_so)
49 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include
50 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
51 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
52 [ -n "$(devlink)" ] \
53 && cd $(DESTDIR)$(PREFIX)/lib \
54 && rm -f $(soname) $(devlink) \
55 && ln -s $(lib_so) $(soname) \
56 && ln -s $(soname) $(devlink) \
57 || true
58 cp src/resman.h $(DESTDIR)$(PREFIX)/include/resman.h
60 .PHONY: uninstall
61 uninstall:
62 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
63 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
64 rm -f $(DESTDIR)$(PREFIX)/include/resman.h