Pulled from branch_1_1, with formatting
[freeradius.git] / src / main / Makefile.in
1 #
2 # $Id$
3 #
4
5 include ../../Make.inc
6
7 SERVER_SRCS     = acct.c auth.c client.c conffile.c crypt.c exec.c files.c \
8                   listen.c log.c mainconfig.c modules.c modcall.c proxy.c  \
9                   radiusd.c radius_snmp.c request_list.c request_process.c \
10                   session.c smux.c threads.c util.c valuepair.c version.c  \
11                   xlat.c
12
13 SERVER_OBJS     += $(SERVER_SRCS:.c=.lo)
14
15 INCLUDES        = ../include/autoconf.h ../include/conf.h    \
16                   ../include/libradius.h ../include/radius.h \
17                   ../include/radiusd.h ../include/ident.h
18
19 CFLAGS          += -I$(top_builddir)/src
20 CFLAGS          += -DHOSTINFO=\"${HOSTINFO}\"
21 CFLAGS          += -DRADIUSD_VERSION=\"${RADIUSD_VERSION}\"
22 CFLAGS          += $(SNMP_INCLUDE)
23 CFLAGS          += $(OPENSSL_INCLUDE)
24 VFLAGS          = -DRADIUSD_MAJOR_VERSION=$(RADIUSD_MAJOR_VERSION)
25 VFLAGS          += -DRADIUSD_MINOR_VERSION=$(RADIUSD_MINOR_VERSION)
26 MODULE_LIBS     = $(STATIC_MODULES)
27 BINARIES        = radiusd radwho radclient
28
29 #
30 #  The RADIUS sniffer
31 #
32 PCAP_LIBS       = @PCAP_LIBS@
33 ifneq ($(PCAP_LIBS),)
34 BINARIES        += radsniff
35 endif
36
37 #
38 #  Not using shared libraries, add in ALL known static modules
39 #  at build time.
40 #
41 ifneq ($(USE_SHARED_LIBS),yes)
42 #
43 #  For static linking...
44 #
45 LINK_MODE       = -static -all-static
46
47 SUB_MODULES += rlm_eap_md5 rlm_eap_leap rlm_eap_tls rlm_eap_ttls rlm_eap_sim
48 SUB_MODULES += rlm_eap_peap rlm_eap_mschapv2 rlm_eap_gtc
49 SUB_MODULES += rlm_sql_db2 rlm_sql_freetds rlm_sql_iodbc rlm_sql_mysql
50 SUB_MODULES += rlm_sql_oracle rlm_sql_postgresql rlm_sql_sybase rlm_sql_unixodbc
51 LIBS        += $(shell test -f ../modules/rlm_eap/libeap/libeap.la && echo ../modules/rlm_eap/libeap/libeap.la)
52
53 MODULE_LIBS     += $(shell for x in $(MODULES);do test -f ../modules/$$x/$$x.la && echo -dlpreopen ../modules/$$x/$$x.la;done)
54 MODULE_LIBS     += $(shell for x in $(SUB_MODULES);do test -f ../modules/*/types/$$x/$$x.la && echo -dlpreopen ../modules/*/types/$$x/$$x.la;done)
55 MODULE_LIBS     += $(shell for x in $(SUB_MODULES);do test -f ../modules/*/drivers/$$x/$$x.la && echo -dlpreopen ../modules/*/drivers/$$x/$$x.la;done)
56 MODULE_OBJS     += $(shell for x in $(MODULES);do test -f ../modules/$$x/$$x.la && echo ../modules/$$x/$$x.la;done)
57 MODULE_OBJS     += $(shell for x in $(SUB_MODULES);do test -f ../modules/*/types/$$x/$$x.la && echo ../modules/*/types/$$x/$$x.la;done)
58 MODULE_OBJS     += $(shell for x in $(SUB_MODULES);do test -f ../modules/*/drivers/$$x/$$x.la && echo ../modules/*/drivers/$$x/$$x.la;done)
59 endif
60
61 LIBS            += ../lib/libradius.la
62
63
64 all: $(BINARIES)
65
66 $(SERVER_OBJS): $(INCLUDES)
67
68 radiusd: $(SERVER_OBJS) $(MODULE_OBJS) ../lib/libradius.la
69         $(LIBTOOL) --mode=link $(CC) -export-dynamic -dlopen self \
70                 $(LDFLAGS) -pie $(LINK_MODE) -o $@ $(SERVER_OBJS)      \
71                 $(MODULE_LIBS) $(LIBS) $(SNMP_LIBS) $(LCRYPT)     \
72                 $(PTHREADLIB) $(LIBLTDL) $(OPENSSL_LIBS)
73
74 radiusd.lo: radiusd.c ../include/request_list.h ../include/modules.h ../include/modcall.h ../include/modpriv.h
75         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c radiusd.c
76
77 acct.lo: acct.c ../include/modules.h
78         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c acct.c
79
80 auth.lo: auth.c ../include/modules.h
81         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c auth.c
82
83 client.lo: client.c ../include/conffile.h
84         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c client.c
85
86 conffile.lo: conffile.c ../include/conffile.h ../include/modules.h
87         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c conffile.c
88
89 crypt.lo: crypt.c
90         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c crypt.c
91
92 exec.lo: exec.c
93         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c exec.c
94
95 files.lo: files.c
96         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c files.c
97
98 listen.lo: listen.c
99         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c listen.c
100
101 log.lo: log.c
102         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c log.c
103
104 mainconfig.lo: mainconfig.c ../include/modules.h
105         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c mainconfig.c
106
107 modcall.lo: modcall.c
108         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(INCLTDL) -c modcall.c
109
110 modules.lo: modules.c
111         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(VFLAGS) $(INCLTDL) -c modules.c
112
113 proxy.lo: proxy.c
114         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c proxy.c
115
116 radius_snmp.lo: radius_snmp.c
117         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c radius_snmp.c
118
119 request_list.lo: request_list.c
120         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c request_list.c
121
122 request_process.lo: request_process.c
123         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c request_process.c
124
125 session.lo: session.c ../include/modules.h
126         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c session.c
127
128 smux.lo: smux.c
129         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c smux.c
130
131 threads.lo: threads.c
132         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c threads.c
133
134 util.lo: util.c
135         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c util.c
136
137 valuepair.lo: valuepair.c
138         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c valuepair.c
139
140 version.lo: version.c
141         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c version.c
142
143 xlat.lo: xlat.c
144         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c xlat.c
145
146 #
147 # Helper programs
148 #
149
150 radclient.lo: radclient.c $(INCLUDES)
151         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c radclient.c
152
153 radclient: radclient.lo ../lib/libradius.la
154         $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(LINK_MODE) -o radclient radclient.lo $(LIBS)
155
156 radsniff.lo: radsniff.c $(INCLUDES) ../include/radsniff.h
157         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c radsniff.c
158
159 radsniff: radsniff.lo ../lib/libradius.la
160         $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(LINK_MODE) -o radsniff radsniff.lo $(LIBS) $(PCAP_LIBS)
161
162 radwho.lo: radwho.c $(INCLUDES)
163         $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c radwho.c
164
165 radwho: radwho.lo util.lo log.lo conffile.lo ../lib/libradius.la
166         $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(LINK_MODE) -o radwho radwho.lo util.lo log.lo conffile.lo $(LIBS)
167
168
169 clean:
170         rm -rf *.o *.so *.lo *~ $(BINARIES) .libs
171
172 install:
173         $(LIBTOOL) --mode=install $(INSTALL) -m 755 $(INSTALLSTRIP) radiusd$(EXEEXT)    $(R)$(sbindir)
174         $(LIBTOOL) --mode=install $(INSTALL) -m 755 $(INSTALLSTRIP) radclient$(EXEEXT)  $(R)$(bindir)
175         $(LIBTOOL) --mode=install $(INSTALL) -m 755 $(INSTALLSTRIP) radwho$(EXEEXT)     $(R)$(bindir)
176 ifneq ($(PCAP_LIBS),)
177         $(LIBTOOL) --mode=install $(INSTALL) -m 755 $(INSTALLSTRIP) radsniff$(EXEEXT)   $(R)$(bindir)
178 endif
179         $(INSTALL) -m 755    checkrad.pl                $(R)$(sbindir)/checkrad
180         $(INSTALL) -m 755    radlast                    $(R)$(bindir)
181         $(INSTALL) -m 755    radtest                    $(R)$(bindir)
182         $(INSTALL) -m 755    radzap                     $(R)$(bindir)