2 ## Please check the configurion parameters below
5 ## Installation directory. By default, go in /usr/local
6 ## Distributions should probably use /usr, but they probably know better...
14 ## Uncomment this to build against this kernel
15 # KERNEL_SRC = /usr/src/linux
17 ## Uncomment this to force a particular version of wireless extensions.
18 ## This would use private copy of Wireless Extension definition instead
19 ## of the system wide one in /usr/include/linux. Use with care.
20 ## Can be used to create multiple versions of the tools on the same system
21 ## for multiple kernels or get around broken distributions.
22 # FORCE_WEXT_VERSION = 16
24 ## Uncomment this to build tools using dynamic version of the library
27 ## Uncomment this to build without using libm (less efficient)
28 ## This is mostly useful for embedded platforms
31 # ***************************************************************************
32 # ***** Most users should not need to change anything beyond this point *****
33 # ***************************************************************************
38 PROGS= iwconfig iwlist iwpriv iwspy iwgetid iwevent
39 MANPAGES8=iwconfig.8 iwlist.8 iwpriv.8 iwspy.8 iwgetid.8 iwevent.8
41 EXTRAPROGS= macaddr iwredir
43 # Composition of the library :
46 # Select library to link tool with
53 # Standard name for dynamic library so that the dynamic linker can pick it.
54 # We will just create a symbolic link to the real thing.
55 DYNAMIC_LINK= libiw.so
58 INSTALL_DIR= $(PREFIX)/sbin/
59 INSTALL_LIB= $(PREFIX)/lib/
60 INSTALL_INC= $(PREFIX)/include/
61 INSTALL_MAN= $(PREFIX)/man/
63 # Use local header if the version of wireless extensions is specified
64 ifdef FORCE_WEXT_VERSION
65 WEXT_FLAG = -DWEXT_HEADER=\"wireless.$(FORCE_WEXT_VERSION).h\"
70 RM_CMD = $(RM) *.BAK *.bak *.o *.so ,* *~ *.a *.orig *.rej
73 ifeq ($(wildcard $(KERNEL_SRC)/include/linux/wireless.h),)
74 $(error Kernel source is missing or incomplete)
76 KERNEL_INCLUDES = -I $(KERNEL_SRC)/include
79 # Do we want to build with or without libm ?
82 WELIB_FLAG = -DWE_NOLIBM=y
87 #CFLAGS=-O2 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror
88 CFLAGS=-O2 -W -Wall -Wstrict-prototypes
89 XCFLAGS=$(CFLAGS) $(WARN) $(HEADERS) $(WEXT_FLAG) $(WELIB_FLAG) $(KERNEL_INCLUDES)
92 all:: $(STATIC) $(DYNAMIC) $(PROGS)
95 $(CC) $(LDFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
97 $(CC) $(XCFLAGS) -c $<
99 $(CC) $(XCFLAGS) $(PICFLAG) -c -o $@ $<
101 iwconfig: iwconfig.o $(IWLIB)
103 iwlist: iwlist.o $(IWLIB)
105 iwpriv: iwpriv.o $(IWLIB)
107 iwspy: iwspy.o $(IWLIB)
111 iwevent: iwevent.o $(IWLIB)
115 macaddr: macaddr.o $(IWLIB)
117 # Compilation of the dynamic library
118 $(DYNAMIC): $(OBJS:.o=.so)
119 $(CC) -shared -o $@ -Wl,-soname,$@ $(LIBS) -lc $^
121 # Compilation of the static library
127 # So crude but so effective ;-)
128 # Less crude thanks to many contributions ;-)
130 install -m 755 -d $(INSTALL_DIR)
131 install -m 755 $(PROGS) $(INSTALL_DIR)
132 install -m 755 -d $(INSTALL_LIB)
133 install -m 644 $(STATIC) $(INSTALL_LIB)
134 install -m 755 $(DYNAMIC) $(INSTALL_LIB)
135 ln -sfn $(DYNAMIC) $(INSTALL_LIB)/$(DYNAMIC_LINK)
136 echo "Don't forget to add $(INSTALL_LIB) to /etc/ld.so.conf, and run ldconfig."
137 install -m 755 -d $(INSTALL_INC)
138 install -m 644 iwlib.h $(INSTALL_INC)
139 install -m 755 -d $(INSTALL_MAN)/man8/
140 install -m 644 $(MANPAGES8) $(INSTALL_MAN)/man8/
141 install -m 755 -d $(INSTALL_MAN)/man7/
142 install -m 644 $(MANPAGES7) $(INSTALL_MAN)/man7/
149 $(RM) $(STATIC) $(DYNAMIC) $(PROGS) $(EXTRAPROGS)
152 for f in $(PROGS); do \
153 $(RM) $(INSTALL_DIR)/$$f; \
155 $(RM) $(INSTALL_LIB)/$(STATIC)
156 $(RM) $(INSTALL_LIB)/$(DYNAMIC)
157 $(RM) $(INSTALL_LIB)/$(DYNAMIC_LINK)
158 $(RM) $(INSTALL_INC)/iwlib.h
159 for f in $(MANPAGES8); do \
160 $(RM) $(INSTALL_MAN)/man8/$$f; \
162 for f in $(MANPAGES7); do \
163 $(RM) $(INSTALL_MAN)/man7/$$f; \
166 # Versioned install...
167 # We rename each of the tool with a suffix corresponding to the version
168 # of WE it was compiled with. We use "iwredir" for the redirection...
170 vinstall:: iwredir install
171 @wev=$(FORCE_WEXT_VERSION) ; \
172 if [ "$$wev" == "" ] ; then \
173 wev=`./iwredir -wev`; \
175 echo "Installing tools for WE-$$wev..." ; \
176 for f in $(PROGS); do \
177 mv $(INSTALL_DIR)/$$f $(INSTALL_DIR)/$$f$$wev; \
179 install -m 755 iwredir $(INSTALL_DIR)
180 for f in $(PROGS); do \
181 ln $(INSTALL_DIR)/iwredir $(INSTALL_DIR)/$$f; \
184 vuninstall:: uninstall
185 @wev=$(FORCE_WEXT_VERSION) ; \
186 if [ "$$wev" == "" ] ; then \
187 wev=`./iwredir -wev`; \
189 for f in $(PROGS); do \
190 rm $(INSTALL_DIR)/$$f$$wev; \
192 $(RM) $(INSTALL_DIR)/iwredir;
195 makedepend -s "# DO NOT DELETE" -- $(INCLUDES) -- $(SRCS)