Added 'install' target, so libradius.so gets installed, too
[freeradius.git] / src / lib / Makefile
1
2 include ../../Make.inc
3
4 SRCS            = dict.c print.c radius.c valuepair.c token.c misc.c \
5                 log.c filters.c missing.c md4.c md5.c sha1.c hmac.c snprintf.c
6
7 INCLUDES        = ../include/radius.h ../include/libradius.h \
8                   ../include/missing.h ../include/autoconf.h
9
10 CFLAGS          += -D_LIBRADIUS -I../include
11
12 all:    static dynamic
13
14 TARGET=$(LIBPREFIX)radius
15
16 STATIC_OBJS     = $(SRCS:.c=.o)
17 DYNAMIC_OBJS    = $(SRCS:.c=.lo)
18
19 $(STATIC_OBJS):  $(INCLUDES)
20 $(DYNAMIC_OBJS): $(INCLUDES)
21
22 #######################################################################
23 #
24 # define new rules
25 #
26 #######################################################################
27 %.o : %.c
28         $(CC) $(CFLAGS) -c $< -o $@
29
30 %.lo : %.c
31         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
32
33
34 $(TARGET).a: $(STATIC_OBJS)
35         $(LIBTOOL) --mode=link $(LD) \
36         -module -static $(CFLAGS) $^ -o $@ 
37
38
39 ifneq ($(USE_SHARED_LIBS),yes)
40 LINK_MODE=-static
41 endif
42
43 $(TARGET).la: $(DYNAMIC_OBJS)
44         $(LIBTOOL) --mode=link $(CC) -release $(RADIUSD_VERSION) \
45         -module $(LINK_MODE) $(CFLAGS) -o $@ -rpath $(libdir) $^ 
46
47 static: $(TARGET).a
48
49 dynamic: $(TARGET).la
50
51 clean:
52         rm -f *.o $(TARGET).a $(TARGET).la
53
54 install: static dynamic
55         $(LIBTOOL) --mode=install $(INSTALL) -c \
56                 $(TARGET).la $(R)$(libdir)/$(TARGET).la;
57         rm -f $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la;
58         ln -s $(TARGET).la $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la