72ed7f986174348bb9a27ffd0090af7f164184d4
[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 \
6                 snprintf.c isaac.c smbdes.c
7
8 INCLUDES        = ../include/radius.h ../include/libradius.h \
9                   ../include/missing.h ../include/autoconf.h
10
11 CFLAGS          += -D_LIBRADIUS -I../include
12
13 all:    static dynamic
14
15 TARGET=$(LIBPREFIX)radius
16
17 STATIC_OBJS     = $(SRCS:.c=.o)
18 DYNAMIC_OBJS    = $(SRCS:.c=.lo)
19
20 $(STATIC_OBJS):  $(INCLUDES)
21 $(DYNAMIC_OBJS): $(INCLUDES)
22
23 #######################################################################
24 #
25 # define new rules
26 #
27 #######################################################################
28 %.o : %.c
29         $(CC) $(CFLAGS) -c $< -o $@
30
31 %.lo : %.c
32         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
33
34
35 $(TARGET).a: $(STATIC_OBJS)
36         $(LIBTOOL) --mode=link $(LD) \
37         -module -static $(CFLAGS) $^ -o $@ 
38
39
40 ifneq ($(USE_SHARED_LIBS),yes)
41 LINK_MODE=-static
42 endif
43
44 $(TARGET).la: $(DYNAMIC_OBJS)
45         $(LIBTOOL) --mode=link $(CC) -release $(RADIUSD_VERSION) \
46         -module $(LINK_MODE) $(CFLAGS) -o $@ -rpath $(libdir) $^ 
47
48 static: $(TARGET).a
49
50 dynamic: $(TARGET).la
51
52 clean:
53         rm -f *.o *.lo $(TARGET).a $(TARGET).la
54         rm -rf .libs
55
56 install: static dynamic
57         $(LIBTOOL) --mode=install $(INSTALL) -c \
58                 $(TARGET).la $(R)$(libdir)/$(TARGET).la;
59         rm -f $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la;
60         ln -s $(TARGET).la $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la