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