f01c6893b54bec7bed3a03f1d5767242b83b0337
[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 \
6                 hmac.c hmacsha1.c snprintf.c isaac.c crypt.c \
7                 udpfromto.c rbtree.c
8
9 INCLUDES        = ../include/radius.h ../include/libradius.h \
10                   ../include/missing.h ../include/autoconf.h
11
12 CFLAGS          += -D_LIBRADIUS -I../include 
13
14 # if you have problems with things that need SHA1-HMAC, this will
15 # dump the key and the input to the hash so you can compare to what
16 # the other end is doing.
17 CFLAGS += -DHMAC_SHA1_DATA_PROBLEMS
18
19 all:    static dynamic
20
21 TARGET=$(LIBPREFIX)radius
22
23 STATIC_OBJS     = $(SRCS:.c=.o)
24 DYNAMIC_OBJS    = $(SRCS:.c=.lo)
25
26 $(STATIC_OBJS):  $(INCLUDES)
27 $(DYNAMIC_OBJS): $(INCLUDES)
28
29 #######################################################################
30 #
31 # define new rules
32 #
33 #######################################################################
34 %.o : %.c
35         $(CC) $(CFLAGS) -c $< -o $@
36
37 %.lo : %.c
38         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
39
40
41 $(TARGET).a: $(STATIC_OBJS)
42         $(LIBTOOL) --mode=link $(LD) \
43         -module -static $(CFLAGS) $^ -o $@ 
44
45
46 ifneq ($(USE_SHARED_LIBS),yes)
47 LINK_MODE=-static
48 endif
49
50 $(TARGET).la: $(DYNAMIC_OBJS)
51         $(LIBTOOL) --mode=link $(CC) -release $(RADIUSD_VERSION) \
52         -module $(LINK_MODE) $(CFLAGS) -o $@ -rpath $(libdir) $^ 
53
54 static: $(TARGET).a
55
56 dynamic: $(TARGET).la
57
58 clean:
59         rm -f *.o *.lo $(TARGET).a $(TARGET).la
60         rm -rf .libs
61
62 install: static dynamic
63         $(LIBTOOL) --mode=install $(INSTALL) -c \
64                 $(TARGET).la $(R)$(libdir)/$(TARGET).la;
65         rm -f $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la;
66         ln -s $(TARGET).la $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la