Port patch from branch_1_1 to the HEAD
[freeradius.git] / src / lib / Makefile
1 #
2 # Makefile
3 #
4 # Version:      $Id$
5 #
6
7 include ../../Make.inc
8
9 SRCS            = dict.c filters.c hash.c hmac.c hmacsha1.c isaac.c log.c \
10                   misc.c missing.c md4.c md5.c print.c radius.c rbtree.c \
11                   sha1.c snprintf.c strlcat.c strlcpy.c token.c udpfromto.c \
12                   valuepair.c fifo.c
13
14 INCLUDES        = ../include/radius.h ../include/libradius.h \
15                   ../include/missing.h ../include/autoconf.h
16
17 CFLAGS          += -D_LIBRADIUS -I$(top_builddir)/src
18
19 # if you have problems with things that need SHA1-HMAC, this will
20 # dump the key and the input to the hash so you can compare to what
21 # the other end is doing.
22 CFLAGS += -DHMAC_SHA1_DATA_PROBLEMS
23
24 TARGET=$(LIBPREFIX)radius
25
26 all:    $(TARGET).la
27
28 STATIC_OBJS     = $(SRCS:.c=.o)
29 DYNAMIC_OBJS    = $(SRCS:.c=.lo)
30
31 $(STATIC_OBJS):  $(INCLUDES)
32 $(DYNAMIC_OBJS): $(INCLUDES)
33
34 #######################################################################
35 #
36 # define new rules
37 #
38 #######################################################################
39 %.o : %.c
40         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $< -o $@
41
42 %.lo : %.c
43         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
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         $(LINK_MODE) $(CFLAGS) -o $@ -rpath $(libdir) $^ $(LCRYPT)
53
54 static:
55
56 dynamic: $(TARGET).la
57
58 clean:
59         rm -f *.o *.lo $(TARGET).a $(TARGET).la
60         rm -rf .libs
61
62 install: all
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