This commit was generated by cvs2svn to compensate for changes in r786,
[libnl.git] / lib / Makefile
1 #
2 # lib/Makefile
3 #
4 #       This library is free software; you can redistribute it and/or
5 #       modify it under the terms of the GNU Lesser General Public
6 #       License as published by the Free Software Foundation version 2.1
7 #       of the License.
8 #
9 # Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
10 #
11
12 ifeq ($(shell [ ! -r ../Makefile.opts ] && echo 1),)
13     include ../Makefile.opts
14 endif
15
16 # Core
17 CIN      := $(wildcard *.c)
18 # NETLINK_ROUTE
19 CIN      += $(wildcard route/*.c)
20 # Schedulers
21 CIN      += $(wildcard route/sch/*.c)
22 # Classifiers
23 CIN      += $(wildcard route/cls/*.c)
24 # fib lookup
25 CIN      += $(wildcard fib_lookup/*.c)
26
27 DEPS     := $(CIN:%.c=.deps/%.d)
28 OBJ      := $(CIN:%.c=%.o)
29 CFLAGS   += -fPIC
30 OUT_SLIB := $(PACKAGE_NAME).so.$(PACKAGE_VERSION)
31 OUT_AR   := $(PACKAGE_NAME).a
32 LN_SLIB  := $(PACKAGE_NAME).so
33 LN1_SLIB := $(LN_SLIB).1
34
35 export
36
37 .PHONY: all clean install librtn.a $(OUT_SLIB)
38
39
40 all:
41         @echo "  MAKE $(OUT_SLIB)"; \
42         $(MAKE) $(OUT_SLIB); \
43         $(MAKE) $(OUT_AR)
44
45 $(OUT_SLIB): ../Makefile.opts $(OBJ)
46         @echo "  LD $(OUT_SLIB)"; \
47         $(CC) -shared -Wl,-soname,libnl.so.1 -o $(OUT_SLIB) $(OBJ) $(LIBNL_LIB) -lc
48         @echo "  LN $(OUT_SLIB) $(LN1_SLIB)"; \
49         rm -f $(LN1_SLIB) ; $(LN) -s $(OUT_SLIB) $(LN1_SLIB)
50         @echo "  LN $(LN1_SLIB) $(LN_SLIB)"; \
51         rm -f $(LN_SLIB) ; $(LN) -s $(LN1_SLIB) $(LN_SLIB)
52
53 $(OUT_AR):  ../Makefile.opts $(OBJ)
54         @echo "  AR $(OUT_AR)"; \
55         $(AR) crus $(OUT_AR) $(OBJ)
56
57 clean:
58         @echo "  CLEAN lib"; \
59         $(RM) -f $(OBJ) $(OUT_SLIB) $(LN_SLIB) $(LN1_SLIB); \
60         $(RM) -f $(OUT_SLIB) $(LN_SLIB) $(LN1_SLIB)
61
62 distclean:
63         find .deps -iname \*\.d -exec rm -f '{}' \;
64
65 install:
66         mkdir -p $(DESTDIR)$(libdir)/
67         install -m 0755 $(OUT_SLIB) $(DESTDIR)$(libdir)
68         install -m 0644 $(OUT_AR) $(DESTDIR)$(libdir)
69         rm -f $(DESTDIR)$(libdir)/$(LN1_SLIB)
70         $(LN) -s $(OUT_SLIB) $(DESTDIR)$(libdir)/$(LN1_SLIB)
71         rm -f $(DESTDIR)$(libdir)/$(LN_SLIB)
72         $(LN) -s $(LN1_SLIB) $(DESTDIR)$(libdir)/$(LN_SLIB)
73
74 $(DEPS): ../Makefile.opts
75
76 include ../Makefile.rules