OSDN Git Service

v23
[android-x86/external-wireless-tools.git] / wireless_tools / Makefile
1 #
2 # Basic and crude Makefile...
3 #
4
5 # Targets to build
6 STATIC=libiw.a
7 DYNAMIC=libiw.so.23
8 PROGS= iwconfig iwlist iwpriv iwspy iwgetid
9 MANPAGES=iwconfig.8 iwlist.8 iwpriv.8 iwspy.8
10
11 # Composition of the library :
12 OBJS = iwlib.o
13
14 # Define if tools should be built using static or dynamic version of the lib
15 IWLIBS=$(OBJS)
16 #IWLIBS=-liw
17
18 # Installation directory. By default, go in local.
19 # Distributions should probably use /usr/sbin, but they probably know better...
20 INSTALL_DIR= /usr/local/sbin/
21 INSTALL_LIB= /usr/local/lib/
22 INSTALL_INC= /usr/local/include/
23 INSTALL_MAN= /usr/local/man
24
25 # Header selection is now supposed to be automatic...
26
27 # Use private copy of Wireless Extension definition instead of the
28 # system wide one in /usr/include/linux. Use with care.
29 # Can be used to create multiple versions of the tools on the same system
30 # for multiple kernels or get around broken distributions.
31 #WE_HEADER= -DPRIVATE_WE_HEADER
32 WE_HEADER=
33
34 # ------------ End of config --------------
35
36 CC = gcc
37 RM = rm -f
38
39 RM_CMD = $(RM) *.BAK *.bak *.o ,* *~ *.a
40
41 CFLAGS=-O2 -Wall $(HEADERS) $(WE_HEADER)
42
43 LIBS=$(IWLIBS) -lm
44
45 all:: $(STATIC) $(DYNAMIC) $(PROGS)
46
47 .c.o:
48         $(CC) $(CFLAGS) -c $<
49
50 iwconfig: iwconfig.o $(OBJS)
51         $(CC) $(CFLAGS) -o $@ $< $(LIBS)
52
53 iwlist: iwlist.o $(OBJS)
54         $(CC) $(CFLAGS) -o $@ $< $(LIBS)
55
56 iwpriv: iwpriv.o $(OBJS)
57         $(CC) $(CFLAGS) -o $@ $< $(LIBS)
58
59 iwspy: iwspy.o $(OBJS)
60         $(CC) $(CFLAGS) -o $@ $< $(LIBS)
61
62 iwgetid: iwgetid.o
63         $(CC) $(CFLAGS) -o $@ $^
64
65 # Compilation of the dynamic library
66 $(DYNAMIC): $(OBJS)
67         $(CC) -O2 -shared -o $@ -Wl,-soname,$@ -lm -lc $^
68
69 # Compilation of the static library
70 $(STATIC): $(OBJS)
71         $(RM) $@
72         ar cru $@ $^
73         ranlib $@
74
75 # So crude but so effective ;-)
76 # Less crude thanks to many contributions ;-)
77 install::
78         install -m 755 $(PROGS) $(INSTALL_DIR)
79         install -m 644 $(STATIC) $(INSTALL_LIB)
80         install -m 755 $(DYNAMIC) $(INSTALL_LIB)
81         echo "Don't forget to fix your /etc/ld.so.conf and run ldconfig."
82         install -m 644 iwlib.h $(INSTALL_INC)
83         install -m 644 $(MANPAGES) $(INSTALL_MAN)/man8/
84
85 clean::
86         $(RM_CMD) 
87
88 realclean::
89         $(RM_CMD) 
90         $(RM) $(STATIC) $(DYNAMIC) $(PROGS)
91
92 depend::
93         makedepend -s "# DO NOT DELETE" -- $(INCLUDES) -- $(SRCS)
94 # DO NOT DELETE