]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/hostapd/Makefile
Submitted following patch to FSF GCC:
[FreeBSD/FreeBSD.git] / contrib / hostapd / Makefile
1 CC=gcc
2 DIR_WPA_SUPPLICANT=.
3 DIR_HOSTAP=.
4
5 ifndef CFLAGS
6 CFLAGS = -MMD -O2 -Wall -g
7 endif
8
9 # define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to
10 # a file (undefine it, if you want to save in binary size)
11 CFLAGS += -DHOSTAPD_DUMP_STATE
12
13 # Include directories for CVS version
14 CFLAGS += -I. -I$(DIR_HOSTAP) -I../utils -I$(DIR_WPA_SUPPLICANT)
15
16 # Uncomment following line and set the path to your kernel tree include
17 # directory if your C library does not include all header files.
18 # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
19
20 OBJS =  hostapd.o eloop.o ieee802_1x.o eapol_sm.o radius.o md5.o rc4.o \
21         common.o ieee802_11.o config.o ieee802_11_auth.o accounting.o \
22         sta_info.o radius_client.o sha1.o wpa.o aes_wrap.o ctrl_iface.o \
23         driver_conf.o
24
25 -include .config
26
27 ifdef CONFIG_IAPP
28 CFLAGS += -DCONFIG_IAPP
29 OBJS += iapp.o
30 endif
31
32 ifdef CONFIG_RSN_PREAUTH
33 CFLAGS += -DCONFIG_RSN_PREAUTH
34 CONFIG_L2_PACKET=y
35 endif
36
37 ifdef CONFIG_DRIVER_HOSTAP
38 CFLAGS += -DCONFIG_DRIVER_HOSTAP
39 OBJS += driver.o
40 endif
41
42 ifdef CONFIG_DRIVER_WIRED
43 CFLAGS += -DCONFIG_DRIVER_WIRED
44 OBJS += driver_wired.o
45 endif
46
47 ifdef CONFIG_DRIVER_MADWIFI
48 CFLAGS += -DCONFIG_DRIVER_MADWIFI
49 OBJS += driver_madwifi.o
50 CONFIG_L2_PACKET=y
51 endif
52
53 ifdef CONFIG_DRIVER_PRISM54
54 CFLAGS += -DCONFIG_DRIVER_PRISM54
55 OBJS += driver_prism54.o
56 endif
57
58 ifdef CONFIG_DRIVER_BSD
59 CFLAGS += -DCONFIG_DRIVER_BSD
60 OBJS += driver_bsd.o
61 CONFIG_L2_PACKET=y
62 CONFIG_DNET_PCAP=y
63 endif
64
65 ifdef CONFIG_DRIVER_TEST
66 CFLAGS += -DCONFIG_DRIVER_TEST
67 OBJS += driver_test.o
68 endif
69
70 ifdef CONFIG_L2_PACKET
71 OBJS += $(DIR_WPA_SUPPLICANT)/l2_packet.o
72 endif
73
74 ifdef CONFIG_DNET_PCAP
75 CFLAGS += -DUSE_DNET_PCAP
76 LIBS +=-ldnet -lpcap
77 endif
78
79 ifdef CONFIG_EAP_MD5
80 CFLAGS += -DEAP_MD5
81 OBJS += eap_md5.o
82 endif
83
84 ifdef CONFIG_EAP_TLS
85 CFLAGS += -DEAP_TLS
86 OBJS += eap_tls.o
87 TLS_FUNCS=y
88 endif
89
90 ifdef CONFIG_EAP_PEAP
91 CFLAGS += -DEAP_PEAP
92 OBJS += eap_peap.o
93 TLS_FUNCS=y
94 CONFIG_EAP_TLV=y
95 CONFIG_EAP_MSCHAPV2=y
96 endif
97
98 ifdef CONFIG_EAP_TTLS
99 CFLAGS += -DEAP_TTLS
100 OBJS += eap_ttls.o
101 TLS_FUNCS=y
102 endif
103
104 ifdef CONFIG_EAP_MSCHAPV2
105 CFLAGS += -DEAP_MSCHAPv2
106 OBJS += eap_mschapv2.o
107 MS_FUNCS=y
108 endif
109
110 ifdef CONFIG_EAP_GTC
111 CFLAGS += -DEAP_GTC
112 OBJS += eap_gtc.o
113 endif
114
115 ifdef CONFIG_EAP_SIM
116 CFLAGS += -DEAP_SIM
117 OBJS += eap_sim.o $(DIR_WPA_SUPPLICANT)/eap_sim_common.o
118 # Example EAP-SIM interface for GSM authentication. This can be replaced with
119 # another file implementating the interface specified in eap_sim_db.h.
120 OBJS += eap_sim_db.o
121 endif
122
123 ifdef CONFIG_EAP_TLV
124 CFLAGS += -DEAP_TLV
125 OBJS += eap_tlv.o
126 endif
127
128 ifdef CONFIG_EAP
129 CFLAGS += -DEAP_AUTHENTICATOR
130 OBJS += eap.o eap_identity.o
131 endif
132
133 ifdef TLS_FUNCS
134 # Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
135 CFLAGS += -DEAP_TLS_FUNCS
136 OBJS += eap_tls_common.o $(DIR_WPA_SUPPLICANT)/tls_openssl.o
137 LIBS += -lssl -lcrypto
138 LIBS_p += -lcrypto
139 else
140 OBJS += $(DIR_WPA_SUPPLICANT)/tls_none.o
141 endif
142
143 ifdef CONFIG_PKCS12
144 CFLAGS += -DPKCS12_FUNCS
145 endif
146
147 ifdef MS_FUNCS
148 ifndef TLS_FUNCS
149 LIBS += -lcrypto
150 endif
151 OBJS += $(DIR_WPA_SUPPLICANT)/ms_funcs.o $(DIR_WPA_SUPPLICANT)/crypto.o
152 endif
153
154 ifdef CONFIG_RADIUS_SERVER
155 CFLAGS += -DRADIUS_SERVER
156 OBJS += radius_server.o
157 endif
158
159 ALL=hostapd hostapd_cli
160
161 all: verify_config $(ALL)
162
163 verify_config:
164         @if [ ! -r .config ]; then \
165                 echo 'Building hostapd requires a configuration file'; \
166                 echo '(.config). See README for more instructions. You can'; \
167                 echo 'run "cp defconfig .config" to create an example'; \
168                 echo 'configuration.'; \
169                 exit 1; \
170         fi
171
172 install: all
173         for i in $(ALL); do cp $$i /usr/local/bin/$$i; done
174
175 hostapd: $(OBJS)
176         $(CC) -o hostapd $(OBJS) $(LIBS)
177
178 driver_conf.c: Makefile .config
179         rm -f driver_conf.c
180         echo '/* THIS FILE AUTOMATICALLY GENERATED, DO NOT EDIT! */' \
181                                                         > driver_conf.c
182         echo '#include <stdlib.h>'                      >> driver_conf.c
183         echo '#include <stdio.h>'                       >> driver_conf.c
184         echo '#include <sys/types.h>'                   >> driver_conf.c
185         echo '#include <netinet/in.h>'                  >> driver_conf.c
186         echo '#include "hostapd.h"'                     >> driver_conf.c
187         echo '#include "driver.h"'                      >> driver_conf.c
188 ifdef CONFIG_DRIVER_HOSTAP
189         echo "void hostap_driver_register(void);"       >> driver_conf.c
190 endif
191 ifdef CONFIG_DRIVER_WIRED
192         echo "void wired_driver_register(void);"        >> driver_conf.c
193 endif
194 ifdef CONFIG_DRIVER_MADWIFI
195         echo "void madwifi_driver_register(void);"      >> driver_conf.c
196 endif
197 ifdef CONFIG_DRIVER_PRISM54
198         echo "void prism54_driver_register(void);"      >> driver_conf.c
199 endif
200 ifdef CONFIG_DRIVER_BSD
201         echo "void bsd_driver_register(void);"          >> driver_conf.c
202 endif
203 ifdef CONFIG_DRIVER_TEST
204         echo "void test_driver_register(void);"         >> driver_conf.c
205 endif
206         echo 'void register_drivers(void) {'            >> driver_conf.c
207 ifdef CONFIG_DRIVER_HOSTAP
208         echo "hostap_driver_register();"                >> driver_conf.c
209 endif
210 ifdef CONFIG_DRIVER_WIRED
211         echo "wired_driver_register();"                 >> driver_conf.c
212 endif
213 ifdef CONFIG_DRIVER_MADWIFI
214         echo "madwifi_driver_register();"               >> driver_conf.c
215 endif
216 ifdef CONFIG_DRIVER_PRISM54
217         echo "prism54_driver_register();"               >> driver_conf.c
218 endif
219 ifdef CONFIG_DRIVER_BSD
220         echo "bsd_driver_register();"                   >> driver_conf.c
221 endif
222 ifdef CONFIG_DRIVER_TEST
223         echo "test_driver_register();"                  >> driver_conf.c
224 endif
225         echo '}'                                        >> driver_conf.c
226
227 hostapd_cli: hostapd_cli.o hostapd_ctrl.o
228         $(CC) -o hostapd_cli hostapd_cli.o hostapd_ctrl.o
229
230 clean:
231         rm -f core *~ *.o hostapd hostapd_cli *.d driver_conf.c
232
233 -include $(OBJS:%.o=%.d)