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